Hello Experts,
I am working on a VRPTW (Vehicle Routing Problem with Time Windows), based on a mathematical model that has already been created. I have a model file that should fulfill the requirements for a Vehicle Routing Problem with multiple vehicles, but I am unsure of how to specify the constraint that the whole quantity that the node requires must be delivered within a time window interval defined by [ai, bi]:
sik + d(i, j) − K(1 − xijk) sjk ∀(i, j ) ∈ A, ∀ k ∈ {1, . . . , K}, (8)
ai <= sik <= bi ∀i ∈ {1, . . . , N}, ∀ k ∈ {1, . . . , K}, (9)
These are the constraints that must be accounted for, given that sik/sjk is the time at which vehicle k reaches node i and j respectively, d(i, j) is the travel time from i to j, K is the number of vehicles, and xijk is the binary variable indicating that vehicle k travels from i to j.
Here is our working model file so far:
param N >= 0;
param k >= 0;
set dem_Nodes := {2..N};
set Nodes ordered := {1..N};
set veh := {1..k};
set Arcs := {i in Nodes, j in Nodes: i<>j};
param Q{veh}>0;
param q{Nodes}>=0;
param D{Arcs};
var x{Arcs, veh}, binary;
var y{Arcs}, binary;
minimize Total_dist:
sum {t in veh} sum {(i,j) in Arcs} D[i,j] * x[i,j,t];
subject to Start{j in dem_Nodes}:
sum{i in Nodes: i<>j} y[i,j]=1;
subject to Continue{i in dem_Nodes}:
sum{(i,j) in Arcs: i<>j} y[i,j]=1;
subject to Going:
sum{j in dem_Nodes, i in Nodes: i<>j} y[1,j]=k;
subject to Returning:
sum{i in dem_Nodes, j in Nodes: i<>j} y[i,1]=k;
subject to Capacity:
sum {t in veh} sum {i in dem_Nodes, j in Nodes: i<>j} x[i,j,t]*q[j]<=Q[k];
subject to Link:
sum {t in veh} sum{i in Nodes, j in Nodes: i<>j} x[i,j,t] = sum{i in Nodes, j in Nodes: i<>j} y[i,j];
Any help in how to include time window constraints would be greatly appreciated!
Thank you,
Kevin