Você está na página 1de 4

A Particle Swarm Optimization Algorithm with Crossover for Vehicle Routing

Problem with Time Windows

JIANG Wei-gang, ZHANG Yuan-biao* ,XIE Jian-wen

(Mathematical Modeling Innovative Practice Base ,


Zhuhai College of Jinan University ,Zhuhai 519070)
{ jfkdr, abiaoa }@163.com

Abstract algorithm, Tabu search, simulated annealing ,improved


PSO and so on.
A particle swarm optimization (PSO) algorithm with PSO (Particle Swarm Optimization)[4] is a bionic
crossover for vehicle routing problem (VRP) was algorithm which simulates the flight of flocks of birds,
proposed. The PSO with crossover, combined with making good effect for the various multidimensional
genetic algorithm, can avoid being trapped in a local continuous space optimization problems, but less in
optimum by using probability searching. The research and application of discrete field[5]. At present,
experimental results prove that the PSO with crossover there are lots of best-known improved PSO
has a high efficiency and will be an effective method for algorithms, such as APSO algorithm, CPSO algorithm,
discrete combinatory problems. Hybrid PSO algorithm and so on. This paper proposes a
Key words: vehicle routing problem;genetic algorithm; PSO with crossover algorithm based on genetic
particle swarm optimization algorithm with crossover algorithm and PSO algorithm and applied to solve
vehicle routing problem. The results show desirable
effect.
1. Introduction

Vehicle routing problem (VRP) was proposed for 2. Description and mathematical model
the first time by Dantzig and Ramser[1] in 1959. It refers for VRPTW
to a series of delivery points (or receiving), composing
an appropriate travel route, so that vehicles could be VRPTW is generally described as: given a central
through in an order. In meeting certain constraint warehouse, owned K vehicles, the capacity of each
conditions, to achieve certain goals (such as the shortest vehicle is denoted qk(k=1,2,…,K); now, transport tasks
path, minimization cost, minimization time-consuming, of L delivery points should be accomplished, denoted
etc.)[2], this problem belongs to a NP complete problem by 1,2,…,L.The cargo of the i th delivery point is
and have important significance in operations research, gi(i=1,2,…,L).The time needed to complete the tasks
computer, logistics, management, and other subjects.
(loading or unloading) of the i th delivery point is ti.
Vehicle Routing Problem with Time Window
And the task i must be completed in time window [ETi,
(VRPTW), increases the time window which customers
LTi],in which ETi denotes the earliest start time for the
need to visit based on VRP. In real life many problems
task i and LTi denotes the latest start time for the task i.
can be summed up as VRPTW problems to deal with
If vehicles arrive delivery point i earlier than ETi ,
(such as postal delivery, vehicle scheduling, logistics
waiting occurs. If later than LTi, the task i will be
and distribution, etc.), the results will have a direct
delayed. We should get a solution for vehicle running
impact on the quality of enterprise service, so more and
route with transport demands and minimal travel cost.
more people attach importance to its research. The
VRPTW can be divided into two categories: hard
current method of solving VRPTW can be broadly
time widow VRPTW and soft time window VRPTW.
classified into three categories[3]: simple heuristic
Hard time window VRP is that each task must be
method; mixed algorithm of heuristic bound planning
completed within the specific time . However, soft time
and local search; exact optimization algorithm and
window VRP is that if a task can not be completed
intelligent optimization method, such as genetic
___________________
Author introduction: Jiang Weigang(1986-), male, Taizhou, Zhejiang, China, bachelor, major: Mathematical
Modeling.
* Corresponding author: ZHANG Yuan-biao (1979-), male, Zijing, Guangdong, China, doctor, lecture.
Received:
within the specific time, given a punishment. PSO was presented by Kennedy and Eberhart[4] in
In this paper, we use the mathematical model pre- 1995. The algorithm simulates flight behavior of flocks
sented by literature [2] ,giving 0 to the central warehou- of birds. Birds aim to achieve optimization results
se and giving 1,2,…,L to delivery points. Both tasks through a collective collaboration between the groups.
and central warehouse are denoted by node i (i=0, 1,…, In the PSO system, each candidate solution is called a
L). Variables are defined as follows: "particle". A number of particles coexist and cooperate
to find optimization. Each particle “flies” to a better
position in problem space in accordance with its own
ì1 the task of delivery point i is "experience" and the best "experience" of the adjacent
ï
yki = í completed by vehicle k particle swarm, searching the optimal solution.
ï0 otherwise Mathematical notation of PSO algorithm is defined
î as follow:
ì1 vehicle k travels from point i Assume searching space is D-dimensional and the
ï total number of particles is n. The ith particle location
xijk = í to point j is denoted by the vector: Xi=(xi1, xi2,…, xiD); The past
ï0 otherwise
î optimal location of the ith particle in the "flight" history
(that is, the location corresponds optimal solution) is
cij is the cost of transportation from the point i to the
point j, it could be the meanings of distance, cost, time Pi=(pi1, pi2,…, piD). The past optimal location Pg of the
and so on. si is the time when vehicles arrive in the task gth particle is optimal in all of Pi(i=1,2,…,n); The
i. PE is the unit time cost which vehicle arrive task i location changing rate (speed) of the ith particle is
waiting before ETi. PL is the unit cost of fines which denoted by the vector Vi=(vi1, vi2,…, viD).The location
vehicle arrive task i delaying after LTi. If vehicles arrive of each particle changes by the following formula:
point i before ETi , opportunity cost PE (si-ETi) will be vid (t + 1) = w ´ vid (t ) + c1 ´ rand () ´
increased, if after LTi, punishment cost PL(LTi- si) will
be increased. [ pid (t ) - xid (t )] + c2 ´ rand () ´
Mathematical model of vehicle optimizing sched- [ p gd (t ) - xid (t )] (7)
uling is as follows:
L xid (t + 1) = xid (t ) + vid (t + 1)
min z = åååc x ij ijk
+ pE å max (ET - s , 0)
i i
1£ i £ n ; 1£ d £ D (8)
i j k i =1

L c1, c2 are positive constants called accelerating factor;


+ pL å max (s - ET , 0)i i
(1) rand() is a random number between 0 and 1; w is called
i =1 inertia factor; w, setted a litter bigger ,is suited to a
ìs.t. å gi yki £ qk "k (2) wide range of exploration to solution space while
smaller is suited to a small range. [Xmin, Xmax] is the
ï i
changing range of particle location. [vmin, vmax] is the
ï å yki = 1 i = 1, 2,L ,L (3) changing range of speed. If the location and speed
ï k
ï exceed boundary range in iteration, given boundary
í å xijk = ykj j = 0,1,L ,L; "k (4) value. Based on analysis of the above parameters,
ï i Maurice Clerc provides the parameter conditioning of
ï å xijk = yki i = 0,1,L ,L; "k (5) PSO agorithem convergence[6].
ï j

ï x , y = 0or1 i, j = 0,1,L ,L; "k 4. A particle swarm optimization algorithm


î ijk ki
(6)
with crossover to solve VRPTW
This model is widely used. It can be converted into a
mathematical model of different issues by different
setting of the parameters .When formula (1) PE=PL→ In the basic PSO algorithm, the speed of particles v
is restricted by a maximum speed vmax. It decides
∞, the above model is the hard time window VRP .If
searching precision in the solution space. If vmax is too
formula (1) ETi=0, LTi→∞, VRPTW model become a big, particles may miss the optimal solution; otherwise,
common VRP .If only one car being used, the problem the particles may get into a local search space and can
will become TSP problem. If removing constraint (2),it not carry through a globe search[7]. Therefore, in this
becomes TSPTW problem. paper, using the idea of crossover operation of genetic
algorithm and the characteristic of PSO algorithm, we
3. Basic particle swarm algorithm present a PSO algorithm with crossover to solve
VRPTW, with a view of improving results.
4.1. Particle coding
In this paper, we use the PSO with crossover
This paper makes reference to the encoding manner algorithm to solve VRPTW as follows:
of literature[8]. For the VRPTW problem with L Set iteration times for MaxN, randomly generated
customer points and K vehicles, each particle has initial particles N;
L+K+1 dimensional vector, in which the order of each Calculate the fitness of initial particle to be l0.
element value denotes the delivery order of the According the initial fitness of each particle, initialize
customer point in the total path. plbesti, pxbesti, glbest and gxbest.
For example: Assume the number of customers is 8 WHILE (iteration times< MaxN) DO
and the number of vehicles is 3. If the location vector of FOR i=1: MaxN
the particle is: The i th particle Xi crosses with gxbest to be
Warehouse No: 1 2 3 4 5 6 7 8 0 0 Xi’, Xi’ crosses with pxbesti to be Xi’’,ordering
X=[6 8 4 1 2 9 5 10 3 7] Xi=Xi’’;Calculate fitness li according to current
Then the total path of corresponding solution of the location;
particle is: 0→4→5→0→3→7→1→0→2→6→8→0, IF (li< plbesti)
corresponding separate path is: pxbesti=Xi, plbesti=li;
Vehicle 1: 0→4→5→0; ENDIF
Vehicle 2: 0→3→7→1→0; ENDFOR
Update plbesti, pxbesti, glbest, gxbest.
Vehicle 3: 0→2→6→8→0
ENDWHILE
Finally, export glbest and gxbest.
4.2. Crossover operation
5. Calculation example
This paper presents a crossover manner, which is
improved on the CX manner[9], in order to retain the In this paper, we use the example in literature[2].
good gene fragments of parents. Suppose two parent There are eight cargo transportation tasks(No.
individuals are f1 and f2, through crossover operation to 1,2,…,8).The cargo qiof each task, loading or unloading
be the offspring individuals new1 and new2. Specific time ti ,executing time range [ETi, LTi] are showed in
operation such as: following table 1 ,distance dij from yard0 to each task
1) randomly select one cross region (a, b) in the point in following table 2.These tasks are completed by
second string eight tons of vehicles, in which the speed is 50,unit
2) Put the number in the cross region of f2 to transportation cost is 1,over time window unit cost for
the front of f1, delete the number of the cross punishment is: PE=PL=50.
region of f2 in f1, get a sub-string new1. Put Table 1. Characters and demand of task
the number in the cross region of f1 to the Task point 1 2 3 4 5 6 7 8
front of f1, delete the number of the cross qi 2 1.5 4.5 3 1.5 4 2.5 3
region of f1 in f2, get a sub-string new2.
3) Judge whether the sub-string is a feasible ti 1 2 1 3 2 2.5 3 0.8
solution, if not, then redo step 2), otherwise [ ETi , LTi ] [1,4] [4,6] [1,2] [4,7] [3,5.5] [2,5] [5,8] [1.5,4]
go to step 4).
4) Calculate the fitness by formula(1), retain the Table 2. Distance from point to point
offspring of the lower fitness recorded as
new. d ij 0 1 2 3 4 5 6 7 8
For example two parent strings are: 0 0 40 60 75 90 200 100 160 80
f1=1 2 3 4 5 6 7 8 9, 1 40 0 65 40 100 50 75 110 100
f2=9 8 7 6 5 4 3 2 1 2 60 65 0 75 100 100 75 75 75
Cross region is: (3, 6), after crossing 3 75 40 75 0 100 50 90 90 150
new1=7 6 5 4 1 2 3 8 9, 4 90 100 100 100 0 100 75 75 100
new2=3 4 5 6 9 8 7 2 1 5 200 50 100 50 100 0 70 90 75
Calculate the fitness for new1 and new2 by 6 100 75 75 90 75 70 0 70 100
formula (1) and order the string of the lower 7 160 110 75 90 75 90 70 0 100
fitness to be new. Thereout, crossover operation 8 80 100 75 150 100 75 100 100 0
of two parent strings is completed, getting The best known result is: vehicle 1: 0→3→1→2
offspring new. →0; vehicle 2: 0→8→5→7→0; vehicle 3: 0→6→4→0.
The total travel cost is Z=910.
4.3. Algorithm implementation
In this paper, we use PSO with crossover algorithm, [3] Hoong C L, Melvyn S, Kwong M T. Vehicle routing
setting parameters as follows: the number of particles problem with time windows and a limited number of
N=40, the iteration time MaxN=200. vehicles[J].European Journal of Operational Re-search, 2003,
Solving this problem uses GA in literature[2] 148:559-569.
(N=40, MaxN=200,Pc=0.6, Pe=0.2 roulette manner [4] R C Eberhart, J Kennedy.A New Optimizer Using
choosing offspring); uses PSO in literature[10] Particles Swarm Theory[C]. In:Proc Sixth International
Symposium on Micro Machine and Human Science, Nagoya,
(N=40,divided into two subgroups, subgroup size=22, Japan, 1995.
overlapping particle swarm between sub-groups is 2,
w=0.729, c1=c2=1.49445, MaxN=200); uses parallel [5] DING Hai-Li,WANG Fang,GAO Cheng-xiu. Crossover
PSO in literature[8] (divided into two subgroups, particle swarm optimization for traveling salesman
subgroup size is N1=N2=20, w=0.729, c1=c2=1.49445, problem[J]. Journal of Mathematics, 2008(8):85-89.
MaxN=200). [6] Maurice Clerc, James Kennedy. The particle
These above three methods and PSO with swarm-explosion, stability, and convergence in a
crossover algorithm use Matlab7.0 to program multidimensional complex space[J]. IEEE Transaction on
Evolutionary Computation, 2002, 6(1):58-73.
respectively, each with the operator of 50 times.
Compared results are shown in Table 3 below: [7] ZHANG Li-yan,PANG Xiao-hong,XIA Wei-jun,et al.A
Table 3. Compared results in four hybrid particle swarm optimization algorithm for vehicle
algorithms for solving 50 times routing problem with time windows [J]. Journal of Shanghai
Jiaotong University,2006(11):1890-1895.
Searching Average
Average [8]WU Yong,YE Chun-ming,MA Hui-min,et al. Parallel
successful searching
travel cost particle swarm optimization algorithm for vehicle routing
rate/% time/s
GA [2]
993.6 24 11 problems whti time windows[J].Computer Engineering and
PSO[10] 940.5 46 6 Applications,2007, 43(14):223-226.
Parallel [9] ZHANG Li-ping, CHAI Yue-ting, CAO Rui. Improved
923.8 72 4
PSO[8] genetic algorithm for vehicle routing problem with time
Cross-PSO 914 92 4 windows [J]. Computer Integrated Manufacturing Systems,
2002, 8(6):451-454.
Experimental results show that the searching [10]LI Ning , ZOU Tong , SUN De-bao. Paticle swarm
successful rate 92% of the proposed PSO with optimization for vehicle routing problem with time windows
crossover in solving VRPTW problem, is far greater [J]. Systems Engineering-Theory & Practices, 2004(4):
than the basic PSO 46%, the basic GA 24% and 72% of 130-135.
parallel PSO. At the same time in the aspect of the
average result and evaluating successful searching time,
the proposed method compared with other three
methods is optimal.

6. Conclusion

This paper presents a PSO with crossover


algorithm, which combines the PSO algorithm with
genetic algorithm to improve the performance and
efficiency of algorithm. Through an example about
window time VRP validated, the algorithm which has
the characters of less number of parameters, simple
implementation, and relatively shorter time of average
search, is proved an effective algorithm to solve
discrete optimization problem.

7. References

[1] Dantzig G, Ramser J. The truck dispatching problem[J].


Management Science, 1959(6):80-91.
[2]LI Jun,GUO Yao-huang. Dispatch optimize theory and
methods for logistic distribution vehicle[M].Beijing:Chinese
Commodity Publish House, 2001.

Você também pode gostar