I have the following gams program:
Set x_set /1*2/;
variable x(x_set) /1.lo = 0 ,1.up = 1,2.lo = 0,2.up = 1/;
Set y_set /1*3/;
variable y(y_set) /1.lo = 0,1.up = 1,2.lo = 0,2.up = 1, 3.lo = 0, 3.up = 1/;
Set S /1*2/;
variable obj; equation eqobj; eqobj.. obj =e= (x['1']+x['2']+y['1']+y['2']+y['3']);
equation eqcon1; eqcon1(S).. 0.5 =l= x[S];
*if defining S over x_set, the following is not possible anymore
equation eqcon2; eqcon1(S).. 0.7 =l= y[S];
model mod /all/;
solve mod minimizing obj using minlp;
Unfortunaly, I will get a domain set violation error Domain violation for set
with the program above. This error is caused because I am not using the set I defined the variable above in the indexed equation. Is there any way I can accomplish what I am trying to do, i.e. to iterate the multidimensional variable without using the set it was defined above?
(Note: A new set for every equation is not wanted, as there are a lot of constraints, therefore the same set should be reused).