how to dynamically update a set

Problems with syntax of GAMS
Post Reply
yanzhiping
User
User
Posts: 85
Joined: 1 year ago

how to dynamically update a set

Post by yanzhiping » 1 year 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: 108
Joined: 1 year ago

Re: how to dynamically update a set

Post by cladelpino » 1 year ago

This is GAMS code to accomplish that:

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

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

Post Reply