I would like to conditionally write constraints. In order to explain what I mean, consider the following example
Let i, s be sets.
s = {a,b}
i = {1,2}
The statement eq(i,s).. generates the equations eq(1,a), eq(1,b), eq(2,a), eq(2,b)
I would like to tell GAMS to only generate equations by only considering 1 element of s (I don't know which one).
The result would be either
eq(1,a), eq(2,a) or eq(1,b), eq(2,b)
So, I would like to implement the following :
Code: Select all
SCALAR written ;
written = 0 ;
loop(i,
written = 0 ;
loop(s,
if (written = 0,
write equation eq(i,s)..
written = 1 ;
)
)
)