restriction of neighbours instantiation of model variables

Similar documents
Solving small VRPTWs with Constraint Programming Based Column Generation

A Bi-directional Resource-bounded Dynamic Programming Approach for the Traveling Salesman Problem with Time Windows

Routing by Mixed Set Programming

A simulated annealing algorithm for the vehicle routing problem with time windows and synchronization constraints

A Computational Study of Bi-directional Dynamic Programming for the Traveling Salesman Problem with Time Windows

A Tabu Search Heuristic for the Generalized Traveling Salesman Problem

3 No-Wait Job Shops with Variable Processing Times

Telecommunication and Informatics University of North Carolina, Technical University of Gdansk Charlotte, NC 28223, USA

Mathematical Programming Formulations, Constraint Programming

Modelling Combinatorial Problems for CLP(FD+R) Henk Vandecasteele. Department of Computer Science, K. U. Leuven

Chapter S:II. II. Search Space Representation

Theorem 2.9: nearest addition algorithm

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Rearrangement of DNA fragments: a branch-and-cut algorithm Abstract. In this paper we consider a problem that arises in the process of reconstruction

Vehicle Routing Heuristic Methods

A Re-examination of Limited Discrepancy Search

Kalev Kask and Rina Dechter. Department of Information and Computer Science. University of California, Irvine, CA

The Augmented Regret Heuristic for Staff Scheduling

Interior Point Stabilization for Column Generation

Restricted Delivery Problems on a Network. December 17, Abstract

2 The Service Provision Problem The formulation given here can also be found in Tomasgard et al. [6]. That paper also details the background of the mo

Worst-case running time for RANDOMIZED-SELECT

A Meta-heuristic Applied for a Topologic Pickup and Delivery Problem with Time Windows Constraints

PICKUP AND DELIVERY WITH TIME WINDOWS: ALGORITHMS AND TEST CASE GENERATION. School of Computing, National University of Singapore, Singapore

(Refer Slide Time: 01:00)

of optimization problems. In this chapter, it is explained that what network design

Heuristics for the Stochastic Eulerian Tour Problem

Modified Order Crossover (OX) Operator

Lagrangian Relaxation in CP

extended abtract submitted to CMC-95 { International Conference on Multimodal Communication Massimo Fasciano Guy Lapalme

3 INTEGER LINEAR PROGRAMMING

4 Search Problem formulation (23 points)

2WKHUZLVH 6HOHFWFRQIOLFW& LL 6HOHFWFRQVWUDLQW7& WKDWZRXOGOHDGWRUHSDLU& LLL &UHDWHDFKRLFHSRLQWFRUUHVSRQGLQJD GLVMXQFWLRQRI7& DQGLWVQHJDWLRQ*RWR

Example: Map coloring

Comparison of TSP Algorithms

Branch-and-bound: an example

Algebraic Properties of CSP Model Operators? Y.C. Law and J.H.M. Lee. The Chinese University of Hong Kong.

Methods and Models for Combinatorial Optimization Exact methods for the Traveling Salesman Problem

Constraint Satisfaction Problems

NEW METHODS USING COLUMN GENERATION: AN EXAMPLE - ASSIGNING JOBS TO IDENTICAL MACHINES

Constraint Satisfaction Problems. Chapter 6

Two Problems - Two Solutions: One System - ECLiPSe. Mark Wallace and Andre Veron. April 1993

University of Leeds SCHOOL OF COMPUTER STUDIES RESEARCH REPORT SERIES. Report 99.05

Andrew Davenport and Edward Tsang. fdaveat,edwardgessex.ac.uk. mostly soluble problems and regions of overconstrained, mostly insoluble problems as

Integer Programming ISE 418. Lecture 7. Dr. Ted Ralphs

Overview. H. R. Alvarez A., Ph. D.

On the Max Coloring Problem

to the Traveling Salesman Problem 1 Susanne Timsj Applied Optimization and Modeling Group (TOM) Department of Mathematics and Physics

such internal data dependencies can be formally specied. A possible approach to specify

The Global Standard for Mobility (GSM) (see, e.g., [6], [4], [5]) yields a

A Linear-C Implementation of Dijkstra's Algorithm. Chung-Hsing Hsu and Donald Smith and Saul Levy. Department of Computer Science. Rutgers University

Crossword Puzzles as a Constraint Problem

SOLVING TRAVELING SALESMAN PROBLEMS USING HEURISTIC LEARNING APPROACH

Vertex Cover Approximations

Path Consistency Revisited. Moninder Singh. University of Pennsylvania. Philadelphia, PA

CPSC 320 Sample Solution, Playing with Graphs!

Modeling and Solving Location Routing and Scheduling Problems

2 J. Karvo et al. / Blocking of dynamic multicast connections Figure 1. Point to point (top) vs. point to multipoint, or multicast connections (bottom

A Study of Neighborhood Structures for the Multiple Depot Vehicle Scheduling Problem

Outline. Construction Heuristics for CVRP. Outline DMP204 SCHEDULING, TIMETABLING AND ROUTING

Propagate the Right Thing: How Preferences Can Speed-Up Constraint Solving

arxiv: v1 [cs.dm] 6 May 2009

Solving Large Aircraft Landing Problems on Multiple Runways by Applying a Constraint Programming Approach

Some Applications of Graph Bandwidth to Constraint Satisfaction Problems

Solution Methods for the Multi-trip Elementary Shortest Path Problem with Resource Constraints

6 ROUTING PROBLEMS VEHICLE ROUTING PROBLEMS. Vehicle Routing Problem, VRP:

MVE165/MMG630, Applied Optimization Lecture 8 Integer linear programming algorithms. Ann-Brith Strömberg

(Refer Slide Time: 1:27)

EXERCISES SHORTEST PATHS: APPLICATIONS, OPTIMIZATION, VARIATIONS, AND SOLVING THE CONSTRAINED SHORTEST PATH PROBLEM. 1 Applications and Modelling

Computational Complexity CSC Professor: Tom Altman. Capacitated Problem

A tabu search based memetic algorithm for the max-mean dispersion problem

Information Processing Letters Vol. 30, No. 2, pp , January Acad. Andrei Ershov, ed. Partial Evaluation of Pattern Matching in Strings

A heuristic for the periodic rural postman problem

These advantages are exemplied by a scheduling workbench called Oz Scheduler [13]. This workbench makes use of dierent OR algorithms for propagation a

size, runs an existing induction algorithm on the rst subset to obtain a rst set of rules, and then processes each of the remaining data subsets at a

Building Ride-sharing and Routing Engine for Autonomous Vehicles: A State-space-time Network Modeling Approach

A B. A: sigmoid B: EBA (x0=0.03) C: EBA (x0=0.05) U

The Flexible Delivery Problem with Time Windows

arxiv: v1 [math.oc] 9 Jan 2019

Two models of the capacitated vehicle routing problem

Algorithm Design Techniques (III)

We have already seen the transportation problem and the assignment problem. Let us take the transportation problem, first.

Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of C

Crew Scheduling Problem: A Column Generation Approach Improved by a Genetic Algorithm. Santos and Mateus (2007)

MS&E 213 / CS 269O : Chapter 1 Introduction to Introduction to Optimization Theory

February 19, Integer programming. Outline. Problem formulation. Branch-andbound

A generic framework for solving CSPs integrating decomposition methods

Constraint Satisfaction Problems Chapter 3, Section 7 and Chapter 4, Section 4.4 AIMA Slides cstuart Russell and Peter Norvig, 1998 Chapter 3, Section

Constraint Optimisation Problems. Constraint Optimisation. Cost Networks. Branch and Bound. Dynamic Programming

Enumeration of Full Graphs: Onset of the Asymptotic Region. Department of Mathematics. Massachusetts Institute of Technology. Cambridge, MA 02139

Metaheuristic Optimization with Evolver, Genocop and OptQuest

Creating Meaningful Training Data for Dicult Job Shop Scheduling Instances for Ordinal Regression

Bound Consistency for Binary Length-Lex Set Constraints

A Guided Cooperative Search for the Vehicle Routing Problem with Time Windows

Lecture 5 Finding meaningful clusters in data. 5.1 Kleinberg s axiomatic framework for clustering

Localization in Graphs. Richardson, TX Azriel Rosenfeld. Center for Automation Research. College Park, MD

Adaptations of the A* Algorithm for the Computation of Fastest Paths in Deterministic Discrete-Time Dynamic Networks

Improving the Held and Karp Approach with Constraint Programming

Network. Department of Statistics. University of California, Berkeley. January, Abstract

(a) (b) (c) Phase1. Phase2. Assignm ent offfs to scan-paths. Phase3. Determination of. connection-order offfs. Phase4. Im provem entby exchanging FFs

Transcription:

GENIUS-CP: a Generic Single-Vehicle Routing Algorithm Gilles Pesant 1, Michel Gendreau 1;2, Jean-Marc Rousseau 1;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,michelgg@crt.umontreal.ca, jeanmarc@giro.ca 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-dened, 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

c i c cj ck Fig. 1. A generalized insertion tour be a clockwise walk on the circle. When c is inserted between c i and c j, not consecutive, one way the tour may be repaired is by going counterclockwise from c j to c i 's current successor (thus reversing a segment of the tour), then visiting some c k and going counterclockwise to c j 's current successor, to nally visit c k '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-specic 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 satised. 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 identied 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 := <origin-depot,destination-depot>; 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, dene nite domain variables 1 ; : : : ; n, each with domain f1; : : : ; ng, where m is interpreted as the m th city to be inserted. Clearly from that interpretation, 1 ; : : : ; n are constrained to take on dierent

values. Let T m stand for the partial tour after the m th insertion (with T 0 being the initial tour at step 1); insert(t m?1 ; m ; T m ) represents the following constraint optimization problem: given a constraint model for T m, nd the least-cost feasible generalized insertion of m into T m?1, yielding T m. 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 veried. We use the syntax \Var = value" for an antecedent to mean that it is veried 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 8 1 m n m 6= m 0 8 1 m; m 0 n; m < m 0 m = c ) insert(t m?1 ; c; T m ) 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 S s, P s constraint checking restriction of neighbours instantiation of model variables I, J, K solution construction Fig. 3. The interaction between the constraint model and the heuristic The rest of this section focuses on insert(t m?1 ; m ; T m ). 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 denes 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 T m, 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 identied as 0 and m + 1, respectively, with cities 1 to m to appear on the tour. Dene nite domain variables S 0 ; : : : ; S m where S i represents the immediate successor of i on the tour. Similarly, dene variables P 1 ; : : : ; P m+1 for immediate predecessors. Our basic model would be: S i 2 f1; : : : ; m+1g; 8 0 i m (1) P i 2 f0; : : : ; mg; 8 1 i m+1 (2) S i = j ) P j = i 8 0 i m (3) P j = i ) S i = j 8 1 j m+1 (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: S 0 = i { city j must be visited last: P m+1 = j { city ` must immediately follow city k: S k = ` 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 t ij denote the time it takes to go directly from city i to city j 4 and introduce variables T i ; i = 1; : : : ; m+1 representing the time at which we visit city i (T 0 being xed at 0). Constraint (6) enforces consistency between successor variables and visiting time variables. T i 2 f0; : : : ; maxtimeg 8 1 i m+1 (5) S i = j ) T i + t ij T j ; 8 0 i m (6) Now dene set variables B i and A i ; 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 hb i ; A i i forms a partition while the last one links those set variables to the T i 's: A i [ B i = f0; : : : ; m+1g n fig 8 0 i m+1 (7) A i \ B i = ; 8 0 i m+1 (8) T i + t ik > T k ) k 2 B i ^ i 2 A k 8 1 i m+1; 0 k m; i 6= k (9) Stating the earlier precedence constraint now simply amounts to \i 2 B j ". Everything is already in place to express time window constraints in the form of lower and upper bounds a i and b i on the time we visit city i: a i 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 T i 17) ^ :(12 < T i < 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. T i + t ij > T j ) S i 6= j; 8 0 i; j m+1; i 6= j (11) A i \ B j 6= ; ) S i 6= j; 8 0 i m; 1 j m+1; i 6= j (12) T i T i min (T k + t ki ) 8 1 i m+1 (13) k2dom(pi) max (T k? t ik ) 8 0 i m (14) k2dom(si) T i max k2bi (T k + t ki ) 8 1 i m+1 (15) T i min k2ai (T k? t ik ) 8 0 i m (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 T m?1 be the current tour (before the m th insertion). i + (resp. i? ) stands for the immediate successor (resp. predecessor) of city i on T m?1. We dene the following binary constraint on cities of T m?1 : i j states that i appears before j on T m?1. The cost associated with arc (i; j) is denoted c ij. Finally, dene the unary operator closest neighbours() on successor and predecessor variables which when applied to S i (resp. P i ) has a behaviour equivalent to sorting the values in its domain, fj : j 2 dom(s i )g (resp. P i ), in non-decreasing order of c ij (resp. c ji ) 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 (c Ic + c cj + + c JK + + c KI +)? (c II + + c JJ + + c KK +); 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 rened 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(p c ) (19) J = closest neighbours(s c )? (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: P c 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 +. I = i ) V i? `=0 S` = `+ (21) I = i ) K = closest neighbours(p i +) (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)). V j J = j )? `=i+ S` = `+ (23) J = j ) K = closest neighbours(s j )? (24) V k K = k )? V `=j+ S` = `+ (25) n K = k ) `=k+ S` = `+ (26) As we saw, only the S i 's and P j '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(t m?1 ; m ; T m ) nally looks like: subject to Minimize (c Im + c mj + + c JK + + c KI +)? (c II + + c JJ + + c KK +) (1)? (16) (the routing constraints for T m ) (17)? (26) (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-specic constraints will only indirectly aect it by reducing the domain of the appropriate S i and P i 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-specic 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-dened 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 1.15 GENIUS-CP / GENIUS-TW GENIUS-CP / exact CP algorithm 1.1 solution cost ratio 1.05 1 0.95 0.9 0.85 0.8 0.75 0.001 0.01 0.1 1 10 100 CPU time ratio Fig. 5. Comparison of genius-cp with related algorithms on tsp-tw benchmarks We compared genius-cp with an already existing, ecient implementation of genius-tw 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

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 1.25 GENIUS-CP / exact CP algorithm 1.2 solution cost ratio 1.15 1.1 1.05 1 0.95 0.9 0.001 0.01 0.1 1 10 CPU time ratio 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 hc p ; c d i some goods are picked up at c p, to be delivered at c d. Obviously, this imposes a precedence constraint: c p must be visited before c d. For a problem of size n we will therefore have n 2 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 1.4 exact CP algorithm / GENIUS-CP (n=30) exact CP algorithm / GENIUS-CP (n=40) solution cost ratio 1.2 1 0.8 0.6 0.01 0.1 1 10 100 CPU time ratio 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 signicantly 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' Ecole 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 [GHL92] Algorithm for a Vehicle Dispatching Problem. Working paper, 1997. 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] [PG96] ILOG S.A., 12, Avenue Raspail, BP7, 94251 Gentilly Cedex, France. ILOG SOLVER: Object-oriented constraint programming, 1995. 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 [Sol87] transports, Universite de Montreal, Montreal, 1996. to appear in Transportation Science. 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