online truck routing.gms (3.14 KB)
I am new to GAMS. I apologize in advance if I am making silly mistakes. I am getting the following errors when I attempt to solve the model on the equation Xlt_eq-
Error 8
‘)’ expected
*** Error 10 in
‘,’ expected
*** Error 119
Number (primary) expected
*** Error 8
‘)’ expected
*** Error 408
Too many ),] or }
The code is below
Set
j ‘OD pair’ /OD1, OD2/
w ‘VOT classes’ /VOT1, VOT2/
l ‘road segment’ /12,24,13,34,23/
all_routes ‘all routes’ /124,1234,134,24,234/
route_OD1(all_routes) ‘route of OD1’ /124,1234,134/
route_OD2(all_routes) ‘route of OD2’ /24,234/
d(j,all_routes) /OD1.(124,1234,134),OD2.(24,234)/
q(j,all_routes,w) /(OD1.(124,1234,134)).(VOT1,VOT2),(OD2.(24,234)).(VOT1,VOT2)/;
alias (l,ll),(all_routes,a_r)
display d,q
set Table e(j,w) ‘# of trucks of class w with OD pair j’
VOT1 VOT2
OD1 20 20
OD2 20 20;
*alias (e,ee);
set Table f(l,all_routes) ‘links in routes’
124 1234 134 24 234
12 YES YES
24 YES YES
13 YES YES
34 YES YES YES
23 YES YES;
set Table M(w,all_routes) ‘VOT classes in routes’
124 1234 134 24 234
VOT1 YES YES YES YES YES
VOT2 YES YES YES YES YES;
Set g(l,all_routes ,w);
g(l,all_routes ,w) = f(l,all_routes)*M(w,all_routes);
display g;
Alias (j,jj),(w,ww)
Variables
obj, Fjwr, Cl,alpha_equal_1, Xlt, cost;
Positive Variable
*alpha
alpha(j, w, all_routes)
zeta(j,w);
Scalar
epsilon_a /2/
epsilon_b /3/
pass_vehicles /5/
t_f /3/
Capacity /3/;
Equations
Cl_eq, Fjwr_eq, alpha_equal_1_eq, Xlt_eq,cost_eq,F_zeta_eq;
alpha_equal_1_eq(j,w)… 1=e=sum(all_routes$d(j,all_routes),alpha(j,w,all_routes));
XlT_eq(l)… Xlt(l) =e= sum((j,w,all_routes$d(j,all_routes)),e(j,w)*alpha(j,w,all_routes$d(j,all_routes)));
Cl_eq(l)… Cl(l) =e= t_f*[1+epsilon_a*((pass_vehicles+3*Xlt(l))/Capacity)*epsilon_b];
Fjwr_eq(j,w,all_routes)… Fjwr(j,w,all_routes) =e= sum(l,Cl(l));
F_zeta_eq(j,w,all_routes)… 0 =l= zeta(j,w) - Fjwr(j,w,all_routes);
Model OTR /F_zeta_eq.alpha, alpha_equal_1_eq, XlT_eq/;
option limrow = 120;
solve OTR using mcp;
What’s wrong with my approach?