I want to write these equations:
X21+X22+X23+X24=55
X11+X12+X13+X14=90
X11+X21<=H1*Y11+H2*Y21+H3*Y31
I know I should use SUM function but I don't know it exactly but i can't convert them. how can I write them in equation section? here is the part of my code:
SETS
i regions /shomal,jonub/
j cities /shiraz,esfahan,hamedan,yazd/
k palaieshgahha /p1,p2,p3/;
PARAMETERS
Y(k,j) pk Ntekhab shavad ia nashavad /1,0/
S(k) sarmaieye avalie /400000,600000,950000/
H(k) zarfiate palaieshgah /20,35,50/;
Table c(i,j) cost 1milion boshke b milion rial
shiraz esfahan hamedan yazd
shomal 120 90 75 80
jonub 45 65 110 95;
VARIABLES
X(i,j) tedad milion boshke
Y(k,j) Ntekhabe palaieshgah
Z total cost;
POSITIVE VARIABLE X ;
EQUATIONS
//I have problem here
rafaelcidade's answer needs some corrections i.e instead of
should be
and instead of
should be
another option is define a set of equations on set i defining first two equations as
Another observation on question is that you defined Y as both parameter and variable. You also defined two values for the parameter which I am not sure if it is wrong but in case it isn't the remaining values will be zero. You probably wanted to define a parameter Y(i) and not Y(k,j)
Anyway, if the values of Y are known then you should not define it as variable. You can find another example with sum and more details in the following tutorial http://www.gams.com/dd/docs/gams/Tutorial.pdf