You are on page 1of 5

# Systems Engineering Theory & Practice

## Volume 29, Issue 5, May 2009

Online English edition of the Chinese language journal

## Optimizing Research of an Improved Simulated Annealing

Algorithm to Soft Time Windows Vehicle Routing Problem with
Pick-up and Delivery
DENG Ai-min, MAO Chao , ZHOU Yan-ting
School of Business Administration/Institute of Transportation and Logistics, Hunan University, Changsha 410082, China

Abstract: In this article, we present a more practical mathematical model of vehicle routing problem with pick-up and delivery, which
considers the soft time request, vehicle fixed cost, vehicle full-load coefficient. The simulated annealing algorithm was improved to
solve the model, the exchange in the lines and between the lines were both used to produces the new solution, through increasing the
memory function, using the double termination criterion. We test the new algorithm through a certain scale example, the experimental
results show that the new algorithm can obtain better solution, better stability, and high calculation efficiency.
Key words: vehicle routing problem; pick-up and delivery; soft time windows; simulated annealing

## 1 Introduction specific period of time, to punish violations of in accordance

with the length of time, such problems are called soft time
Most of the studies on vehicle routing problem (VRP) window problem[5] .
are based on the hypothesis that the customer only has pure
delivery, or pure pick-up, even allowing pickups distribution, 2 Problem description and model foundation
and it is also assumed that all distribution operations hav-
ing been finished returns to complete the pickups services[1] . 2.1 Problem description
Considering a customers demand point, the existence of The basic definition of the VRPPD problem is as fol-
pickup or delivery services or existence of both pickup and lows: Assuming that there is a logistic center, with K ve-
delivery services, allows the customer to do cargo operations hicles totally and there are I customers, coordinates of each
and delivery operations at the same time, that is, the distri- customer and their required volume of pick-up and delivery
bution vehicles are required only once the customer service are known, distance of the trucks from the customer to the
meets customer demand, and we call it vehicle routing prob- adjacent transport is Dij . VRPPD problem is under the con-
lem with pick-up and delivery (VRPPD)[2] . VRPPD can be dition of not violating traffic volume capacity constraints,
traced back to the 1980s, when the concept of reverse logis- use of trucks starting from the logistics center, according to
tics was put forward, as everyones concern of reverse logis- the advanced post-out (FILO) principle[6] on the need for
tics, the recovery services of forward logistics, and reverse stacking goods distribution, and then back to center after ser-
logistics distribution blended together, forming a VRPPD vice for all of the customers, while meeting the customers
problem. Reference [3] pointed out that the VRPPD prob- set of rationing demand, and each customer can be serviced
lem can be divided into four categories, the problem studied only once by one, request to keep the total distribution costs
with pick-up and delivery (VRPPDTW).
2.2 Model assumption
There are many such examples in real life, such as
books and newspaper distribution, generally speaking, a In order to establish mathematical model to describe
bookstores return rate can reach 30% to 40%, which re- VRPPD, the article made the following assumptions:
quires consider recycling of the books and newspapers that (1) Only one logistic center;
did not sell out when there is a delivery for multiple book- (2) Coordinates and required volume of the logistic cen-
stores at the same time. In addition, issues of beer distribu- ter and demand points are already known;
tion and empty beer bottles recycling, pick-up and delivery (3) The delivery vehicle types are uniform, it means the
problems of logistics center, are belong to this category[4] . vehicle capacities are all the same;
In our life, customers usually require one to meet their (4) Consider the constraints of delivery by the soft time
needs within a certain period of time, if the distribution of window, that is, customers have time window requirements
goods vehicles can not be delivered to the demand point in a for the goods demanded;
Corresponding author: Tel: +86-731-8882-3895; E-mail: yufei-279@163.com
Foundation item: Supported by the Hunan Provincial Nature Science Foundation (No.02JJY3015); Chongqing Key Social Science Foundation
(No.2004ZD03)
DENG Ai-min, et al./Systems Engineering Theory & Practice, 2009, 29(5): 186192

K
N
K
N

## station and eventually back to the station; xijk xijk = 0 i, j = 1, 2, , N (3)

k=1 i=1 k=1 j=1
(6) The weight in a moving vehicle not exceeding vehi-
cle capacity volume restrictions;

N
(7) The distribution distance of each vehicle is not more 0 Uik xijk (dj pj ) Q
than the maximum travel distance; i=1
(8) Each demand point can and can only be serviced
once, as a service can meet the needs of pick-up and deliv- i = 1, 2, , I; k = 1, 2, , K (4)
ery requirements;
(9) Other hypothesis: Supposing the goods in transit
I
N
0 dj { xijk } Q
will not be degenerated damaged, do not take the working j=1 i=1
hours of the drivers into account, do not take the prevailing
road conditions into account, regardless of rules and regula- k = 1, 2, , K; 0 1 (5)
tions of transportation, and so on.
2.3 Symbol description
N N

## Q: Capacity of vehicles, that is, maximum loadage of 0 dj { xijk } Q k = 1, 2, , K (6)

distribution vehicles; j=1 i=1

## I: Total number of customers demand point;

nk
N : the set of all the demand point andlogistic center, Dnk(i1) nki (nk ) Dmax
node 0 stands for the logistic center, N = I {0}; i=1

## K: Total number of vehicles in distribution center;

Dij 0 nk I; i = 1, 2, , nk (7)
: Distance between customer i and customer j,
Dij = (xi xj )2 + (yi yj )2 ;
nk : The number of customers vehicle k serviced; xijk = 1 Ti + ti + t(pi + di ) + tij = Tj
nkj : The j-th customer vehicle k serviced, 0 nkj
nk , for example, n32 means the second customer vehicle 3 i, j = 1, 2, , N ; i = j (8)
serviced;
c: Fixed costs of vehicle in traveling;
ti = max(Ei Ti , 0) i, j = 1, 2, , N (9)
1 : Average cost per kilometer of distribution;
2 : Loss of the opportunity costs per minute when ve-
Equation (1) is the objective function, which irrespec-
hicle arrived early to wait;
tive the total distribution cost, is minimal. The total dis-
3 : The delay penalty cost per minute when vehicle ar-
tribution costs is not only related to distribution distance,
rived late;
but is also related to the number of vehicles involved in
Ti : Total number of customers demand point;
distribution and the distribution time. Each vehicle has a
ti : Service time of vehicle k at customer i;
fixed cost. The soft time windows constraints can be de-
tij : Travel time from the customer i to customer j;
scribed as that if vehicles arrive at the customer i before
t: Time required for unit cargo handling;
Ei the opportunity cost will generate due to waiting. As-
[Ei , Li ]: The time window of customer i, Ei is the
suming the unitloss of opportunity cost is 2 , the cost of
lower boundary of the time window, Li is the upper bound- I
this part is 2 i=1 max(Ei Ti , 0); If the arrival time is
ary of the time { window;
late, the customers demand will be delayed to meet, and
1, nk 1
(nk ) = ; this will caused the delayed penalty fees. Assuming the
0, otherwise
{ I penalty cost is 3 , then the the cost of this part
unit delay
1, vehicle k through node i to customer j is 3 i=1 max(Ti Li , 0). The constraint (2) is that every
xijk = .
0, otherwise customer is visited by exactly one vehicle, and the vehicle
2.4 Model foundation is used to serve at the most one route. The constraint (3) is
Reference to the model of reference [7], this article pro- flow conservation formula, where every vehicle that arrives
posed the math model as follows: to a customer must leave that customer. Vehicles load can
not exceed the capacity at any customer point is stated in

K
N
N
K
N
N constraint (4). The constraint (5) is used to limit the maxi-
min 1 Dij xijk + c xijk mum amount of the initial loading, that is, the largest volume
k=1 i=1 j=1 k=1 i=1 j=1 of each truck at the starting time. Assuming = 0.9, which

I
I means that the cargo capacity of the vehicle starting from
+2 max(Ei Ti , 0) + 3 max(Ti Li , 0) (1) the logistics center cant be more than 0.9Q, taking the re-
i=1 i=1 maining 0.1Q as the initial pick-up space. The constraint
(6) explained that the pick-up volume of every vehicle must
subject to not exceed the capacity. The constraint (7) ensures that the
length of each delivery path does not exceed the maximum

K
N
xijk = 1 j = 1, 2, , N (2) travelled distance of the vehicle[8] . The constraints (8) and
k=1 i=1
(9) ensure to meet the customers time window constraints.
DENG Ai-min, et al./Systems Engineering Theory & Practice, 2009, 29(5): 186192

3 Simulated annealing heuristic for the VRPPD equation (1) and get the evaluate formula:

## 3.1 SA procedure E =kc+D+ (10)

As VRPPD is an NP-hard problem, accurate algorithm
is almost impossible for larger-scale problems[9] . So this ar- k is the number of vehicles used, c is the fixed cost of each
ticle uses heuristic algorithm to solve the problem. The ba- vehicle, is the average cost per kilometer of distribution,
sic principle of simulated annealing algorithm comes from D is the total distance of the distribution program, and is
the fact that solid will collapse from the solid structure the penalty cost generated by the time window.
into liquid structure if heated it to a certain temperature, 2) Neighborhood. The traditional neighborhood opera-
and through controlling its cooling process can make the tion method of simulated annealing algorithm is 2 opt ex-
molecules re-ranked as our expected steady state when they change. This exchange method is simple and exchange two
revert to the solid structure. Simulated annealing algorithm nodes one time, but the ability to search solution space is not
has been theoretically proven to be a probability of 1 con- strong. Therefore, in each temperature, it takes a long time
verges to the global optimal solution of the global optimiza- to search the solution space to ensure getting an optimal so-
tion algorithm[10] . The VRPPD problem studied in this arti- lution of the temperature. When the temperature slowly de-
cle can be described by simulated annealing algorithm as a creases, the number of outer loop increases, the algorithms
solution of the problem and its objective function are sepa- time increases multiply, leading the search time of the algo-
rately equivalent with a micro state i and its energy E(i). rithm as too long.
Steps of simulated annealing algorithm (take minimiz-
stages:
ing the objective function for example)[1,10] :
Step 1 Switching in-circuit, implement neighborhood
Step 1 Get an initial feasible solution x0 randomly, set
operations randomly using 2 opt and 3 opt method to
t0 as the initial temperature, the current solution xi = x0 ,
produce a new feasible solution.
the current iteration step k = 0 , the current temperature
Step 2 Implement switching between the feasible so-
tk = t0 ;
lution circuit, circuit switching between the introduction of
Step 2 If the temperature satisfies the loop stop con- Osman of the exchange of ideas (take that time only in ex-
dition, go to Step 3; otherwise, choose a neighborhood so- change for a node), and require each temperature of the num-
lution xj randomly from the neighborhood, and calculate ber of neighborhood operations (exchange the number of
Eji = E(xj ) E(xi ). If Eji 0, then xi = xj ; times), so as to ensure a certain period of time, able to obtain
otherwise, if exp(Eji /t > rand(0, 1)) (a random number higher quality solution.
between 0 and 1), go to Step 2; This approach has the same number of iterations, al-
Step 3 k = k + 1, tk+1 = y(tk ) (temperature control though the obtained number of solutions has not changed,
function), If it meets the termination conditions, go to Step but the search solution space increases the scope of many,
4; Otherwise, go to Step 2; together with a memory array , which can assure of a more
Step 4 Output the results, terminate the SA algorithm. satisfactory optimal solution, so you can to a large extent,
Step two is the inside circle, which indicated a random reduce the length of Markov chain, thereby saving time al-
search at the same temperature. Outer loop includes the tem- gorithm.
perature decreased changes, the increase of iterations times, 3) Memory device design. In the traditional simulated
and the stopping criteria in Step 3. annealing algorithm, the output can not guarantee to be the
best solution. So we set a memory array S in the algorithm,
3.2 Algorithm optimizing
which records the best solution as the algorithm progresses.
Considered characteristics of vehicle routing problem At the beginning of the algorithm, S is initialized to be the
with pick-up and delivery, this article optimized the conven- initial solution, that is, S = , E(S) = E(). When next
tional simulated annealing algorithm, and constructed a new optimal solution was found, compare the objective func-
simulated annealing algorithm for solving this problem. The tional value of E() with E(S), if E() E(S), then
1) Representation and evaluation of the solution. The solution of this search.
solution represents distribution program in the real life, a dis- 4) The determination of the termination criteria. Adopt
tribution program may contains multiple distribution paths. mixed-stopping criterion, that is, when the temperature is be-
0 is on behalf of the logistics center, a loop starts with 0 and low a certain value, or the memory array of consecutive does
ends with 0, in the middle of which are the customer nodes. not change for g times, the algorithm is terminated. With the
A feasible solution must contain all the customer points. If initial temperature t0 , temperature coefficient , it is easy
a solution is 0123045607890, it means that the delivery pro- to control the number of iterative steps, and easy to get the
gram covers the three distribution paths, that is, 0-1-2-3-0, global optimal solution. g is used to eliminate unnecessary
0-4-5-6-0, 0-7-8-9-0. iteration in order to reduce the number of iterative steps and
To determine the merits of a solution, at first, we need improve the algorithm efficiency. The value of g varies ac-
to get the program of the distribution path corresponding to cording to the size of the node, the larger the scale, the rel-
the solution, and determine the program of the distribution atively larger is the value. In our example, the node size is
path. This article directly uses the objective functional value 20 , after many experiments, we find that taking g = 20, can
to evaluate the pros and cons of the solutions. Simplify the guarantee that the value obtained is the suboptimal solution.
DENG Ai-min, et al./Systems Engineering Theory & Practice, 2009, 29(5): 186192

## Table 1. Required information of customers

Customer node 1 2 3 4 5 6 7 8 9 10
Horizontal ordinate x/km 3.8 15.2 18.6 11.9 10.2 5.3 0.6 6.1 7.6 16.0
Vertical ordinates y/km 5.5 10.9 12.9 8.2 9.5 9.6 9.9 15.0 19.2 15.7
Delivery volume d/t 0.8 0.6 0.4 1.6 0.8 0.6 1.9 1.3 1.8 1.8
Pick-up volume p/t 0.5 1.6 0.7 0.3 0.6 1.4 1.7 1.0 0.9 1.9
Lower boundary of the time window 6.0 2.4 0.1 0.6 1.7 0.3 5.9 1.7 0.6 6.1
Upper boundary of the time window 14.6 13.8 12.3 14.1 13.8 10.4 12.6 8.5 10.3 13.9
Customer node 11 12 13 14 15 16 17 18 19 20
Horizontal ordinate x/km 3.8 15.2 18.6 11.9 10.2 5.3 0.6 6.1 7.6 16.0
Vertical ordinates y/km 5.5 10.9 12.9 8.2 9.5 9.6 9.9 15.0 19.2 15.7
Delivery volume d/t 0.8 0.6 0.4 1.6 0.8 0.6 1.9 1.3 1.8 1.8
Pick-up volume p/t 0.5 1.6 0.7 0.3 0.6 1.4 1.7 1.0 0.9 1.9
Lower boundary of the time window 6.0 2.4 0.1 0.6 1.7 0.3 5.9 1.7 0.6 6.1
Upper boundary of the time window 14.6 13.8 12.3 14.1 13.8 10.4 12.6 8.5 10.3 13.9

## Computation sequence 1 2 3 4 5 6 7 8 9 10 Average

Total distribution cost /yuan 200.1 202.3 207.2 203.7 197.9 206.1 199.8 200.5 209.7 206.6 203.4
Distribution distance /km 119.1 118.6 122.0 118.9 112.9 125.2 118.8 116.0 128.7 125.5 120.6
Accumulated time for waiting /h 0.31 1.24 1.74 1.60 1.27 0.31 0.31 1.52 0.34 0.33 0.90
Accumulated time for late /h 0.00 0.00 0.00 0.00 0.19 0.00 0.00 0.00 0.00 0.14 0.03
Vehicle numbers 4 4 4 4 4 4 4 4 4 4 4
Computation time /s 14.00 12.58 12.38 14.14 14.36 15.02 14.33 17.11 17.58 13.25 14.47

4 Computational experiments As can be seen from Table 2: high quality solution have
been got for 10 times solution, the average value of the total
Based on the data of the example in reference [5], as-
distribution cost is 203.4 yuan, average number of vehicles
sume that a single logistics center (3.2 km, 14.1 km) and 20
is 4, among them. The highest quality of solutions got in the
customers are located in a square area with side length of
fifth solution, with the total distribution cost of 197.9 yuan,
20 km, each customers demand and supply of goods vol-
delivery distance of 112.9 km, the accumulated waiting time
ume are less than 2 tons (inclusive), there are 10 vehicles in
of the vehicle arriving the points earlier than the time win-
the logistics center, and the vehicle capacity is 8 tons, the
dow is 0.19 h, the accumulated time to reach the customers
maximum distance allowed for any vehicle is 50 km, aver-
point later was 1.27 h, the optimal solution corresponding 4
age speed of the vehicle t = 20 km/hour. Reference [5]
distribution path as shown in Table 3. As the literature [5]
set the punishment weight on the delivery distance, the wait
didnt consider the travel cost of vehicles, and the penalties
loss for the vehicle that arrived early, and late loss as fol-
for time windows have not been quantified to the cost, so it
lows: 0.1:0.3:0.6. Here, the author made assumptions as this
can not be directly compared. Considering that the distance
proportion: 1 = 1 yuan/km, 2 = 3 yuan/hour, 3 = 6
distribution plays a dominant role in distribution costs, the
yuan/hour, the fixed cost of each vehicle c = 20 yuan, the
authors record the distribution distance separately, and illus-
trate the feasibility and superiority of the algorithm. through
ton/hour. Location coordinates, each customers demand and
comparison of the distance.
supply of goods, and the time windows of the 20 customers
are in Table 1. Request to reasonably arrange the delivery The average distance calculated in this article has im-
routes to make the total mileage the shortest, pursuant to the proved as much as 34.4% compared with the 183.8 km in
above conditions. reference [5] , the optimal solution improved by 33.1%, with
the use of one less vehicle; the calculation results of the algo-
Table 3. Approximate optimal solution rithm are very stable, the standard deviation for the 10 times
route table of the test example solution is 2.42km, stability has also been improved. From
Results Data the computational efficiency perspective, the average com-
Route 1 0-6-20-1-7-0 putation time of the 10 times solving is about 14.47s, the cal-
Route 2 0-14-8-12-0 culation is more efficient. From the total waiting time point
Route 3 0-9-18-11-10-3-2-4-0 of view, the average total waiting time is 0.9 h, but it will
Route 4 0-13-19-17-16-5-15-0 help improve customers service levels. We can also change
Total distribution cost /yuan 197.9 the corresponding weights to reduce the waiting time. Since
Distribution distance /km 112.9 the late penalty value is high, the total late time is very short,
Accumulated time for waiting /h 1.27 almost negligible, the comparison can be seen in Table 4.
Accumulated time for late /h 0.19
Vehicle numbers 4
a good feasibility and obvious superiority.
DENG Ai-min, et al./Systems Engineering Theory & Practice, 2009, 29(5): 186192

## Table 4. Distribution distance comparison with reference [5]

Total distribution distance Vehicle numbers Total delayed time Standard deviation
Results of reference[5] 183.8 5.2 0.311 11.85
Improvement rate 34.4% 23.1% -200% 59.7%

5 Conclusions References
the distribution costs. We have do several things to achieve [1] Paolo T, Daniele V. The Vehicle Routing Problem. Society
for Industrial and Applied Mathematics, Philadelphia, 2002.
that, such as:
[2] Lang M X. Study on simulated annealing algorithm for vehi-
(1) We have proposed a more realistic vehicle routing cle routing problem with backhauls. Journal of Systems En-
problem with pick-up and delivery (VRPPD) model, consid- gineering, 2005, 20(5): 485491.
ering factors of the soft time windows, vehicle travel costs, [3] Hu D W, Chen C, Guo X F. Research on optimal algorithm
vehicles loaded coefficient, and so on. for multi-depot vehicle routing problem with pickups and de-
(2) Introducing simulated annealing algorithm to solve liveries. Mathematics in Practice and Theory, 2007, 37(2):
the model, based on the analysis of the advantages and dis- 98104.
advantages of the algorithm, we improve the algorithm on [4] Deng A M, Wang S M, Wang L J. City logistics distribu-
three aspects: First, neighborhood operation strategy has tion system optimization research. Journal of Wuhan Univer-
been improved, making the algorithm search for a larger so- sity of Technology (Transportation Science & Engineering),
lution space within a certain period of time , to speed up 2006, 30(3): 481484.
[5] Lang M X. Study on model simulated annealing algorithm
the search speed of the algorithm; Second, a memory device
for vehicle routing problem. Ph.D. dissertation, Beijing Jiao-
is included in the algorithm in order to ensure that the out- tong University, 2002: 128135.
put result is the optimal solution for this search at the end [6] Carrabs F, Cordeau J F, Laporte G. Variable neighbourhood
of algorithm; Third, termination criteria of the algorithm has search for the pickup and deliverytraveling salesman problem
been improved, creating a new mixed-termination rule, when with LIFO loading. Informs Journal on Computing, 2007,
the cost of memory devices record does not change contin- 19(4): 618632.
uously many times, the value of the time is the optimal so- [7] Zhao Q H, Wang S Y, Li J Q. Optimization Method and Ap-
lution, therefore, we use mixed-stopping criterion, that is, plication Analysis in Logistics Management. Science Press,
when the temperature is below a certain value, or a mem- 2006.
ory array is continuous, no change g times, the algorithm is [8] Chen J F, Wu T H. Vehicle routing problem with simulta-
terminate. neous deliveries and pickups. Journal of the Operational Re-
search Society, 2005, 57(14): 579587.
(3) Selecting the examples from literature to conduct
[9] Dell Amico M, Righini G, Salani M. A branch-and-price
comparative experiments, the results show that the algorithm approach to the vehicle routing problem with simultaneous