Thanks a lot, Mathias.
What does variable hv represent? and could you please explain the restriction5 ? Thank you very much.
cheers,
servus126
在 2012å¹´9月10日星期一UTC+2下åˆ2æ—¶42分46秒,Mathias写é“:
Hi servus126!
Here you get a model for tour planning with multiple vehicles and timewindows which works for me. Try to simplify the model for your problem by changing and deleting some restrictions.
In my include file the depot gets the index “depot” and is not, like all the other nodes, included in the subset customers(i).
I hope it will help you. Just let me know if you don’t understand a restriction.
set
k vehicles
i nodes
alias(i,j)
set customers(i) subset;
parameter
t(i,j) trip time from i to j
c(i,j) distance from i to j
d(i) demand of node i
cap(k) capacity of vehicle k
BigM BigM
Tmax max trip time
m amount of nodes
tf(i) earliest service time of i
ts(i) latest service time of i;
$include VRP.inc
parameter BigM BigM;
BigM = sum((i,j), t(i,j)+sz(i))+1;
variables Z objective function value;
binary variables x service variable;
binary variables y tourvariable;
positive variables w service time;
positive variable hv xxx;
Equations
Objective_function xxx
Restriction1(k) xxx
Restriction2(i,k) xxx
Restriction3(j,k) xxx
Restriction4(j) xxx
Restriction5(i,j) xxx
Restriction6(i,k) xxx
Restriction7(i) xxx
Restriction8(i) xxx
Restriction9(i,j,k) xxx
Restriction10(i,k) xxx
Restriction11 xxx
;
Objective_function…
Z =e= sum((i,j,k),c(i,j)*x(i,j,k));
Restriction1(k)…
sum(i, d(i)*y(i,k)) =l= cap(k);
Restriction2(i,k)…
sum(j, x(i,j,k)) =e= y(i,k);
Restriction3(j,k)…
sum(i, x(i,j,k)) =e= y(j,k);
Restriction4(i)$(customers(i))…
sum(k, y(i,k)) =e= 1;
Restriction5(i,j)$(customers(j) and customers(i) and ord(i)ord(j))…
hv(i)-hv(j)+ m*sum(k, x(i,j,k)) =l= m-1;
Restriction6(i,k)…
x(i,i,k) =e= 0;
Restriction7(i)$(customers(i))…
w(i) =g= tf(i);
Restriction8(i)$(customers(i))…
w(i) =l= ts(i);
Restriction9(i,j,k)$(customers(j) and ord(i)ord(j))…
w(j) =g= w(i) + sz(i) + t(i,j) - (1-x(i,j,k))*BigM;
Restriction10(i,k)$(customers(i))…
w(i) + sz(i) + t(i,‘depot’) - (1-x(i,‘depot’,k))*BigM =l= Tmax;
Restriction11…
w(‘dstart’)=e=0
\
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/V7xcqXwo1UIJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.