Uncontrolled Set entered as constant error 149 issue

Problems with syntax of GAMS
Post Reply
Setha25
User
User
Posts: 2
Joined: 2 years ago

Uncontrolled Set entered as constant error 149 issue

Post by Setha25 »

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= 50*PR(i) + 52*PS(i) + 58*POT(i) + 2*C(i) + 3*S(i) + 300*H(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;
GFA
User
User
Posts: 50
Joined: 5 years ago

Re: Uncontrolled Set entered as constant error 149 issue

Post by GFA »

Hi Setha,

You need to use set-indices in your equationnames too. For example: c1(i).. <equation>
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
Post Reply