Discrete and Continuous Dynamical Systems Supplement 2007 Pp. 240-249
Discrete and Continuous Dynamical Systems Supplement 2007 Pp. 240-249
Discrete and Continuous Dynamical Systems Supplement 2007 Pp. 240-249
DYNAMICAL SYSTEMS
SUPPLEMENT 2007
Website: www.AIMSciences.org
pp. 240249
1. Introduction. Vehicle routing problem (VRP) is defined on a undirected network G = (V, E) with a node set V = {0, 1, . . . , n} and an edge set E. Node 0 is a
depot. Each other node i > 0 represents a customer with a known service time di
and each edge has a non-negative travel cost cij = cji . The VRP consists of determining a set of m vehicle trips of minimum total cost, such that each vehicle starts
and ends at the depot, each client is visited exactly once, and the total demand
handled by any vehicle does not exceed the vehicles capacity W .
The vehicle routing problem is a well-known integer programming problem which
falls into the category of NP-Hard problems. For such problems it is often desirable
to obtain approximated solutions, so they can be found quickly enough and are
sufficiently accurate for the purpose. Usually this task is accomplished by using
various heuristic methods, which rely on some insight into the nature of the problem.
The VRP arises naturally as a central problem in the fields of transportation,
distribution, and logistics [4]. In some market sectors, transportation means a high
percentage of the value is added to goods. Therefore, the utilization of computerized
methods for transportation often results in significant savings ranging from 5% to
20% in the total costs, as reported in [11].
The vehicle routing problem with time windows (VRPTW) is the generalization
of the vehicle routing problem (VRP) with the additional time constraints. In these
problems, the service of a customer can begin within a time window [ei , li ] defined
by customer i. The vehicle can not arrive earlier than time ei and no later than
time li . The regular VRP can be viewed as the situation ei = 0 and li = for all
1 i n. When 0 < ei < li < , it is also known as a double-sided time window
while a single-sided time window is refer to either ei = 0 or li = , but not both. A
2000 Mathematics Subject Classification. Primary: 58F15, 58F17; Secondary: 53C35.
Key words and phrases. vehicle routing problem, vehicle routing problem with time window,
genetic algorithm.
240
241
vehicle arriving earily than the earliest service time of a customer will incur waiting
time. This penalizes the scheduling either in the direct waiting cost or the increase
number of vehicles.
Due to its complexities and usefulness in real life, the VRPTW continue to
draw attention from researchers and has been a well-known problem in network
optimization. Early surveys of solution methods for VRPTW can be founded in
Golden and Assad [6, 7], Desrochers et al.[5], and Solomon and Desrosiers [10]. The
recent developments can be found in Ioannou, Kritikos, and Prastacos [8], Braysy
and Gendreau [2, 3], and Braysy, Dullaert, and Genderau [1]. The goal of this paper
is to adapt and implement Prins algorithm to handle VRP with time windows. For
simplicity, we will only consider a single-sided time window with ei > 0 and li =
for all i.
2. Problem Formulation. Before we formally give the mathematical formulation
of the vehicle routing problem with time windows, we need to introduce some basic
terminologies from graph theory.
Definition 1. An undirected graph G is an ordered pair G = (V, E) where V =
{0, 1, 2, ..., n} is the set of vertices and E = {(i, j)|i, j V } is the set of unordered
pairs of distinct vertices, called edges.
Definition 2. Let G = (V, E) be a graph, a path P is a sequence of vertices
i1 , i2 , ..., ik , such that (ij , ij+1 ) E, for all 1 j k 1.
Definition 3. Let G = (V, E) be a graph. G is called a connected graph if there is
a path between every pair of vertices .
Now let G be a given undirected graph corresponding to a vehicle routing problem
where vertex 0 corresponds to the depot and vertex i corresponds to customer i,
for 1 i n. For convenience, let us define the following known constants and
variables:
cij : the cost associated with edge (i, j), the cost could be the travel distance, the travel time, or the travel cost from customer i to customer j. For
simplicity, we assume cij = cji . If there is no edge between vertex i and j,
cij = .
bi : the vehicle arrival time at customer i.
di : the service time for customer i.
qi : the demand for customer i.
ei : the earliest arrival time for customer i.
L: maximal operation time for each vehicle.
Q: the vehicle capacity.
Ri : a sequence (i1 , i2 , ...ik ) corresponding to a route where ij V , such that
a particular vehicle will serve customers (i1 , i2 , ...ik ) according to the order of
the sequence.
Wij : the waiting time for vehicle i at customer j.
Consider a given route Ri = (i1 , i2 , ..., ik ), the actual arriving time bij can be
defined by
bij = bij1 + dj1 + cij1 ,ij ,
i.e., the arrival time at customer ij1 , plus the service time at customer ij1 and
the travel time from customer ij1 to customer ij . To ensure the earliest arrival
242
k
X
(cij1 ,ij ) +
j=2
k
X
W ij +
j=1
k
X
dij + cik ,0 .
j=1
l
X
C(Ri ).
i=1
j1
X
k=i+1
j
X
qk Q.
(1)
k=i+1
Then Eij is the total travel cost(time) for the route (i + 1, i + 2, ..., j). An optimal
split for S corresponds to shortest path P from vertex 0 to vertex n in H.
The following example (Prins, [9]) demonstrates the construction. The first graph
of Fig. 1 shows a sequence S=(a, b, c, d, e). The number associates with each edge is
the travel time. Let us assume the service time (delivery time) is 0 and the demands
are 5, 4, 4, 2 and 7, respectively. The capacity of the vehicle is 10 and the maximum
operation time is 90. Then the auxiliary graph H is the second graph in Fig. 1.
The edge in H with weight 55 corresponds to the travel time of the trip (0, a, b, 0).
The weight associated with the other edges are similarly defined. The shortest path
243
from 0 to e is (0, b, c, e) with minimal total travel time 205. The last graph gives
the optimal result with three trips.
The auxiliary graph helps us understand the idea how to split a given chromosome
S into optimal trips. But in practice, we do not have to construct such graph
H. It can be done by a labeling algorithm and a splitting procedure [9]. Let
S = (1, 2, ..., n) be a given chromosome. Two labels Vj and Pj for each vertex j in
S are computed. Vj is the cost of the shortest path from node 0 to node j in H,
and Pj is the predecessor of j on this path. The minimal cost is given at the end by
Vn . For any given i, note that the increment of j stops when L or Q are exceeded.
The labeling algorithm can be described as follow:
V0 := 0
for i := 1 to n do Vi := + endfor
for i := 1 to n do
cost := 0; load := 0; j := i
repeat
load := load + qSj
if i = j then
cost := c0,Sj , +dSj + cSj,0
else
cost := cost cSj1 ,0 + cSj1 ,Sj + dSj + cSj,0
endif
if (cost L) and (load < Q) then
if Vi1 + cost < Vj then
Vj := Vi1 + cost
Pj := i 1
endif
j := j + 1
endif
until (j > n) or (cost > L) or (load > Q)
endfor
3.2. Implementation for Time Windows. Recall Eij in (1) represents the total
travel time for route (i + 1, i + 2, ..., j). To incorporate the earliest arrival time ei ,
the total travel time Eij for the same route can be calculated by
Pj1
Eij = c0,i+1 + k=i+1 (Wi + dk + ck,k+1 ) + Wj + dj + cj,0 ,
where Wi is the waiting time defined earlier. If Eij L, then the arc (i, j) exists
in the auxiliary graph H, and the shortest path from 0 to n in H corresponding to
an optimal split for S.
To accommodate this modification, the splitting procedure can be modified as
follows:
244
V0 := 0
for i := 1 to n do Vi := + endfor
for i := 1 to n do
cost := 0; load := 0; j := i
repeat
load := load + qSj
if i = j then
cost := max[c0,Sj , eSj ] + dSj + cSj,0
else
cost := max[cost cSj1 ,0 + cSj1 ,Sj , eSj ] + dSj + cSj,0
endif
if (cost L) and (load < Q) then
if Vi1 + cost < Vj then
Vj := Vi1 + cost
Pj := i 1
endif
j := j + 1
endif
until (j > n) or (cost > L) or (load > Q)
endfor
Here c0,Sj is the regular arriving time at customer Sj , and eSj is the earliest arrival
time at customer Sj . If eSj < c0,Sj , we will pick eSj . Otherwise, we will pick the
regular arrival time c0,Sj .
4. CROSSOVER. As mentioned earlier, the reproductive process in GA can be
done either by crossover or by mutation procedures. A crossover (or recombination)
operation is performed upon the selected chromosomes. We will use the order
crossover which can be explained as follow: First, two chromosomes are randomly
selected from the initial population and the least-cost one becomes the first parent
P1 . Two cutting sites i and j are randomly selected in P1 , here i=4 and j=6. Then,
the substring P1 (i)...P1 (j) is copied into C(i)...C(j). Finally, P2 is swept circularly
from j + 1 onward to complete C with the missing nodes. C is also filled circularly
from j + 1. The other child maybe obtained by exchanging the roles of P1 and P2 .
Table 1 demonstrates the process. Let i = 4 and j = 6, so C(4) = P1 (4),
C(5) = P1 (5), and C(6) = P1 (6). Now C(7) should equal to P2 (7). Because
C(6) = 3, we shift to P2 (8), so C(7) = P2 (8) = 2. Now C(8) should equal to P2 (9).
Again C(5) = 10 = P2 (9), we will skip P2 (9) and let C(8) = P2 (10) = 1. Repeat
this process until C is constructed.
5. MUTATION. The classical genetic algorithm framework must be hybridized
with some kind of mutation procedure. In this paper, we simply adopt the local
search procedure in [9].
A child C produced by crossover could be improved by local search with a fixed
mutation rate pm which stands for the rate or the probability of mutation and is
a fundamental parameter in genetics and evolution. Here pm is the measure of the
impact of mutations on the child C. The mutation procedure can be described
as follows. A chromosome C is converted into a VRPTW solution. Then for all
possible pairs of distinct vertexes (u, v), the following simple moves are tested. Let
245
c
30
25
d
30
10
25
40
15
a
35
20
55
95
40
0
40
55
50
115
60
150
80
70
e 205
85
90
120
Trip 2
60
Trip 1
55
Trip 3
90
246
Rank 1 2
i=4
j=6
10
P1
9 8
10
P2
9 8
10
7 6 4
5
10
3
2 1 9
Table 1. Example of crossover
M7. If u and v are in the same trip, replace (u, x) and (v, y) by (u, v) and
(x, y), ie, the new sequence is (...u, v, ...x, y, ...).
M8. If u and v are not in the same trip, replace (u, x) and (v, y) by (u, v) and
(x, y), ie, the new sequence is (...u, v, ...x, y, ...).
M9. If u and v are not in the same trip, replace (u, x) and (v, y) by (u, y) and
(x, v), ie, the new sequence is (...u, y, ...x, v, ...).
Let C be a new chromosome produced by the mutation procedure. If C is
better than the worst in the current population, C will be added into the current
population, and the worst one will be moved. If C is better than the current best
solution, we consider the current mutation process as a productive mutation.
6. THE IMPLEMENTED ALGORITHM FOR VRPTW. The population
is implemented as an array of ( is the population size) chromosomes, always
sorted in increasing order of cost to ease the basic genetic algorithm iteration. Thus,
the best solution is 1 .
Clones (identical solutions) are forbidden in to ensure a better dispersal of
solutions. This also allows a higher mutation rate pm by local search, giving a
more aggressive genetic algorithm. To avoid comparing chromosomes in details and
to speed-up clone detection, we impose a stricter condition: the costs of any two
solutions generated by crossover or mutation must be spaced at least by a constant
4 > 0.
A population satisfying the following condition will be said to be well-spaced.
The simplest form with 4 = 1 (solutions with distinct integer costs) was already
used in an efficient Genetic Algorithm. That is,
P1 , P2 : P1 6= P2 |F (P1 ) F (P2 )| 4
where P1 and P2 are the parents we select from the initial population, and F (P1 )
and F (P2 ) are the costs of P1 and P2
The stopping criterion for GA is either after reaching a maximum number of
general iterations, max (number of crossovers that do not yield a clone) or a maximal number of iterations without improving the best solution, max . Let be
the population size, pm be the mutation rate, and space = 5. The GA can be
described as follows:
Step 1: (Initial population)
247
248
Population
size n
Mutation
Rate r
Original
Solution
Final
Solution
Runtime
t(seconds)
Best
Solution
Relative
Error
30
0.1
1380(3)
928
100
520(1)
90
490(1)
6.12%
0.2
1550(2)
990
100
510(1)
91
490(1)
4.08%
0.3
1280(3)
551
100
490(1)
98
490(1)
0%
0.1
1050(2)
1000
87
490(2)
90
490(1)
0%
0.2
990(2)
1000
98
510(1)
90
490(1)
4.08%
0.3
1360(1)
996
100
500(1)
98
490(1)
2.04%
0.1
1270(3)
1000
98
520(2)
90
490(1)
6.12%
0.2
1823(4)
864
100
500(1)
93
490(1)
4.08%
490(1)
0%
50
100
0.3
1900(4) 980 100 490(1)
106
Table 2. Computational results for date set 1
Population
size n
Mutation
Rate r
Original
Solution
Final
Solution
Runtime
t(seconds)
Best
Solution
Relative
Error
30
0.1
1787(4)
506
100
1022(2)
85
962(2)
6.3%
0.2
2629(5)
1000
75
997(2)
88
962(2)
3.6%
0.3
1860(4)
579
100
987(2)
96
962(2)
2.6%
0.1
1640(4)
583
100
987(2)
90
962(2)
2.6%
0.2
1744(4)
573
100
987(2)
89
962(2)
2.6%
0.3
1702(4)
516
100
962(2)
97
962(2)
0%
0.1
1787(4)
506
100
1022(2)
89
962(2)
6.3%
0.2
1441(3)
1000
83
970(2)
93
962(2)
0.83%
0.3
1518(3)
1000
71
962(2)
97
962(2)
0%
50
100
249
Also, as population size and mutation rate increase, the solutions are getting better,
the relative errors are decreasing, and the number of trips is decreasing. Only two
relative errors are greater than 5%.
8. CONCLUSION. We implement a hybrid GA Vehicle Routing Problem to
solve The Vehicle Routing Problem with Time Windows. The final results are
encouraging when the customer size is small. We will have more comparable experiments with large number of customers in the future.
For simplicity, we only consider the earliest arrival time and assume the capacity
of the vehicle is unlimited. We will re-examine the module to handle the capacity
cases in the future. We would also like to implement the current algorithm to handle
a real time window.
Acknowledgements. The authors are grateful to editor and referees for suggestion
to improve the paper.
REFERENCES
[1] O. Br
aysa, W. Dullaert and M. Gendreau, Evolutionary Algorithms for the Vehicle Routing
Problem with Time Windows, J. of Heuristics, 10 (2004), 587611.
[2] O. Br
aysa and M. Gendreau, Vehicle Routing Problem with Time Windows, Part I: Route
Construction and Local Search Algorithms, Transportation Science, 39 (2005), 104118.
[3] O. Br
aysa and M. Gendreau, Vehicle Routing Problem with Time Windows, Part I: Metaheuristics, Transportation Science, 39 (2005), 119139.
[4] G. B. Dantzig and R. H. Ramser, The Truck Dispatching Problem, Management Science, 6
(1959), 8081.
[5] M. Desrochers, J. K. Lenstra, M. W. S. Savelsbergh and F. Soumis, Vehicle Routing with Time
Windows: Optimization and Approxinmation, In B. Golden and A. Assad (eds.) Vehicle
Routing: Methods and Studies, Amsterdam: Elsevier Science Publishers, 1988.
[6] B. L. Golden and A. A. Assad, Perspectives on Vehicle Routing: Exciting New Developments,
Operations Research, 34 (1986), 803809.
[7] B. L. Golden and A. A. Assad, Vehicle Routing: Methods and Studies, Amsterdam: Elsevier
Science Publishers, 1988.
[8] G. Ioannou, M. Kritikos and G. Prastacos, A Greedy Look-Ahead Heuristic for the Vehicle
Routing Problem with Time Windows, J. of Operational Research Society, 52 (2001), 523537.
[9] Christian Prins, A simple and effective evolutionary algorithm for the vehicle routing problem,
Computer and Operations Research, 31 (2004), 19852002.
[10] M. M. Soloman and J. Desrosiers, Time Window Constrained Routing and Scheduling Problems, Transportation Science, 22 (1988), 113.
[11] P. Toth and D. Vigo, The Vehicle Routing Problem, Monographs on Discrete Mathematics
and Applications, SIAM, Philadelphia, 2001.