i tried to save i th term of a parameter in a scalar but gams says Uncontrolled set entered as constant. can anybody help me?
here is my code
sets i /13/
j/13/;
In the example below are a couple ways to do what you ask.
set i / 1*3 /;
singleton set s(i);
scalar
counter / 1 /
a / NA /
b / NA /
;
parameter dinf(i);
dinf(i) = ord(i);
a = sum{i$[ord(i) = counter], dinf(i)};
* singleton sets can have at most one member, so
* we can do things with them we cannot do with multi-element sets.
s(i)$[ord(i) = counter] = yes;
b = dinf(s);
display a, b;