I defined a set and a parameter as
Code: Select all
Sets i /1, 2/;
Positive Variable X_V_ce(i);
Code: Select all
Z1(i).. X_V_ce(i) =e= X_V_ce(i+1) + ....
What can I do to add 1 or 2 to an element?
Regards
Code: Select all
Sets i /1, 2/;
Positive Variable X_V_ce(i);
Code: Select all
Z1(i).. X_V_ce(i) =e= X_V_ce(i+1) + ....
If you want another formulation for this case, you could use the cardinality of set i (the number of elements):Z1(i).. X_V_ce("2") =e= 0;
Hope this answers your questionZ1(i).. X_V_ce(i) =e= X_V_ce(i+1)$(ord(i) ne card(i) + (.....)$(ord(i) eq card(i);
Renger wrote: ↑6 years ago Hi
This is not a problem for Gams. For i = 2, it writes the equation asIf you want another formulation for this case, you could use the cardinality of set i (the number of elements):Z1(i).. X_V_ce("2") =e= 0;
Hope this answers your questionZ1(i).. X_V_ce(i) =e= X_V_ce(i+1)$(ord(i) ne card(i) + (.....)$(ord(i) eq card(i);
Cheers
Renger