Uncontrolled Set entered as constant error 149 issue

I keep getting error 149 whenever I use set i. Why is this happening?



free variable cost;

set
i/1*12/;

Parameter
demand(i) /1 1000, 2 2000, 3 1500, 4 800, 5 2500, 6 2000, 7 1750, 8 2900, 9 900, 10 3500, 11 4000, 12 2000/;

NonNegative Variables Inv(i), W(i), H(i), L(i), C(i), S(i), PR(i), POT(i), PS(i);
equations obj, c1,c2,c3,c4,c5,c6,c7;


obj…
cost =e= 50PR(i) + 52PS(i) + 58POT(i) + 2C(i) + 3S(i) + 300H(i) + 400*L(i);

c1…
40*W(i) =e= PR(i);

c2…
2.5*W(i) =e= POT(i);

c3…
W(“1”) =e= 50;

c4…
W(i) - W(i-1) + H(i) - L(i) =e= 0;

c5…
Inv(“12”) =g= 700;

c6…
S(“12”) =e= 0;

c7…
PR(i) + PS(i) + POT(i) + S(i) - S(i-1) - Inv(i) + Inv(i-1) + 1000 =e= demand(i);

model number5 /all/;
solve number5 using lp minimizing cost;

Hi Setha,

You need to use set-indices in your equationnames too. For example: c1(i)…
And in your objective funtion the left-handside doesn’t have index i, but the righhand-side does. Perhaps you want to sum over i in your righthand-side?

See also: https://www.gams.com/35/docs/UG_Equations.html

Cheers,
GFA