Hi;
I am trying to code equations 26, 27, 28, 29, 30 and 31 in the attachment file.
y(Y) is index(Set) of years,
sets
y years /1*10/
i production units
Iaday(i) new production units that will be added to the system
Imevcut(i) existing production units in the system
tho /1*50/ (I defined to 1 to 50 which is large enough)
parameters
Tlife(i) economic life of production units it is between 25 and 50
Tini(i) age of unit i in the beginning of the planning horizon (years). If negative, its absolute value represents the year of planned commissioning of the unit (with firm decision at a prior stage)
Tcons(i) construction time of unit i (years)
binary variables
u(i,y) the status of new unit i in year y equal to 1 if unit is commissioned
w(i,y) binary variable representing the start-up decision (commissioning) of the new unit i in year y
z(i,y) binary variable representing the shut-down decision (decommissioning) of the new unit i in year y
equ26(Iaday,y)… sum(tho$(ord(tho) ge ord(y)-Tlife(Iaday)+1 and ord(tho) le ord(y)),w(tho,Iaday))=e=u(Iaday,y);
equ27(Iaday,y)… sum(tho$(ord(tho) ge ord(y)-capsY+1 and ord(tho) le ord(y)),z(tho,Iaday))=l=1- u(Iaday,y);
loop(Imevcut,
loop(y,
if ( ((-Tini(Imevcut) =ord(y))),
u(Imevcut,y)=1;
else
u(Imevcut,y)=0;
);
);
);
loop(Imevcut,
loop(y,
if ( ((Tlife(Imevcut)-Tini(Imevcut))=ord(y)),
u(Imevcut,y)=1;
else
u(Imevcut,y)=0;
);
);
);
loop(Iaday,
loop(y,
if ( ord(y)=ord(y))),
5353 u(Imevcut,y)=1;
**** $143
5354 else
5355 u(Imevcut,y)=0;
**** $143
5356 );
5357 );
5358 );
5359 loop(Imevcut,
5360 loop(y,
5361 if ( ((Tlife(Imevcut)-Tini(Imevcut))=ord(y)),
5362 u(Imevcut,y)=1;
**** $143
5363 else
5364 u(Imevcut,y)=0;
**** $143
5365 );
5366 );
5367 );
5368 loop(Iaday,
5369 loop(y,
5370 if ( ord(y)<Tcons(Iaday),
5371 u(Iaday,y)=0;
**** 143
5372 );
5373 );
5374 );
5375
5376 equ26(Iaday,y).. sum(tho(ord(tho) ge ord(y)-Tlife
(Iaday)+1 and ord(tho) le ord(y)),w(tho,Iaday))=e=u(Iaday,y);
**** $171 171
5377 equ27(Iaday,y).. sum(tho(ord(tho) ge ord(y)-capsY
**** $
+1 and ord(tho) le ord(y)),z(tho,Iaday))=l=1- u(Iaday,y);
140 $171 $171
What’s the problem? How can I solve this problem. Please, help me.
Thanks to everbody
–