Change set values

Problems with syntax of GAMS
Post Reply
waeltaha
User
User
Posts: 6
Joined: 3 years ago

Change set values

Post by waeltaha »

Hello,

I have defined a set as follows:
set li /li4/;

Afterwards, all the equations and parameters are defined over the set li. There is a large number of equations and parameters.

Initially, I need to run the model using li4 only. Based on the output results, I need to rerun the model while redefining the set as follows:
set li /li0*li40/;

However, I'm facing an issue since I cannot redefine the same set in the same GAMS file twice. How could I resolve this?

Thank you for your assistance.
Online
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Change set values

Post by bussieck »

Make "set li /li0*li40/;" and then a dynamic "set lirun(li);". Declare all symbols over li but when you use the symbol index over lirun. Now first you assign only li4 to lirun (lirun('li4')=yes; solve ..." and then you solve for all li: lirun(li) = yes; solve ...".

-Michael
waeltaha
User
User
Posts: 6
Joined: 3 years ago

Re: Change set values

Post by waeltaha »

Ok, this is useful. Thank you for your help.
Post Reply