Dear All,
I am new user of GAMS. I modeled my optimization formulation in GAMS but could not achieve expected results. I earnestly request you if kindly checked my code to see if there is any error and suggest accordingly. It is difficult for me write down the formulations with this email. For this reason, I am attaching my formulation in a powerpoint file. please find the attached powerpoint file. I am also copied my code here:
set i ‘section’ /
A
B
C
D
E
F
G
H
I
J
/;
set t ‘years in the planning horizon’ /
year1*year5
/;
alias(t,j);
set p(t) /year1*year4/;
set m ‘maintenance strategies’ /
NN
PM
LR
MR
HR
/;
set m1(m)‘rehabilitation’/LR, MR, HR/;
set m2(m)‘preventive maintenance’/PM/;
parameter yn(t) ‘year number’;
yn(t) = ord(t);
parameter l(i)‘length of section i miles’/
A 1.0
B 1.0
C 1.0
D 1.0
E 1.0
F 1.0
G 1.0
H 1.0
I 1.0
J 1.0
/;
table u(i,m)‘unit cost of maintenance strategy m on section i in 1000$/mile’
NN PM LR MR HR
A 0 34 202 277 516
B 0 34 202 277 516
C 0 34 202 277 516
D 0 34 202 277 516
E 0 34 202 277 516
F 0 34 202 277 516
G 0 34 202 277 516
H 0 34 202 277 516
I 0 34 202 277 516
J 0 34 202 277 516
;
parameter r(i) ‘section deterioration rate’ /
A 0.05
B 0.05
C 0.05
D 0.05
E 0.05
F 0.05
G 0.05
H 0.05
I 0.05
J 0.05
/;
table pi(i, m) ‘deterioration rate’
NN PM LR MR HR
A 0.05 .03 .02 .01 .005
B 0.05 .03 .02 .01 .005
C 0.05 .03 .02 .01 .005
D 0.05 .03 .02 .01 .005
E 0.05 .03 .02 .01 .005
F 0.05 .03 .02 .01 .005
G 0.05 .03 .02 .01 .005
H 0.05 .03 .02 .01 .005
I 0.05 .03 .02 .01 .005
J 0.05 .03 .02 .01 .005
;
Parameter CSNet /80/;
parameter Co(i) ‘initial condition score of section i’ /
A 65
B 75
C 85
D 65
E 55
F 75
G 70
H 90
I 65
J 95
/;
table e(i,m)‘improvement in condition score for section i receiving treatment m’
NN PM LR MR HR
A 0 3 15 25 40
B 0 3 15 25 40
C 0 3 15 25 40
D 0 3 15 25 40
E 0 3 15 25 40
F 0 3 15 25 40
G 0 3 15 25 40
H 0 3 15 25 40
I 0 3 15 25 40
J 0 3 15 25 40
;
parameter lambda ‘weight on objective function’
/0.7/;
parameter q1 ‘minimum condition score requirement for each road section’
/60/;
parameter q2 ‘maximum possible road condition score’ /100/;
parameter Q ‘minimum network condition score’ /74/;
parameter g ‘maximum number of maintenance allowed for each road section over the design period’
/5/;
parameter meanbudget(t) ‘mean budget for year t in thousands $’ /
year1 690
year2 370
year3 700
year4 350
year5 500
/;
variables
C(i,t)‘road condition score for section i at year t’
CS(t) ‘average network condition score at year t’
x(i,t,m)‘decision variable’
obj ‘objective’
Cpos(t)‘part of deviation’
Cneg(t)‘n part of deviation’;
binary variable x;
equations
objective ‘objective function’
budget(t) ‘budget constraint’
condition(i,t) ‘condition score’
mincondition(i,t) ‘minimum condition score’
maxcondition(i,t) ‘maximum condition’
mincondnet(t) ‘minimum network condition’
maxtreatment(i) ‘maximum number of treatment allowed’
avgcondition(t)‘average network condition score’
deviation(t) ‘constraint for deviation’
Cpositive(t) ‘cpos greater than zero’
Cnegative(t) ‘cneg greater than zero’
rehab(i) ‘rehabilitation allowed’
pm(i)‘preventive maintenance allowed’
var(i,t) ‘varible constraint’ ;
objective … obj =e= (lambda*(sum(t,CS(t))/(card(t)))+(1-lambda)*(-sum(t, (Cpos(t)+Cneg(t)))));
budget(t) … sum((i,m), l(i)*u(i,m)x(i,t,m)) =l= (meanbudget(t));
condition(i,t) … C(i,t) =e= Co(i) ((1-r(i))yn(t)) + sum((j,m)$(ord(j)le ord(t)), x(i,j,m)e(i,m)((1-pi(i,m))((yn(t)- ord(j)))));
mincondition(i,t) … C(i,t) =g= q1;
maxcondition(i,t) … C(i,t) =l= q2;
avgcondition(t)… CS(t) =e=(sum(i,C(i,t)*l(i)))/(sum(i,l(i)));
mincondnet(t) … CS(t)=g= Q;
maxtreatment(i) … sum((t,m), x(i,t,m)) =l= g;
deviation(t)… Cpos(t) - Cneg(t)+ CS(t) =e= CS(t+1);
Cpositive(t)… Cpos(t)=g=0;
Cnegative(t)… Cneg(t)=g=0;
rehab(i)…sum((t,m1),x(i,t,m1))=l=1;
pm(i)…sum((t,m2),x(i,t,m2))=l=2;
var(i,t) … sum(m, x(i,t,m)) =e= 1;
model thesisdeterministic /all/;
solve thesisdeterministic maximizing obj using mip;
display x.l, x.m;
display C.l, C.m;
I know it time consuming to help me. I hope there is anyone who can help me out.
Thanks,
Al Amin
PhD Student
University of Texas at Austin
–
GAMS_HELP_FORMULATION.pptx (637 KB)