• 沒有找到結果。

Dynamic vehicle routing using hybrid genetic algorithms

N/A
N/A
Protected

Academic year: 2021

Share "Dynamic vehicle routing using hybrid genetic algorithms"

Copied!
6
0
0

加載中.... (立即查看全文)

全文

(1)

Proceedings of the 1999 EEE International Conference on Robotics & Automation

Detroit, Michigan May 1999

Dynamic Vehicle Routing Using Hybrid Genetic Algorithms

Wan-rong Jih

jih@robot .csie.ntu.edu.tw

Jane Yung-jen Hsu

yjhsu@csie.ntu.edu. tw

Department of Computer Science and Information Engineering

National Taiwan University

Taipei, Taiwan

Abstract

This paper presents a novel approach to solving the single-vehicle pickup and delivery problem with time windows and capacity constraints (or single-vehicle P D P T W ) . While dynamic programming has been used to find the optimal routing to a given problem, it re- quires time exponential in the number of tasks. There- fore, at often fails to find the solutions under real-time conditions in an automated factory. This research explores anytime problem solving using genetic algo- rithms. By utilizing optimal but possibly partial solu- tions f r o m dynamic programming, the hybrid genetic algorithms can produce near-optimal solutions for problems of sizes up to 25 percent bigger than what can be solved previously. This paper reports the exper- imental results of the proposed hybrid approach with f o u r different crossover operators as well as three mu- tation operators. The experiments demonstrated the advantages of the hybrid approach with respect to dy- namic task requests.

1

Introduction

To this day, only relatively small VRP instances can be solved to optimality.

In this paper, we consider the single-vehicle pickup and delivery problem with time windows and capac- ity constraints (single-vehicle PDPTW), which will be formally defined in section 2. Most exact algorithms capable of finding optimal solutions to this problem are based on dynamic programming. For a single- vehicle PDPTW with n tasks, the computational com- plexity of dynamic programming has been shown to be bounded by (an

+

1)23"[5]. Therefore, existing algo- rithms cannot satisfy real-time requests.

In order to handle dynamic task requests efficiently, it is desirable to have heuristic algorithms that can generate (sub-optimal) solutions to large problems on

demand. The solutions should be improved incremen- tally whenever more time becomes available. Genetic algorithms (GAS) can generate incrementally better solutions at each succeeding generation regardless of the problem size. Therefore, they provide a reasonable solution to the dynamic single-vehicle PDPTW prob- lem. Unfortunately, the solutions from simple GAS are often of poor quality.

This research explores hybridizing genetic algo- rithms with dynamic programming in order to take advantage of the complementary properties of both in solving the dynamic single-vehicle PDPTW prob- lem. The proposed hybrid approach starts by using dynamic programming to generate the optimal routes. If optimal solutions are not found within the specified time slot, the partially constructed routes are passed to the genetic algorithms. The sub-routes provide the basis for generating an initial population that of- ten leads to better convergence than a randomly gen- erated initial population. The hybrid approach en- ables dynamic programming to achieve real-time per- formance, and improves genetic algorithms in approx- imating near-optimal solutions.

The next section introduces the single-vehicle PDPTW, and section 3 presents the hybrid approach. The experimental results and analysis are shown in section 4, followed by the conclusion in section 5.

2

The Single-vehicle PDPTW

We should know the static single-vehicle PDPTW before we focus our attention on the dynamic single- vehicle PDPTW. The section 2.1 will describe the static case of single-vehicle PDPTW. The dynamic case will be presented in section 2.2.

2.1 Static case

Suppose that N = { 1,.

. .

,

n } is a set of tasks, where

n is the number of tasks. To accomplish each task

(2)

i E N, the vehicle should pick up the goods at the pickup location if and then transport the goods to the delivery location i-. According to these pickup and delivery locations, V + = {i+

I

i E N} and

V - = {i-

I

i E N} indicate the set of pickup lo- cations and the set of delivery locations respectively. Let G = (V, A) be a graph where V = (0) U V + U V-

is a set of vertices and A = { (r, s)

I

r

#

s, r, s E V}

is a set of arcs. Vertex 0 represents an initial depot of the vehicle. Each arc ( r , s ) E A is associated with a non-negative travel time d,,, and each task i E N is associated with a non-negative demand qi. The

total demand of a vehicle route may not exceed the vehicle capacity Q. Specifically, for every task i are required for picking up the goods within the time in- terval [ai+, bi+], and transporting the goods to its de-

livery location i- on the time interval [ u i - , b*--]. In addition, let t , and 1, represent the arrival time and the load of a vehicle respectively, when the vehicle ar- rives at a location r E V.

Our goal is to find a vehicle route starting from an initial depot, finishing all the requests of tasks, and ending at one of the delivery locations. According t o the route, both the total traveling time and waiting time of the vehicle are minimized. Certainly, this route must be a feasible route that is satisfied the capacity

and the time windows constraints of each task. In addition, the feasible routes visit the pickup location

i+ before the delivery location i- of task i E N .

Initially, we assume that the vehicle is stopped at an initial depot 0. Either the pickup location or the

delivery location are associated with an advanced time

window [a,, b,], where r E V + U V - . The weight of

goods q, for a task i E N is known, when the task i

is assigned. We assume the value of travel time d,, is

already known, where r , s E V. If the vehicle arrives

at a location r E V + U V - and its arrival time t , is earlier than a,, it has t o wait. Every task i E N is subject to a,+

5

bi+, ai-

5

bi- and bi- - ai+ 2 di+,-.

The solution cost of the static single-vehicle PDPTW problem is minimized.

Z o b j e c t i u e = w1 drsxrs

+

w2 f w a i t i n g ( r )

T,SEV r e V + U V -

(1)

The notation x,,, r, s E V, is defined as

{

0 , otherwise.

1, if arc (r, s) is used by vehicle;

2,s =

The function f w a i t i n g ( r ) , defines the waiting time of a

location r E V + U V - as

a,

-

t,, if vehicle arrives at loca- tion r early;

f w a i t i n g ( r ) =

The first operand of the equation (1) is the total traveling time needed by the vehicle for completing the route, and the second operand of equation (1) is the total waiting time. The two factors 01 and wp are the weights, which reflect the relative importance of these two parts. We generally set w 1

+

w 2

>

0 and W l , W 2

2

0.

Solutions to the single-vehicle PDPTW are subject to the following constraints[2]. First, the vehicle starts from an initial depot, and each location is visited only once. Second, each task r E N should be picked up before it is delivered, which is called precedence con- straints. Third, the total load allocated to a vehicle cannot exceed its capacity. This constraint is named

capacity constraints. Fourth, whenever the vehicle ar-

rives at location i E V + U V - at time ti, the criterion

ti

5

b, must be satisfied. In general, we named the

fourth constraint as time window constraints. Finally,

the vehicle routes will be open paths, ending at any one of the delivery locations.

2.2 Dynamic case

In the static cases, tasks to the problem do not change, either during the execution of the algorithm, or during the eventual execution of the route. By con- trast, in dynamic cases, tasks may change during the execution of the algorithm and the eventual execution of the route. For the requirements of a dynamic vehi- cle routing problem, we should modify the objective function Z o b j e c t i v e to accomplish a route in real time.

A modified objective function is defined as

Z d y n a m i c = Z o b j e c t i v e

+

[a1 f d e l a y ( r ) r E V + U V -

+ a 2 f o u e r l o a d ( r ) ] r E V + u V -

The objective function Z d y n a m i c is based on the objec-

tive function of the static case, but with some penal- ties. For any r E V + U V - , the function f d e l o y ( r ) and

foverload(T) represent the vehicle delay time and over-

load at location r respectively, where a 1 and a2 are penalty coefficients.

The functions fdelag(r) and foverload(r) are defined

as following (r E V + U V - ) :

t , - b,, if a vehicle arrives at loca- tion r lately;

otherwise.

if the current load 1, ex- ceeds the vehicle capacity

Q ;

{

0, f d e t a y ( r ) =

I

0, otherwise. 454 otherwise.

(3)

According to the definition of Z d y n a m i c , we will try

to minimize it.

3

Hybrid Approach

Figure 1 shows the architecture of the hybrid ge- netic algorithms.

module

Re-Planned DP

module Illod"k

Figure 1: Architecture of hybrid GA

3.1 Pre-planned module

Algorithm 1 Genetic algorithm of single-vehicle PDPTW

1: t = 0;

2: Generate a population P ( t ) ;

3: Use Z d y n a m i c to evaluate chromosomes in P ( t ) ; 4: while termination condition not satisfied do 5:

6: 7:

8: Perform crossover; 9:

Initialize a temporary population PI; for i = 1 to IP(t)I do

Select two parents from P ( t ) ;

if the offspring and its parents are identical then 10: Perform mutation; 11: end if 12: 13: end for 15: Replace P ( t ) by PI; 16: end while

17: Output the solutions;

Place the offspring into PI; 14: t = t -I- 1;

A pre-planned module will arrange the tasks and prepare the information for the DP module. The pre- planned module collects the tasks that have not been finished, and set a new initial depot of the vehicle. The execution time and the load of vehicle are not equal to zero and the pre-planned module should maintain the proper values of them.

3.2

DP

module

The DP module performs a dynamic programming algorithm. When a specific time is expired, the DP module will pass its unfinished sub-routes to a tem- porary result pool; these unfinished sub-routes will be the initial population of genetic algorithms. We adopt the dynamic programming approach that pro- posed by Psaraftis[4]. In the current state of knowl- edge, the single-vehicle dial-a-ride problems can rarely be achieved to optimization when the number of tasks is more than 40. As to the dial-a-ride problems, they might be a special case of PDPTW when every task demands of the PDPTW are equal. Detailed algo- rithms of dynamic programming can be found in many publications[4, 5, 31.

3.3 Genetic algorithm

We summarize the genetic algorithm used in our work as Algorithm 1. The procedure of step2 will gen- erate an initial population. The initial population of the hybrid genetic algorithms is based on the partially constructed routes of DP module; the sub-routes are in front of the initial routes. According to the step 7, we apply the tournament selection to select two parents,

and the tournament size is 2. Four crossover operators

and three mutation operators will be discussed in this paper. The algorithm will be executed until one of the following conditions is met: (1) The number of gener- ation is larger than the maximum generation. (2) The solution that has the best fitness value appears more than a specific sequence. (3)

<

0.005. The a ( P )

and m ( P ) are the standard deviation and the mean

of the fitness value in the population P respectively.

Currently, we set the values of maximum generation and the appearence sequence are equal to 2000 and 100 respectively.

m ( P ) -

3.3.1 Representation

Given a single-vehicle PDPTW with n tasks, a so-

lution is encoded as a chromosome, which is rep- resented by a permutation of locations from 1+ to

n-. For example, in 2 tasks problem, if a route is 0

+

1+

+

2+

+

2- t 1-, the representation of the chromosome will be (1+ 2+ 2- 1-). This representa- tion could be understood easily and the space require- ment is less than other representations. In addition, it is convenient for implementation.

In the single-vehicle PDPTW, the precedence con- straints can not be violated. The representation does not preclude routes from violating the precedence con- straints. A simple algorithm is used to maintain the feasibility of the corresponding routes. A chromosome adjustment algorithm will exchange the positions of

i+ and i-, when the vehicle visits the delivery loca- tion i- before the pickup location i+ of a task i E N .

(4)

somes will be satisfied the precedence constraints by making the pickup location be appeared before the delivery location for any specific task.

3.3.2 Crossover operators

In the present work, we compare to the performance of four crossover operators on the single-vehicle PDPTW problem. These operators are order crossover (OX), uniform order-based crossover (UOX), merge cross #1

(MX1) and merge cross #2 (MX2)[1]. The first two operators are traditional crossover operators and the last two operators use a global precedence vector to be the guidance of crossover. We will not describe the two traditional crossover operators. The other two crossover operators are described below.

Most traditional crossover operators for order- based GAS do not have strong connection t o the con- straints of the problems they are applied. If we apply the traditional crossover operators to the single-vehicle PDPTW, they might not be conducive t o the search- ing process of optimal solutions because the informa- tion of the constraints is not used by these operators. On the other hand, the notion of merge crossover op- erators is that a global precedence among genes inde- pendent of any chromosome, rather than the behav- ior of traditional crossover operators that defines a lo- cal precedence among genes specific t o a chromosome. That is, each gene in the chromosome has a precedence relationship to every other gene. From the charac- teristics of constraints of the single-vehicle PDPTW, a global precedence relation probably exists among genes. The global precedence vector is formed by such relationship and it could be the offspring-generating guidance.

In our single-vehicle PDPTW, each gene is either a delivery point or a pickup point and has an associated time window. Therefore, we can make use of the time window [a,, bp] of the location r E V + U V - and a precedence relationship among each earliest processing time a,. Given r,s E V + U V - , if a, less than a,, let the location r be appeared before the location s

in the global precedence vector because it will be a

reasonable solution to serve the location r before the location s. In other words, we can sort all a, in the ascending order, and the sorting result will be a global precedence vector.

We demonstrate the operations of MX1 with an example. Suppose that the set of tasks

N = {1,2,3,4} and the set of locations V = {0,1+, 1-, 2+, 2-,3+,3-,4+,4-}. Given a global precedence vector (l+, 2+, 3+, 4+, 1-, 2-, 3-, 4-), the location 1+ is top-priority, and the location 2- takes precedence over the locations 3- and 4-. In other words, the location 1+ has the precedence of the oth-

ers and the location 4- has the lowest precedence. The MX1 operator on two chromosomes (say PI and P2)

produces single offspring, as shown below:

PI: 1+ 1- 2+ 2- 3+ 3- 4+ 4-

P2: 2+ 3+ 1+ 2- 1- 4+ 4- 3-

At the first step, we make a comparison between the first gene of PI and that of P2, so we compare 1+ with 2+ according to the global precedence vector. In the global precedence vector, the location 1+ takes precedence over location 2+, so 1+ is the first gene of the offspring that inherits the gene from PI. With regard to P2, the first gene 2+ exchanges the position

with the gene 1+, so that we can maintain the validity of the route.

The gene with the earlier precedence is placed into the offspring

C

and genes are swapped to maintain validity if necessary. Continuing the process until

C

is filled with genes. Finally, a route is produced. 1+ 3+ 2+ 2- 1- 4+ 3- 4-

Effectively, MX1 produces a child that is close to the order of the global precedence.

With the same global precedence vector as the MX1 operator, the MX2 operator on two chromosomes also produces a single offspring. The contents of PI and P2 are also the same as the preceding example.

The process is similar to merge two sorted vectors. The first gene of PI is found t o be prior to the one of P2

according to the global precedence vector. The prior gene 1+ is placed in the offspring C. Then, the first gene of PI is removed in both individuals, hence the 1+ is removed from both PI and Pz. The second gene

of PI is compared with the first gene of P2 according

to the global precedence vector. The first gene of PZ

(2+) is found to be the prior gene. Again the prior gene is placed into the offspring

C,

and removed from the both chromosomes. By continuing the process in this fashion, we can get an offspring

C

shown below.

1+ 2+ 3+ 1- 2- 4+ 3- 4-

precedence near the end of the chromosome.

This operator will move the gene with the lowest

3.3.3 Mutation

The probability of mutation rate is very small, and in our approach, it is not a fixed value. Mutations will be applied when the offspring is the same as one of its parents. In general, the mutation is worked with a single chromosome. A chromosome will be created by applying the mutation operator, and it will substitute the new chromosome for its original one. We will con- sider three mutation operators that can be applied to the single-vehicle PDPTW problem.

(5)

(1) Two genes are selected randomly, and their posi- tions are interchanged.

task cr. mutation operators

no. rate

-

I

(1)

I

(2)

I

(3) (2) Randomly two cut sites are chosen, and the order

of the sub-route specified by the genes is inverted. (3) If the vehicle arrives at the ith stop and violates the constraints, we will disturb the order of the genes within the first ith sub-route.

The first operator will create a new route which has four different edges from its original route. The sec- ond mutation operator is similar as the 2-opt move in TSP; the difference between the new and the original route is two edges. Finally, the third mutation opera- tor rearranges a specific sub-route; such a change may affects the solution cost significantly.

optimal value

4

Experimental Results

10 We have tested the hybrid genetic algorithm on five

problems consisting of 10, 20, 30, 40 and 50 tasks, re- spectively. In these problems, the pickup locations and the delivery locations are randomly placed in a rectangular grid. The locations of each task are as- sociated with a time window, which is generated ran- domly. The Euclidean distance is used to measure the distance between a pair of locations.

In our experiments, the global precedence vector of

MX1 and MX2 is based on the lower bound of time windows. We test the four crossover operators associ- ated with three different crossover rates, the rates are

0.45, 0.6 and 0.75. The population size of each prob- lem is the number of task multiplied by 5. That is, if the number of task is 40, the total number of loca- tion is 81 and the population size is 200. The value of each factor in the objective function will be a1 = 10, a2 = 50, w1 = 1, and w2 = 2.

At

first, we would like to make a comparison among the crossover operators without the mutation opera- tors, in order t o study the pure relative performance of the crossover operators. In Figure 2, the mutation op- erators are not applied to the single-vehicle PDPTW problem. The solution cost is based on Zobjective

where w1 = w2 = 1. In Figure 2, for each genera- tion, the values of solution cost are the average in 20 runs.

Figure 2 shows the MX1 could achieve better solu- tion cost than the other crossover operators do. Ac- cording to the Figure 2, OX is not a proper operator for the single-vehicle PDPTW problem. OX creates offspring which inherits sub-tours of its parents. Such a new route is analogous to its parent routes. The so- lutions were trapped to similar routes, and therefore

0.45 1.000

1.000

~ ‘ 0 0 0

j

1.~000 0.60 1.000 1.000 1.000

1

1.000 1135

4

20 . . . ... 0.45 1.000 1.000 1.000 1.000 0.60 1.000 1.000 1.000 1.000 1794 0.75 1.000 1.000 1.000 1.000 0.45 1.033 1.000 1.000 1.033 I 0 50 150 m 250 300 Irn generation

Figure 2: The comparison of crossover operators

0.75 0.45

feasible solutions may not be found. As to MX2, a lo- cation with the lowest precedence is moved to near the end of the routes, and the solution may be stuck to a local minimum. The solution cost of UOX is approxi- mate to the solution cost of MX1 when the generation is larger than 200, but MX1 achieves the same solution cost before the 50th generation. For the real-time re- quests, the UOX may not be suitable for the dynamic single-vehicle PDPTW problem.

We apply the three mutation operators with the MX1 crossover operator. Table 1 describes the ra- tios of best costs to the optimal cost of the 10, 20, 30 and 40 task problems. A dynamic programming[4] ac- complished the optimal solution of the single-vehicle PDPTW problems. The optimal solutions of 10, 20,

I

1.033

I

1.000 1.000 1.033 1.053

I

1.000 1.000 1.051 Table 1: Relative optimality of the solutions

I

I

0.75

I

1.000

I

1.000

I

1.000

I

1.000

I

30 40 50

I

0.60

I

1.022

I

1.000

I

1.000

I

1.033

I

I I 2602

1

40y2

0.75 1.040 1.000 1.000 1.051 0.45 5336 5247 5247 5336 0.75 5341 5266 5276 5336

(6)

30 and 40 tasks are listed in the last column of Ta-

ble l. The mutation operator l-’ means that no mu- tation operator is applied to the genetic algorithms. As to the problem of 50 tasks, the results are shown

in the last three rows of Table 1. Most of exact al- gorithms applied to vehicle routing problems can not solve relatively larger problems, and we can not ob- tain the optimal values neither. From the results of Table 1, it shows the mutation1 and mutation2 attain better solution cost than the other mutation operator does.

Figure 3 shows the average solution costs of the

hybrid genetic algorithms are better than the average costs of the traditional genetic algorithms. A dynamic

Figure 3: DP+GA vs. GA only

programming is applied to generate the initial popu- lation instead of creating the it randomly. Since the initial population filtered out some of the infeasible routes and put the initial population contents more feasible sub-routes, the hybrid genetic algorithm al- ways obtain the lower solution cost than the tradi- tional genetic algorithms.

5

Conclusion

In this paper, we show that the hybrid genetic al- gorithm solves the dynamic single-vehicle PDI’TW problem. With such approach, that takes advan- tage of both dynamic programming and genetic al- gorithms. The approach enables dynamic program- ming to achieve real-time performance and genetic al- gorithms to approximate optimal solutions. The ini- tial population created by the dynamic programming instead of generating it randomly. The dynamic pro- gramming passes the unfinished routes to genetic al- gorithms to accomplish the real-time performance. A good initial population of the genetic algorithms is im- proved by the dynamic programming.

The hybrid approach can generate incrementally better solutions at any time, which is essential for deal- ing with dynamic task requests. Comprehensive ex- periments using an efficient and flexible implementa- tion of the hybrid genetic algorithms were performed. The experimental results showed that the hybrid ap- proach could produce near-optimal solutions for prob- lems of sizes up to 25 percent bigger than what can

be solved previously by dynamic programming. In addition, the hybrid approach may find sub-optimal solutions for dynamic vehicle routing problems of any size.

References

[l] J. L. Blanton Jr. and R. L. Wainwright. Multi- ple vehicle routing with time and capacity con-. straints using genetic algorithms. In Proceedings of the Fifth International Conference on Genetic Al- gorithms and Their Applications, pages 452-459, 1993.

[2] M. Desrochers, J. K. Lenstra, and M. W. P. Soumis. Vehicle routing with time windows: Opti- mization and approximation. In B. L. Golden and

A. A. Assad, editors, Vehicle Routing:Methods and Studies, pages 65-84. Elsevier Science Publishers,

North-Holland, Amsterdan, 1988.

[3] J. Desrosiers, Y. Dumas, and F. Soumis. A

dynamic programming solution of the large-scale single-vehicle dial-a-ride problem with time win- dows. American Journal of Mathematical and Management Sciences, 6(3 & 4):301-325, 1986. [4] H. N. Psaraftis. A dynamic programming solution

to the single vehicle many-to-many immediate re- quest dial-a-ride problem. Transportation Science, 14(2): 130-154, 1980.

[5] H. N. Psaraftis. An exact algorithm for the sin- gle vehicle many-to-many dial-a-ride problem with time windows. Transportation Science, 17(3):351-

357, 1983.

數據

Figure  1 shows the  architecture of  the hybrid  ge-  netic  algorithms.
Figure 2:  The comparison of  crossover operators
Figure  3  shows  the  average  solution  costs  of  the  hybrid genetic algorithms are better than the average  costs of  the traditional genetic algorithms

參考文獻

相關文件

Given a graph and a set of p sources, the problem of finding the minimum routing cost spanning tree (MRCT) is NP-hard for any constant p &gt; 1 [9].. When p = 1, i.e., there is only

Moreover, this chapter also presents the basic of the Taguchi method, artificial neural network, genetic algorithm, particle swarm optimization, soft computing and

(2004), &#34;Waiting Strategies for the Dynamic Pickup and Delivery Problem with Time Window&#34;, Transportation Research Part B, Vol. Odoni (1995),&#34;Stochastic and Dynamic

keywords: Ant Colony Optimization, Guided Local Search, Pickup and Delivery Problem with Time Windows, Time Window Partitioning Strategy... 第三章 PDPTW 轉換

Keywords: Ant Colony System (ACS), Farthest Insertion Method, Vehicle Routing Problem (VRP)... 第一章

This paper formulates the above situation to the Multi-temperature Refrigerated Container Vehicle Routing Problem (MRCVRP), and proposes a two-stage heuristic which consists of

Abstract: This paper presents a meta-heuristic, which is based on the Threshold Accepting combined with modified Nearest Neighbor and Exchange procedures, to solve the Vehicle

Clay Collier, “In-Vehicle Route Guidance Systems Using Map-Matched Dead Reckoning", Position Location and Navigation Symposium, IEEE 1990, 'The 1990's - A Decade of Excellence in the