GENIUS-CP: a Generic Single-Vehicle Routing Algorithm Gilles Pesant1, Michel Gendreau1;2, Jean-Marc Rousseau1;2;3 1
Centre for Research on Transportation, Universite de Montreal, C.P. 6128, succ. Centre-ville, Montreal, Canada, H3C 3J7 2 Departement d'informatique et de recherche operationnelle, Universite de Montreal, C.P. 6128, succ. Centre-ville, Montreal, Canada, H3C 3J7 3 Les entreprises GIRO inc., 75, rue de Port-Royal est, bureau 500, Montreal, Canada, H3L 3T1 fpesant,
[email protected],
[email protected]
Abstract. This paper describes the combination of a well-known tsp
heuristic, genius, with a constraint programming model for routing problems. The result, genius-cp, is an ecient heuristic single-vehicle routing algorithm which is generic in the sense that it can solve problems from many dierent contexts, each with its particular type(s) of constraints. The heuristic quickly constructs high-quality solutions while the constraint model provides great exibility as to the nature of the problem constraints involved by relieving that heuristic of all constraint satisfaction concerns. We show how those two components are integrated in a clean way with a well-de ned, minimal interface. We also describe dierent routing problems on which this algorithm can be applied and evaluate its performance.
Introduction Ever since its beginnings in the area of combinatorial optimization, one major advantage of constraint programming (cp) over other methods has been its exible modeling capabilities. Because of its uniform way of dealing with constraints of all likes, through local propagation, it is able to directly manipulate constraints in the form which most naturally and faithfully models the problem at hand, and quickly adapt to a concrete or new situation featuring ad hoc constraints by simply adding them to the model. On the other hand, the natural cp methodology of backtrack search may fail to provide solutions in a reasonable amount of time for some or even most instances of a problem. This lack of robustness can be alleviated somewhat by careful branching decisions but the required insight may not necessarily be available. The eld of operations research has had a long history of heuristic algorithms development in response to dicult combinatorial optimization problems. Heuristic algorithms generally provide near-optimal solutions within a short computing time and tend to scale up well. Their success is usually due to a clever
exploitation of the structure of the problem and a good deal of insight. The fact that they are geared toward a particular context also becomes a drawback when faced with an even just slightly dierent context, such as side constraints: adapting them may demand considerable time, eort, and money. It is therefore tempting to gain both the exibility of constraint programming and the eciency of more conventional heuristic algorithms. The framework for such a combination is a promising area of research, as echoed in a recent survey on applications of constraint programming ([Wal96], p.161). Nevertheless, the eorts outlined in that survey oer more of a juxtaposition than a true combination | some use cp as a preprocessing step for the particular heuristic employed while others use it to \ ll in the blanks" once the heuristic has constructed a partial solution (see also the \shue" moves of [CL95]). We have proposed in [PG96] a closer interaction of the two in the context of local search methods: as we explore the neighbourhood of some current solution by tree search, constraint propagation is used to both enforce the problem constraints and guide that exploration. This paper promotes the same kind of combination but in the context of a constructive heuristic, genius, in the area of vehicle routing. It also provides numerical results for genius-cp, the implementation of this framework, on dierent types of routing problems, demonstrating both its eciency and exibility. The rest of the paper is organized as follows. The next section outlines the heuristic algorithm genius. Section 2 is the core of the paper, describing in detail the combination of that heuristic with a constraint model. The resulting algorithm is then applied to several distinct routing problems in section 3. Finally, we conclude with a summary of the contribution and identify perspective research.
1 GENIUS In this section we describe the routing heuristic used in genius-cp. The traveling salesman problem (tsp) consists of nding a minimum cost tour of a set of cities in which each city is visited exactly once. It is well-known to be NP-complete but because of its practical importance many heuristic algorithms have been developed to rapidly solve instances to near optimality. Among them, genius [GHL92] has been quite successful. It is composed of a tour construction phase and a post-optimization phase.
1.1 GENI: a tour construction heuristic The heuristic rst attempts to build a good initial tour by inserting cities one by one into an originally empty tour. Its novelty lies in the way those insertions are performed. Instead of only considering an insertion between two consecutive cities on the current tour, a generalized insertion (hence the acronym) may take place between any two cities on the current tour. This of course requires repairing the tour, as shown in gure 1. In this sample insertion, let the current
ci c
cj
ck
Fig. 1. A generalized insertion tour be a clockwise walk on the circle. When c is inserted between ci and cj , not consecutive, one way the tour may be repaired is by going counterclockwise from cj to ci 's current successor (thus reversing a segment of the tour), then visiting some ck and going counterclockwise to cj 's current successor, to nally visit ck 's current successor and then complete the tour. Though more involved, such insertions are much more powerful. In order to cut down on the combinatorics, cities between which an insertion of c is considered are selected among c's closest neighbours. At each step, the current tour is updated with the best generalized insertion.
1.2 US: a post-optimization heuristic
Once an initial tour has been obtained, the heuristic attempts to improve it, again using generalized insertions. Each city is in turn tentatively removed from the tour, using the best reverse generalized insertion, and then inserted back into the tour, using the best generalized insertion. If this leads to an improvement, the move is implemented and the post-optimization phase re-started. The algorithm stops when a complete pass through all cities yields no improvement.
1.3 Adding time windows
The genius heuristic was later adapted to handle time windows at cities: each city must be visited within its own time window (the tsp-tw). These temporal constraints made genius-tw [GHLS95] considerably more specialized and complicated than the original version: { the need to backtrack appeared as it might prove impossible to insert a city while obeying time windows, due to some bad choice of previous insertions; { cities with narrow time windows were now inserted rst; { the notion of closest neighbour was expanded to represent not only distance but proximity of time windows as well; { the distinction between neighbour-successor and neighbour-predecessor had to be made, since the orientation of the tour now mattered; { a critical departure time had to be updated at each city to insure feasibility.
2 GENIUS-CP As we just saw, the introduction of extra constraints (in this case time windows) into the tsp context demanded a restructuring of genius (to provide backtracking capabilities) and the addition of special-purpose code throughout the heuristic in order to ensure feasibility and adjust algorithmic control to the temporal avour of the problem. Worse yet, the presence of ad hoc constraints, often the lot of real-life problems, would complicate further the heuristic, and the problem-speci c nature of those constraints may not justify the time and eort required to adapt it. Nevertheless, these real-life problems will not go away on their own and need to be solved. The idea behind genius-cp is to separate as much as possible the algorithmic part, constructing a good tour, from the declarative part, ensuring the constraints are satis ed. This way the heuristic is kept pure | all additional constraints are dealt with in a uniform manner through constraint propagation. We show in gure 2 a high-level description of the geni-cp algorithm | the us-cp algorithm does not contain additional methodological ingredients and so we will concentrate on the former. One city is identi ed as the depot from which the tour starts and ends. Step 1 simply initializes the tour T with two copies of that depot. Step 2 is the main loop which inserts cities. Step 2.1 is where backtracking may occur if the choice of the next city to insert proves unlucky. Step 2.2 declares the constraints for the following subproblem: nd a feasible tour on the cities already inserted plus c, the next city to insert. We will come back to it in section 2.1. Step 2.3 attempts each of many types of generalized insertions for that subproblem. Step 2.3.1 is at the heart of the algorithm and we will devote section 2.2 to it. Step 2.4 implements the best insertion and nally step 3 returns the completed tour. 1. T := ; 2. UNTIL all cities have been inserted 2.1. choose a city c non-deterministically; 2.2. create a CP routing model for c and the cities already on T; 2.3. FOR each insertion type 2.3.1. perform a branch-and-bound exploration of possible insertions; 2.4. T := T + the best generalized insertion of c; 3. Return T;
Fig. 2. The geni-cp algorithm We now begin to describe how the main components of this algorithm are implemented in a constraint programming framework. Assuming n cities labeled 1 through n are to be inserted, de ne nite domain variables 1 ; : : : ; n , each with domain f1; : : : ; ng, where m is interpreted as the mth city to be inserted. Clearly from that interpretation, 1 ; : : : ; n are constrained to take on dierent
values. Let Tm stand for the partial tour after the mth insertion (with T0 being the initial tour at step 1); insert(Tm?1 ; m ; Tm ) represents the following constraint optimization problem: given a constraint model for Tm , nd the least-cost feasible generalized insertion of m into Tm?1 , yielding Tm . This corresponds to steps 2.2{ 2.4 in gure 2. A conditional constraint p ) q enforces the consequent q once the antecedent p is veri ed. We use the syntax \Var = value" for an antecedent to mean that it is veri ed when variable Var is instantiated to some value. Our constraint satisfaction problem would then be: Find a valid assignment of 1 ; : : : ; n such that m 2 f1; : : : ; ng 81mn 8 1 m; m0 n; m < m0 m 6= m0 m = c ) insert(Tm?1 ; c; Tm ) 8 1 m n; using lexicographic order as the variable selection rule and fewest neighbours as the value selection rule. This loosely corresponds to steps 2 and 2.1. The rst rule, lexicographic order, is self-explanatory and simply spells out the fact that we want to choose the rst city to be inserted, then the second one, and so on. The second rule, which expresses how we favour cities for insertion, picks the city that minimizes the total number of possible predecessors and successors for that city.
CP ROUTING MODEL
TYPE X INSERTION restriction of neighbours I, J, K
S’s, P’s instantiation of model variables constraint checking
solution construction
Fig. 3. The interaction between the constraint model and the heuristic The rest of this section focuses on insert(Tm?1 ; m ; Tm ). Figure 3 illustrates the relationship between constraint checking through the model and solution construction through the basic insertion step of the genius heuristic. The next two sections will expand on each component, with the second one particularly stressing their interaction. For now, let us say a few words about the interface. Of the whole routing model, only the successor and predecessor variables (to be introduced shortly) participate directly in the heuristic tour construction. Their constrained domain de nes and so restricts the possible neighbours of a city for an insertion; in turn as a tentative insertion materializes, some of the successor and predecessor variables are instantiated.
2.1 The constraint programming routing model We need to create a separate model for each partial tour, as indicated at step 2.2. To model Tm , we adapted the constraint programming formulation of [PGPR96] for an exact tsp-tw algorithm. We will gradually introduce our model, motivated by the kind of constraints we could wish to express. Let the origin-depot and destination-depot be identi ed as 0 and m + 1, respectively, with cities 1 to m to appear on the tour. De ne nite domain variables S0 ; : : : ; Sm where Si represents the immediate successor of i on the tour. Similarly, de ne variables P1 ; : : : ; Pm+1 for immediate predecessors. Our basic model would be:
Si 2 f1; : : :; m +1g; Pi 2 f0; : : : ; mg; Si = j ) Pj = i Pj = i ) Si = j
80im 8 1 i m +1 80im 8 1 j m +1
(1) (2) (3) (4)
Admittedly, this isn't much and the only potential propagation, in (3)-(4), ensures the consistency of successor/predecessor variables with regard to their interpretation. One would usually expect structural constraints to make sure that the solution is a valid tour (i.e. no two cities have the same successor and no sub-tour is created) but the construction heuristic already guarantees it because of the way the insertions are performed. Even such a bare model nevertheless allows us to express sequencing constraints:
{ city i must be visited rst: S0 = i { city j must be visited last: Pm+1 = j { city ` must immediately follow city k: Sk = ` We may also wish to specify precedence constraints, which are looser than sequencing constraints: city i must be visited before city j , but not necessarily immediately before. For this purpose, let tij denote the time it takes to go directly from city i to city j 4 and introduce variables Ti ; i = 1; : : : ; m +1 representing the time at which we visit city i (T0 being xed at 0). Constraint (6) enforces consistency between successor variables and visiting time variables.
Ti 2 f0; : : : ; maxTimeg Si = j ) Ti + tij Tj ;
8 1 i m +1 80im
(5) (6)
Now de ne set variables Bi and Ai ; i = 0; : : : ; m +1, representing the cities which we visit respectively before and after city i. In what follows, the rst two 4
In order to simplify the presentation, we will assume that this is the fastest way to get from i to j , though this is not a requirement of the model (see[PGPR96]).
constraints express the fact that each pair hBi ; Ai i forms a partition while the last one links those set variables to the Ti 's:
Ai [ Bi = f0; : : :; m +1g n fig Ai \ Bi = ; Ti + tik > Tk ) k 2 Bi ^ i 2 Ak
8 0 i m +1 (7) 8 0 i m +1 (8) 8 1 i m +1; 0 k m; i 6= k (9) Stating the earlier precedence constraint now simply amounts to \i 2 Bj ".
Everything is already in place to express time window constraints in the form of lower and upper bounds ai and bi on the time we visit city i:
ai T i b i ;
8 1 i m +1
(10)
Using logical connectives, multiple time windows can also be handled: { city i may be visited from 9am to 5pm but not between noon and 1pm: (9 Ti 17) ^ :(12 < Ti < 13) It is common knowledge that adding redundant constraints to a model often increases the amount of propagation, thus improving inference capabilities, which can make all the dierence when tackling combinatorial problems. We reproduce below some powerful redundant constraints for routing/scheduling problems, taken from [PGPR96]. The interested reader may consult that reference for a suitable description of them, as it falls beyond the scope of this paper.
Ti + tij > Tj ) Si 6= j; Ai \ Bj 6= ; ) Si 6= j; Ti k2dom( minP )(Tk + tki ) i Ti k2dom( max (Tk ? tik ) Si ) Ti max (T + t ) k2Bi k ki Ti kmin (T ? t ) 2A k ik i
8 0 i; j m +1; i 6= j 8 0 i m; 1 j m +1; i 6= j 8 1 i m +1 80im 8 1 i m +1 80im
(11) (12) (13) (14) (15) (16)
2.2 The branch-and-bound exploration of insertions The idea of exploring by depth- rst branch-and-bound search a local search space, here the set of tours which can be built using some generalized insertion on the current tour, has already been presented in [PG96]. It is a natural methodology for constraint programming but also for most local search spaces because of their structure. Pruning is achieved when the cp model detects a dead end, discarding an infeasible subset of solutions, or when a lower bound on the cost exceeds that of the best solution so far, discarding an unattractive subset of solutions. We will concentrate here on the interaction between the insertion heuristic and the routing model, using a particular type of insertion as an example.
i
i+
c
j
j+
k+ k
Fig. 4. An insertion which breaks three arcs while preserving orientation Figure 4 illustrates a generalized insertion which replaces three arcs, (i; i+), (j; j + ), (k; k+ ), by four others, (i; c), (c; j + ), (k; i+ ), (j; k+ ), thus inserting city c into the tour. The former tour was again the clockwise walk on the circle; the new one is obtained by following the arrows on the tour segments and arcs. Note that this type of insertion preserves the orientation of the tour segments, an asset when confronted with sequencing, precedence or time window constraints. We will need a bit of notation. Let Tm?1 be the current tour (before the mth insertion). i+ (resp. i?) stands for the immediate successor (resp. predecessor) of city i on Tm?1 . We de ne the following binary constraint on cities of Tm?1 : i j states that i appears before j on Tm?1 . The cost associated with arc (i; j ) is denoted cij . Finally, de ne the unary operator closest neighbours() on successor and predecessor variables which when applied to Si (resp. Pi ) has a behaviour equivalent to sorting the values in its domain, fj : j 2 dom(Si )g (resp. Pi ), in non-decreasing order of cij (resp. cji ) and then removing all but the rst ` values. Note that an instance of an insertion of c is totally determined by the value of i, j and k. Examining all insertions therefore amounts to trying all possible combinations of values for i, j , k. In the terminology of [PG96], nite domain variables I , J , K , with domain f0; : : :; m ? 1g and constraint I J K (since i appears before j which appears before k for this type of insertion), would be our neighbourhood model: I; J; K 2 f0; : : :; m ? 1g (17) I J K (18) These combinations of values will be implicitly enumerated in a tree search: we rst branch on I , then J and nally K . The cost of an insertion is given by (cIc + ccJ + + cJK + + cKI + ) ? (cII + + cJJ + + cKK + ); the total cost of the arcs we add minus the total cost of the ones we remove. Its smallest possible value will be used as our lower bound and will be re ned automatically as the domains of I; J; K shrink (ultimately to a single value).
Recall from section 1.1 that c ends up being inserted between some of its closest neighbours. Consequently even before starting the search, we already know that I and J + must be closest neighbours of c (see gure 4):
I = closest neighbours(Pc ) J = closest neighbours(Sc )?
(19) (20)
This is principally information traveling from the routing model (the box on the left in gure 3) to the insertion heuristic (the box on the right in the same gure): the successor and predecessor variables, constrained by the model, are used to identify the potential neighbours (instrumental in selecting the arcs to be added and removed) and in so doing restrict the possible values for I and J . As we try a value for I , say i, lots of information now travels the other way: Pc becomes instantiated as well because of (19); the initial tour segment up to I will remain in the new tour and so the appropriate successor variables can be instantiated. Now that we have a value for I , we may also constrain further K which must be a closest neighbour of i+.
V?
I = i ) i`=0 S` = `+ I = i ) K = closest neighbours(Pi+ )
(21) (22)
The four conditional constraints below describe the consequences of branching on J and K . As before, information travels to the routing model by instantiating successor variables (constraints (23),(25),(26)) and to the insertion heuristic by restricting the possible values for branching variables (constraint (24)).
J =j J =j K=k K=k
) ) ) )
V j ? S = `+ `=i+ `
K = closest neighbours(Sj )? V k ? S = `+ + V`n=j S` = `+ `=k+ `
(23) (24) (25) (26)
As we saw, only the Si 's and Pj 's in the routing model and the I; J; K variables for the insertion heuristic were involved in the interface. Our constraint optimization problem insert(Tm?1 ; m ; Tm ) nally looks like: subject to
Minimize (cIm + cm J + + cJK + + cKI + ) ? (cII + + cJJ + + cKK + ) (1) ? (16) (17) ? (26)
(the routing constraints for Tm ) (the insertion heuristic constraints)
using lexicographic order for both the variable and value selection rules on I; J; K .
2.3 On its generic design In order to make genius-cp generic, we have made the following design choices, which should be compared to the adaptations for genius-tw in section 1.3: { We provide implicit backtracking when choosing the order of insertions by formulating it as a constraint satisfaction problem, thus allowing the heuristic to recover from unforeseen dead ends. { Cities to be inserted are selected in non-decreasing number of possible neighbours. This is consistent with the aim found in genius-tw of rst dealing with the most dicult cities to insert, and remains a fairly general measure of diculty since the problem-speci c constraints will only indirectly aect it by reducing the domain of the appropriate Si and Pi variables. { Closest neighbours are determined solely on the basis of the distance (or more generally, cost) involved in reaching them. Since our original pool of neighbours comes from the domain of routing model variables, candidates which would turn out to be incompatible because of problem-speci c constraints (such as time windows) should already have been weeded out through propagation. { The exibility of distinguishing between neighbour-successor and neighbourpredecessor follows naturally from the use of successor and predecessor variables, respectively, to identify neighbours. { Several types of insertions are available, both reversing and preserving the orientation of some of the segments of the current tour.
3 Application to routing problems This section describes three dierent vehicle routing contexts and reports on the performance of our algorithm on test problems. Emphasis is put on speed and solution quality. genius-cp was implemented using ilog Solver 3.2 ([ILO95]) and all tests were performed on a Sun Ultra-1/140. ilog Solver provided a rich set of primitive constraints (such as set constraints and indexical constraints, which we required) and exible support for user-de ned constraints (another \must" in our case). The fact that it is a C++ library also made the comparison with the existing implementation of genius-tw more fair.
3.1 TSP with (simple) time windows We considered two sets of symmetric Euclidean problems taken from the literature. The rst set considers subproblems of the popular vrptw benchmark in [Sol87]: the original instances requiring several vehicles, we create our instances by partitioning the cities of each original instance such that every subset can be feasibly visited by a single vehicle. The resulting 27 instances range from 20 to 42 cities. Cities feature a semi-clustered distribution (the rc200 problems) and some instances have a narrow time window on every city while others only have
a few cities with a meaningful time window. For the second set, we selected from [DDGS95] 10 instances on 40 cities with time windows of moderate width (the n =40; w =60 and n =40; w =80 problems). The routing constraints used by our algorithm were (1)-(6),(10); in only two instances did the addition of the redundant constraints (11)-(16) and their accompanying constraints (7)-(9) give better results, which we used. 1.2 GENIUS-CP / GENIUS-TW GENIUS-CP / exact CP algorithm
1.15
solution cost ratio
1.1 1.05 1 0.95 0.9 0.85 0.8 0.75 0.001
0.01
0.1 1 CPU time ratio
10
100
Fig. 5. Comparison of genius-cp with related algorithms on tsp-tw benchmarks We compared genius-cp with an already existing, ecient implementation of and the exact cp algorithm described in [PGPR96] which essentially exhibits the same routing model as our algorithm but adopts a branch-andbound strategy with a carefully designed variable-ordering heuristic. The graph at gure 5 shows the relative performance of genius-cp with respect to the other two. Each instance is represented by a point whose x-coordinate corresponds to the fraction of the computation time for the exact algorithm (resp. genius-tw) which is spend by genius-cp (note the logarithmic scale) and whose y-coordinate indicates how far from the optimum (resp. genius-tw's solution) our heuristic solution is. Turning rst to the comparison with the specialized heuristic, we note that a bit more than one order of magnitude is lost in speed, the price to pay for a generic heuristic capable of handling much more. The points tend to be clustered in the time axis since the genius heuristic at the basis of both is quite robust in terms of execution time. The solution cost ratio indicates that each algorithm has instances on which it produces a better solution than the other, though genius-cp appears a more regular winner. This may be due to the greater variety of insertion types in our algorithm, particularly the ones which preserve genius-tw
the orientation of route segments. Moving on to the comparison with the exact algorithm, we observe that our algorithm is generally faster, as expected, and often much faster: ratios shown on the graph range from 5 to 0.001. The instances which are solved with comparable or even faster execution times by the exact algorithm correspond to the smaller or heavily constrained ones | the larger and \looser" instances usually require considerably more computation time. In fact, 10 of the 37 instances could not be solved by the exact algorithm within one day of computation and so are not accounted for on the graph, though they should appear at the extreme left if not beyond. The horizontal spread of the points indicates a lack of robustness for the exact algorithm, which makes genius-cp's robustness a clear advantage: in absolute terms, the mean and standard deviation for the execution time of genius-cp over all instances are respectively 89 and 62 seconds whereas for the exact algorithm they are 11 412 and 24 043 seconds. In addition, the heuristic solution is very often optimal and, except in one case, always within 3.8% of the optimum, an indication that high-quality solutions are produced by our heuristic.
3.2 TSP with multiple time windows Allowing a city to be visited during one of several disjoint time intervals adds sucient complexity for traditional algorithmic approaches that very little has been published on it yet. Accordingly, no problem set is known to us. We therefore generated our instances, by fragmenting the time windows in the rst set of problems of the previous section. Fragmentation takes place in four dierent ways for each original instance: a few small gaps in the original window, one big gap of about half the window, nine gaps totaling about half the window, and a mix of the above. We therefore generated 108 instances | of these, some may of course have become infeasible. The graph at gure 6 shows the relative performance of our algorithm with respect to the exact algorithm, on the 55 instances which could be solved by both algorithms (comparison with genius-tw is no longer possible since it cannot handle multiple time windows). The routing constraints were the same as in the previous section and the redundant constraints were added for 12 instances. Here as well we note an important dierence in execution time and robustness. Many of the heuristic solutions are optimal or near-optimal; nevertheless in three instances we are between 10% and 16% above the optimum, which is poor performance. For 4 other instances solved by the exact algorithm, genius-cp could not terminate within a reasonable number of backtracks; for 25 other instances solved by genius-cp, the exact algorithm was interrupted after one day of computation, without having found the optimal solution. This means that 25 more points, about half of the number already on the graph, should appear at the extreme left of that graph, which adds considerable weight to the claim of greater eciency and robustness.
1.3 GENIUS-CP / exact CP algorithm 1.25
solution cost ratio
1.2 1.15 1.1 1.05 1 0.95 0.9 0.001
0.01
0.1 CPU time ratio
1
10
Fig. 6. Comparison of genius-cp with the exact algorithm on tsp-mtw benchmarks
3.3 Pick-up and delivery problems In this setting, cities come in pairs hcp ; cdi | some goods are picked up at cp , to be delivered at cd. Obviously, this imposes a precedence constraint: cp must be visited before cd . For a problem of size n we will therefore have n2
precedence constraints, which is quite a few. This serves as a test to see whether the genius heuristic, not designed with this context in mind, can be called upon to provide good-quality solutions, with the routing model handling those additional constraints. In general, the pick-up and delivery problem with time windows (pdptw) involves several vehicles and depots as well as time window, precedence and capacity constraints (for a recent survey, see [DDSS95]). We consider the singlevehicle case, 1-pdptw, without capacity constraints (though such constraints could be easily added to the routing model). To our knowledge there exists no established benchmark for that problem: what one nds in the literature tends to be isolated real-life problems. We therefore generated our problem set using the simulator described in [GGPS97] for a dynamic vehicle dispatching system and made the instances static by knowing all requests ahead of time. We randomly generated 10 instances on 30 cities (15 pick-up/delivery pairs) and 5 instances on 40 cities, each exhibiting fairly wide time windows. The full routing model was used. Of the 15 instances, one could not be solved by genius-cp within a reasonable number of backtracks. On the other hand, the exact algorithm did not terminate on any of the instances within the xed limit of one day of computation. Consequently, we present the results in a dierent way. The graph at gure 7 shows the relative progression over time of the solution cost for the exact al-
1.6 exact CP algorithm / GENIUS-CP (n=30) exact CP algorithm / GENIUS-CP (n=40)
solution cost ratio
1.4
1.2
1
0.8
0.6 0.01
0.1
1 CPU time ratio
10
100
Fig. 7. Comparison of genius-cp with the exact algorithm on pick-up and delivery problems with time windows
gorithm with respect to the cost of the solution found by genius-cp. Note that ratios are taken here as \exact/heuristic". It reveals that in all but two (or in extremis three) instances, the quality of the heuristic solution signi cantly exceeds that of the exact algorithm, even given 100 times more computation time for the latter (the corresponding lines in the graph lie strictly above the dotted line at 1). The average computation time for genius-cp over n =30 and n =40 instances were respectively 152 and 640 seconds.
Conclusion We have shown in this paper how constraint programming and a conventional heuristic algorithm can be combined to oer the best of both worlds: exibility, solution quality, eciency and robustness. Experimental results in three dierent vehicle routing contexts support our claims. Comparing our algorithm with an exact cp algorithm using the same constraint model but with a branchand-bound strategy demonstrated the advantage of incorporating a successful solution strategy from operations research. The investigation of similar combinations of constraint models with other heuristics is clearly an interesting path to follow. In the area of vehicle routing, an appropriate heuristic for problems with multiple vehicles appears the next logical move.
Acknowledgments Financial support for this research was provided by the Natural Sciences and Engineering Research Council of Canada (NSERC).
References [CL95]
Y. Caseau and F. Laburthe. Disjunctive Scheduling with Task Intervals. Technical Report 95-25, Laboratoire d'informatique de l'E cole Normale Superieure, Departement de mathematiques et d'informatique, 45 rue d'Ulm, 75230 Paris Cedex 05, France, 1995. [DDGS95] Y. Dumas, J. Desrosiers, E . Gelinas, and M.M. Solomon. An Optimal Algorithm for the Traveling Salesman Problem with Time Windows. Operations Research, 43(2):367{371, 1995. [DDSS95] J. Desrosiers, Y. Dumas, M.M. Solomon, and F. Soumis. Time Constrained Routing and Scheduling. In M.O. Ball, T.L. Magnanti, C.L. Monma, and Nemhauser G.L., editors, Network Routing, volume 8 of Handbooks in Operations Research and Management Science, pages 35{139. North-Holland, Amsterdam, 1995. [GGPS97] M. Gendreau, F. Guertin, J.-Y. Potvin, and R. Seguin. A Tabu Search Algorithm for a Vehicle Dispatching Problem. Working paper, 1997. [GHL92] M. Gendreau, A. Hertz, and G. Laporte. New Insertion and Postoptimization Procedures for the Traveling Salesman Problem. Operations Research, 40:1086{1094, 1992. [GHLS95] M. Gendreau, A. Hertz, G. Laporte, and M. Stan. A Generalized Insertion Heuristic for the Traveling Salesman Problem with Time Windows. Publication CRT-95-07, Centre de recherche sur les transports, Universite de Montreal, Montreal, 1995. To appear in Operations Research. [ILO95] ILOG S.A., 12, Avenue Raspail, BP7, 94251 Gentilly Cedex, France. ILOG SOLVER: Object-oriented constraint programming, 1995. [PG96] G. Pesant and M. Gendreau. A View of Local Search in Constraint Programming. In Principles and Practice of Constraint Programming | CP96: Proceedings of the Second International Conference, volume 1118 of Lecture Notes in Computer Science, pages 353{366. Springer-Verlag, Berlin, 1996. [PGPR96] G. Pesant, M. Gendreau, J.-Y. Potvin, and J.-M. Rousseau. An Exact Constraint Logic Programming Algorithm for the Traveling Salesman Problem with Time Windows. Publication CRT-96-15, Centre de recherche sur les transports, Universite de Montreal, Montreal, 1996. to appear in Transportation Science. [Sol87] M. M. Solomon. Algorithms for the Vehicle Routing and Scheduling Problem with Time Window Constraints. Operations Research, 35:254{265, 1987. [Wal96] M. Wallace. Practical Applications of Constraint Programming. Constraints, 1:139{168, 1996.
This article was processed using the LATEX macro package with LLNCS style