how to dynamically update a set

Problems with syntax of GAMS
Post Reply
yanzhiping
User
User
Posts: 85
Joined: 10 months ago

how to dynamically update a set

Post by yanzhiping » 10 months 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: 55
Joined: 11 months ago

Re: how to dynamically update a set

Post by cladelpino » 10 months ago

This is GAMS code to accomplish that:

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

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

Post Reply