equation control

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

equation control

Post by yanzhiping » 1 year ago

I have a conditional equation r1 depending on set q1, the equation r1 is controlled by the set b. if b is empty, then no r1 needed.
I used the following code, but it is not working.

Code: Select all

set q1(a,b,c,d,e)
equation r1(a,b,c,d,e)
r1(a,b,c,d,e)$b..
How may I control the equation correctly?

Thanks.

cladelpino
User
User
Posts: 108
Joined: 1 year ago

Re: equation control

Post by cladelpino » 1 year ago

Hi Yan: Check out this example, inspired with the help of the great Erwin at http://yetanothermathprogrammingconsult ... y-set.html

Code: Select all

$onempty

set a /a1*a10/

set b(*) / /;

variable x(a),dummy;

equation r1,fobj;

r1(a,b)..       x(a)=e=1;
fobj..         dummy=e=1;

model c /all/;
solve c using lp minimizing dummy;

Post Reply