how to dynamically update a set

Problems with syntax of GAMS
yanzhiping
User
User
Posts: 23
Joined: 4 weeks ago

how to dynamically update a set

Postby yanzhiping » 3 weeks ago

See below, how can I dynamically change set B? B is originally empty.

set A, B
parameter C(A);
loop(A,
if (C(A)>0,
**put A to set B
);
);

cladelpino
User
User
Posts: 16
Joined: 1 month ago

Re: how to dynamically update a set

Postby cladelpino » 3 weeks ago

This is GAMS code to accomplish that:

sets A,B(A);
parameter C(A);

B(A)=YES$(C(A)>0);


Return to “Syntax”

Who is online

Users browsing this forum: No registered users and 1 guest