25
Invited Review Constraint satisfaction problems: Algorithms and applications Sally C. Brailsford a , Chris N. Potts b, * , Barbara M. Smith c a School of Management, University of Southampton, Southampton SO17 1BJ, UK b Faculty of Mathematical Studies, University of Southampton, Southampton SO17 1BJ, UK c School of Computer Studies, University of Leeds, Leeds LS2 9JT, UK Received 1 October 1998 Abstract A constraint satisfaction problem (CSP) requires a value, selected from a given finite domain, to be assigned to each variable in the problem, so that all constraints relating the variables are satisfied. Many combinatorial problems in operational research, such as scheduling and timetabling, can be formulated as CSPs. Researchers in artificial intelli- gence (AI) usually adopt a constraint satisfaction approach as their preferred method when tackling such problems. However, constraint satisfaction approaches are not widely known amongst operational researchers. The aim of this paper is to introduce constraint satisfaction to the operational researcher. We start by defining CSPs, and describing the basic techniques for solving them. We then show how various combinatorial optimization problems are solved using a constraint satisfaction approach. Based on computational experience in the literature, constraint satisfaction ap- proaches are compared with well-known operational research (OR) techniques such as integer programming, branch and bound, and simulated annealing. Ó 1999 Elsevier Science B.V. All rights reserved. Keywords: Constraint satisfaction; Combinatorial optimization; Integer programming; Local search 1. Introduction A (finite domain) constraint satisfaction prob- lem (CSP) can be expressed in the following form. Given a set of variables, together with a finite set of possible values that can be assigned to each variable, and a list of constraints, find values of the variables that satisfy every constraint. Many problems in operational research (OR) fall within this general framework. As an example, consider a timetabling problem in which examinations are to be assigned to various periods. In addition to the obvious constraints that any examination involv- ing the same student must be assigned to dierent periods, there may be additional constraints due to room sizes, requirements for students not to have examinations in contiguous periods, etc. Another example occurs in production scheduling. Jobs are to be processed on machines that can handle only one job at a time, so that each job is completed by a given deadline. Further examples arise from the observation that an optimization problem can be European Journal of Operational Research 119 (1999) 557–581 www.elsevier.com/locate/orms * Corresponding author. Tel.: +44 1703 593659; fax: +44 1703 595147 0377-2217/99/$ – see front matter Ó 1999 Elsevier Science B.V. All rights reserved. PII: S 0 3 7 7 - 2 2 1 7 ( 9 8 ) 0 0 3 6 4 - 6

Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

  • Upload
    vanphuc

  • View
    236

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

Invited Review

Constraint satisfaction problems: Algorithms and applications

Sally C. Brailsford a, Chris N. Potts b,*, Barbara M. Smith c

a School of Management, University of Southampton, Southampton SO17 1BJ, UKb Faculty of Mathematical Studies, University of Southampton, Southampton SO17 1BJ, UK

c School of Computer Studies, University of Leeds, Leeds LS2 9JT, UK

Received 1 October 1998

Abstract

A constraint satisfaction problem (CSP) requires a value, selected from a given ®nite domain, to be assigned to each

variable in the problem, so that all constraints relating the variables are satis®ed. Many combinatorial problems in

operational research, such as scheduling and timetabling, can be formulated as CSPs. Researchers in arti®cial intelli-

gence (AI) usually adopt a constraint satisfaction approach as their preferred method when tackling such problems.

However, constraint satisfaction approaches are not widely known amongst operational researchers. The aim of this

paper is to introduce constraint satisfaction to the operational researcher. We start by de®ning CSPs, and describing the

basic techniques for solving them. We then show how various combinatorial optimization problems are solved using a

constraint satisfaction approach. Based on computational experience in the literature, constraint satisfaction ap-

proaches are compared with well-known operational research (OR) techniques such as integer programming, branch

and bound, and simulated annealing. Ó 1999 Elsevier Science B.V. All rights reserved.

Keywords: Constraint satisfaction; Combinatorial optimization; Integer programming; Local search

1. Introduction

A (®nite domain) constraint satisfaction prob-lem (CSP) can be expressed in the following form.Given a set of variables, together with a ®nite setof possible values that can be assigned to eachvariable, and a list of constraints, ®nd values of thevariables that satisfy every constraint. Manyproblems in operational research (OR) fall within

this general framework. As an example, consider atimetabling problem in which examinations are tobe assigned to various periods. In addition to theobvious constraints that any examination involv-ing the same student must be assigned to di�erentperiods, there may be additional constraints due toroom sizes, requirements for students not to haveexaminations in contiguous periods, etc. Anotherexample occurs in production scheduling. Jobs areto be processed on machines that can handle onlyone job at a time, so that each job is completed bya given deadline. Further examples arise from theobservation that an optimization problem can be

European Journal of Operational Research 119 (1999) 557±581www.elsevier.com/locate/orms

* Corresponding author. Tel.: +44 1703 593659; fax: +44

1703 595147

0377-2217/99/$ ± see front matter Ó 1999 Elsevier Science B.V. All rights reserved.

PII: S 0 3 7 7 - 2 2 1 7 ( 9 8 ) 0 0 3 6 4 - 6

Page 2: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

expressed as a sequence of CSPs. By setting athreshold value on the objective function value, an`objective' constraint can be added. Successiveadjustments to the threshold value according towhether there are values of the variables that sat-isfy all constraints, allow the optimal value of theobjective function value to be obtained.

Constraint satisfaction problems are combina-torial in nature. For many categories of CSPs, ane�cient algorithm is unlikely to exist (these prob-lems are NP-complete). Thus, an algorithm thatguarantees to ®nd a solution that satis®es allconstraints, assuming that such a solution exists, isenumerative and therefore has an exponential timerequirement in the worst case. In practice, it maybe su�cient to ®nd a solution at reasonable com-putational expense, that satis®es most of the con-straints, especially if the problem contains `soft'constraints or an `objective' constraint. If all or asmany constraints as possible are satis®ed, we referto the solution as exact; otherwise, it is approxi-mate. (When referring to an optimization problem,an approximate solution is one in which all con-straints are satis®ed, but the optimal value of theobjective function is not necessarily attained.)

A variety of approaches can be used to tackleCSPs. Integer programming techniques (cuttingplane methods and branch and bound) can beapplied to ®nd an exact solution. On the otherhand, there are various approaches that provide anapproximate solution, including local searchmethods (simulated annealing, threshold accept-ing, tabu search and genetic algorithms) and neu-ral networks. However, there is a special-purposetechnique that is widely used for solving CSPs; ituses tree search combined with backtracking andconsistency checking.

By constraint programming (CP), we mean thecomputer implementation of an algorithm forsolving CSPs. It is possible to implement thesealgorithms in a conventional logic programminglanguage such as PROLOG. Unfortunately, thefundamental logical solution procedure that theselanguages use is ine�cient since the constraints arenot actively used in the search for a solution.Therefore, modi®cations of logic programminglanguages have been developed which allow con-straints to be expressed and solved; for example,

CHIP (Constraint Handling in PROLOG). Thisapproach is called constraint logic programming(CLP). However, it is also possible to implementconstraint programming algorithms in general-purpose programming languages, or specialist de-clarative languages. For example, the constraintprogramming tool ILOGLOG SOLVEROLVER is a library ofroutines written in C++. Thus, CLP is just onepossible CP approach, although the terms aresometimes used synonymously (and confusingly)in the literature.

The study of CSPs has largely been undertakenwithin the arti®cial intelligence (AI) community.The pioneering work was undertaken in the early1970s by Montanari (1974), Waltz (1972) andMackworth (1977). In those early days, the powerof available computers was often insu�cient toallow practical problems to be solved. During thelast decade, advances in computer technology havecontributed to a signi®cant growth in research inthe area of constraint satisfaction. Speci®cally,various enhancements to the algorithms for solv-ing CSPs have been incorporated in software sys-tems. Such systems are used to obtain solutions ofmany practical OR (and other) problems. Thelaunch in 1996 of a new journal, Constraints,whose aim is to provide a common forum for themany disciplines interested in constraint satisfac-tion and optimization, indicates the growth of in-terest in this area.

In spite of the widespread use of constraintsatisfaction techniques by researchers in AI, theseapproaches appear to be relatively unknown byoperational researchers. This paper aims to pro-vide a partial remedy by introducing operationalresearchers to the area of ®nite domain constraintsatisfaction. We introduce the main approach(constraint programming) for solving CSPs, anddiscuss modelling considerations. A variety ofapplication areas are given, and a comparison ofconstraint satisfaction techniques with some of theother approaches mentioned above is given.

The remaining sections of this paper are or-ganized as follows. In Section 2, a formal de®ni-tion of CSPs is given. Sections 3 and 4 describetests for consistency checking, and specify thesearch procedures that are used in constraintprogramming algorithms. Sections 5 and 6 are

558 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 3: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

concerned with issues likely to a�ect the time re-quired to solve a CSP; problem formulation, andthe search strategy which is de®ned by variableand value ordering. Section 7 describes variousapplications of constraint satisfaction for solvingcombinatorial optimization problems. An evalua-tion of constraint programming as a technique isgiven in Section 8. Lastly, some concluding re-marks are contained in Section 9.

2. Constraint satisfaction problems

2.1. Problem de®nition

A CSP consists of:· a set of variables X � fx1; . . . ; xng;· for each variable xi, a ®nite set Di of possible

values (its domain);· a set of constraints restricting the values that the

variables can simultaneously take.Note that the values need not be a set of consec-utive integers (although often they are); they neednot even be numeric. For problems with domainsthat are not ®nite, such as problems containingcontinuous variables, the solution techniques thatwe describe in this paper require modi®cation.

A feasible solution to a CSP is an assignment ofa value from its domain to every variable, in such away that every constraint is satis®ed. In this case,the problem is satis®able. On the other hand, ifthere is no assignment of values to variables fromtheir respective domains for which all constraintsare satis®ed, then the problem is unsatis®able. Wemay want to ®nd:· just one solution, with no preference as to which

one;· all solutions;· an optimal, or at least a good, solution, given

some objective function de®ned in terms ofsome or all of the variables.Although algorithms for solving CSPs are

aimed at simply ®nding a feasible solution, theycan be adapted to ®nding an optimal solution. Forinstance, an objective variable can be created torepresent the objective function, an initial solutionis found, and then a new (objective) constraint isintroduced specifying that the value of the objec-

tive variable must be better than in the initial so-lution. This is done repeatedly, tightening theconstraint on the objective variable as each solu-tion is found, until the problem becomes unsatis-®able: the last solution found is then an optimalsolution. The number of iterations, and thereforethe computation time, depends on the quality ofthe initial solution. A common practice is to applya heuristic method for generating an initial solu-tion.

2.2. Constraints

The constraints of a CSP are usually repre-sented by an expression involving the a�ectedvariables, e.g. x1 6� x2, 2x1 � 10x2 � x3 andx1x2 < x3.

Formally, a constraint Cijk... between the vari-ables xi; xj; xk; . . . is any subset of the possiblecombinations of values of xi; xj; xk; . . ., i.e.Cijk... � Di � Dj � Dk � � � �. The subset speci®es thecombinations of values which the constraint al-lows.

For example, if variable x has the domainf1; 2; 3g and variable y has the domain f1; 2g thenany subset of f�1; 1�; �1; 2�; �2; 1�; �2; 2�; �3; 1�;�3; 2�g is a valid constraint between x and y. Theconstraint x � y is equivalent to the subset f(1,1),(2,2)g.

Although the constraints of real problems arenot represented this way in practice, the de®nitiondoes emphasize that constraints need not corres-pond to simple expressions, and, in particular, theyneed not be linear inequalities or equations (al-though they can be).

A constraint can a�ect any number of variablesfrom 1 to n, where n is the number of variables inthe problem. The number of a�ected variables isthe arity of the constraint.

2.3. Example

Cryptarithmetic puzzles, like the following, canbe expressed as CSPs. Each letter in the followingsum stands for a di�erent digit: ®nd their values.

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 559

Page 4: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

D O N A L D

�G E R A L D

±±±±±±±±±±±±±±±±

� R O B E R T

The variables are the letters D, O, N, A, L, G, E,R, B, T and their domains are the set of digitsf0; . . . ; 9g (except that D, G and R cannot be 0).The constraints are:· the ten variables must all be assigned a di�erent

value;· the sum given must work out:

100000 �D� 10000 �O� 1000 �N

� 100 �A� 10 � L�D

� 100000 �G� 10000 � E� 1000 �R

� 100 �A� 10 � L�D

� 100000 �R� 10000 �O� 1000 � B

� 100 � E� 10 �R� T:

There are alternative ways of formulating thisproblem, which are better from the point of viewof ®nding a solution. This will be discussed later.

3. Arc consistency

If all the constraints of a CSP are binary, i.e.they a�ect two variables, then the variables andconstraints can be represented in a constraintgraph: the nodes of the graph represent the vari-ables and there is an edge joining two nodes if andonly if there is a constraint between the corre-sponding variables.

If there is a binary constraint Cij between thevariables xi and xj, then the directed arc �xi; xj� isarc consistent if for every value a 2 Di, there is avalue b 2 Dj such that the assignments xi � a andxj � b satisfy the constraint Cij. Any value a 2 Di

for which this is not true, i.e. no such value b ex-ists, can safely be removed from Di, since it cannotbe part of any consistent solution: removing allsuch values makes the arc �xi; xj� arc consistent.The value b 2 Dj is a supporting value for a 2 Di;therefore, we delete any value a 2 Di unless it hasat least one supporting value in the domain ofevery variable xk for which there is a binary con-straint Cik.

Fig. 1(a) shows the original domains of x and y.In (b), �x; y� has been made arc consistent; in (c),both �x; y� and �y; x� have been made arc consis-tent.

If every arc in a binary CSP is made arc con-sistent, then the whole problem is said to be arcconsistent. Making the problem arc consistent isoften done as a pre-processing stage: reducing thesizes of some domains should make the problemeasier to solve.

A number of algorithms for making a CSP arcconsistent have been proposed: a worst-case timecomplexity O�d2c� can be achieved, where d is themaximum domain size and c the number of binaryconstraints; this can be reduced to O�dc� for manyclasses of constraint (Van Hentenryck et al.,1992a). Generalized arc consistency is an extensionto constraints of higher arity: in general, it is tootime-consuming to achieve generalized arc consis-tency, but for some types of constraint, specializedalgorithms can achieve it reasonably e�ciently.For instance, ReÂgin (1994) presents such an algo-rithm for the `all-di�erent' constraint.

In some simple cases, the result of making aproblem arc consistent is that every value left inthe variable domains is part of a feasible solutionto the CSP. In general this is not true, and a

Fig. 1. Creating arc consistency: (a) Original domains; (b)

Domains when (x, y) arc consistent; (c) Domains when (x, y)

and (y, x) arc consistent.

560 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 5: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

problem which is arc consistent and has at leastone value remaining in every domain may still nothave a feasible solution. Constraint programmingalgorithms usually employ a search procedure thatenumerates assignments of values to variables.When the search ®xes the value of a variable,constraint propagation is applied to restrict thedomains of other variables whose values are notcurrently ®xed.

4. Search algorithms

Most algorithms for solving CSPs search sys-tematically through the possible assignments ofvalues to variables. Such algorithms are guaran-teed to ®nd a solution, if one exists, or to provethat the problem is unsatis®able.

This paper is not intended to provide a com-prehensive survey of constraint satisfaction algo-rithms. However, we present three systematicsearch algorithms. The ®rst, a simple backtrackingalgorithm, is not used in practice, because in mostcases it is very ine�cient, but it is presented herefor comparison with the more sophisticated algo-rithms. The second, forward checking, is proposedby Haralick and Elliott (1980), and the third,MAC (maintaining arc consistency), is developedby Sabin and Freuder (1994).

In all three algorithms, a search tree, similar tothat used in a branch and bound algorithm, can beused to represent the current state of the search.Each node of the tree corresponds to a partialsolution in which the values of some variables aredetermined; these are termed the past variables.The values of future variables remain to be de-cided. The branches of the tree correspond to thedi�erent possible values of some variable. Bychoosing a branch of the tree to search next, thealgorithms instantiate a variable (i.e. they assign avalue to the variable). A deadend is detected if thedomain of a future variable becomes empty. Thedi�erences between the algorithms lie in theirtreatment of the future variables.

In the backtracking algorithm, the currentvariable is assigned a value from its domain. Thisassignment is then checked against the currentpartial solution; if any of the constraints between

this variable and the past variables is violated, theassignment is abandoned and another value for thecurrent variable is chosen. If all values for thecurrent variable have been tried, the algorithmbacktracks to the previous variable and assigns it anew value. If a complete solution is found, i.e. avalue has been assigned to every variable, the al-gorithm terminates if only one solution is required,or continues to ®nd new solutions. If there are nosolutions, the algorithm terminates when all pos-sibilities have been considered.

4.1. Forward checking

The backtracking algorithm only checks theconstraints between the current variable and thepast variables. On the other hand, forwardchecking and MAC are lookahead algorithms thatcheck the constraints between the current and pastvariables and the future variables. In the forwardchecking algorithm, when a value is assigned to thecurrent variable, any value in the domain of afuture variable which con¯icts with this assign-ment is (temporarily) removed from the domain.The advantage of this is that if the domain of afuture variable becomes empty, it is known im-mediately that the current partial solution is in-consistent, and as before, either another value forthe current variable is tried or the algorithmbacktracks to the previous variable; the state of thedomains of future variables, as they were beforethe assignment which led to failure, is restored.With simple backtracking, this failure would nothave been detected until the future variable wasconsidered, and it would then be discovered thatnone of its values are consistent with the currentpartial solution. Forward checking, therefore, al-lows branches of the search tree that will lead tofailure to be pruned earlier than with simplebacktracking.

The forward checking algorithm is illustrated inFig. 2 using the 6-queens problem. The n-queensproblem requires placing n queens on an n� nchessboard in such a way that no queen can takeany other: no two queens can be on the same row,the same column or the same diagonal of theboard. The colours of the squares are irrelevant in

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 561

Page 6: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

this problem, and are not shown. This problem hasreceived a great deal of attention in CSP research,although it is in many ways not representative ofthe kind of problem met in practice. However, ithas the merit that the state of the search at anypoint can be compactly represented, so that theprogress of the search algorithms is easily shown.

As a CSP, this problem can be formulated usingn variables, v1; . . . ; vn, corresponding to the rows ofthe chessboard, and each variable has domainf1; . . . ; ng representing the column in which thequeen is placed.

The full search tree built by forward checkingfor the 6-queens problem is shown in Fig. 2. The

state of the problems after each variable instant-iation is shown using a chessboard representation:a Q on a particular square should be taken asmeaning that the variable for that row has beenassigned the value corresponding to that column.If we start by placing a queen in the ®rst column ofthe ®rst row, then none of the other queens can beplaced in the same column or on the same diago-nal, and the values corresponding to the squaresattacked by this queen can be removed from thedomains of the variables for the queens in rows 2±6. Squares with crosses denote values removedfrom the domains of the variable corresponding tothat row by the current or a previous assignment.

Fig. 2. Search tree for 6-queens using forward checking.

562 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 7: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

If a whole row of crosses occurs, then this meansthat a future variable has no remaining values, andthe algorithm backtracks to a variable which stillhas an untried value. Such a deadend is marked inFig. 2 by a cross below the board where an emptydomain is encountered, and the solution eventuallyfound is marked by a tick.

Note that whenever a new variable is consid-ered, all its remaining values are guaranteed to beconsistent with the past assignments, so thatchecking an assignment for consistency with thecurrent partial solution is no longer necessary.Forward checking does more work than simplebacktracking when each assignment is added tothe current partial solution, in order to reduce thesize of the search tree and thereby reduce theoverall amount of work done.

4.2. MAC

The MAC algorithm does still more work inlooking ahead when an assignment is made.Whenever a new subproblem consisting of the fu-ture variables is created by a variable instantiation,the subproblem is made arc consistent. As well aschecking the values of future variables against thecurrent assignment, as forward checking does,MAC checks the future variables against eachother. Thus, for each future variable, every valuewhich is not supported in the domain of someother future variable is deleted, as well as thosevalues which are not supported by the currentassignment. This removes further values from thedomains of future variables, and as with forwardchecking, the hope is that in doing additional workat the time of the assignment, there will be anoverall saving in computation time.

Fig. 3 shows the e�ect of MAC on 6-queens. Asbefore, squares marked with a cross are thosewhich are eliminated by a previous assignment, orare inconsistent with the current assignment.Numbered squares are those which are eliminatedin the course of making the subproblem arc con-sistent. The numbering indicates a possible orderin which this can be done, since once some valuesare eliminated, this can trigger further deletions.The squares marked ``1'' are those which have no

support once the values inconsistent with the cur-rent assignment are deleted. Squares marked ``2''are those whose only supporting values weresquares marked ``1'' and so on. For instance, in theleftmost board in Fig. 3, forward checking afterthe assignment of v2 � 3 leaves v3 with domainf5,6g; since the value 6 for v4 is compatible withneither of these, it is eliminated. Similarly, v6 � 4 isinconsistent with both of the possible values for v4

remaining after forward checking (even before oneof these values is deleted). Once 2 is the onlypossible value for v4, any value in the domain ofany future variable which is inconsistent with thisis also eliminated and the square is marked ``2''.Finally, v5 has domain f4g, so that the last re-maining value for v6 is eliminated as inconsistentwith v5 � 4, and it has been proved that no solu-tion can be found from the ®rst two assignments.

Note that the chain of inferences leading to anempty domain is not necessarily unique; if the al-gorithm continued, it would eliminate all the re-maining values for all future variables, and thesituation when the domain of some variable ®rstbecomes empty depends on the order in whichvalues are deleted. On the other hand, if the sub-problem can be made arc consistent without de-leting all values, the resulting state does notdepend on the order in which variables are con-sidered.

The rightmost branch in Fig. 3 shows that thereis only one possible solution following the ®rst twoassignments, and again reduces the amount ofsearching along this branch compared with Fig. 2.

The MAC algorithm interleaves constraintpropagation and search. Re-establishing arc con-sistency after each variable instantiation can bedone e�ciently using an incremental arc consis-tency algorithm (Van Hentenryck et al., 1992a),rather than starting from scratch. Sometimes moreelaborate consistency checks are also undertaken.An algorithm of this kind is generally used inconstraint programming software.

5. Formulating problems

Although there may be an obvious way toformulate a problem as a CSP, there is often a

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 563

Page 8: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

choice of more than one formulation, with a littlemore thought.

Since arc consistency is a property associatedwith binary constraints, arc consistency algorithmscan only be used to reduce the domains of vari-ables involved in constraints which either are bi-nary, or have all but two variables instantiated, sothat the constraints have e�ectively become bina-ry. Similarly, forward checking can only use thoseconstraints in which exactly one variable remainsto be instantiated when pruning the domains of the

future variables. For these reasons, high arityconstraints (i.e. constraints involving a largenumber of variables) are undesirable, and should ifpossible be avoided, except in cases where an e�-cient generalized arc consistency algorithm exists.

As an example, the cryptarithmetic puzzle givenin Section 2.3 has a constraint involving all tenvariables, which is not of much use for constraintpropagation. The problem can be reformulated byadding extra variables C1;C2; . . . ;C5; each withdomain f0; 1g, representing the quantities carried

Fig. 3. Search tree for 6-queens using MAC.

564 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 9: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

from one column to the next as the addition isdone. The constraint representing the sum canthen be rewritten as

2 �D � 10 � C1� T;

2 � L� C1 � 10 � C2�R;

2 �A� C2 � 10 � C3� E;

N�R� C3 � 10 � C4� B;

O� E� C4 � 10 � C5�O;

D�G� C5 � R;

where each of these six constraints contains atmost ®ve variables. This considerably speeds upthe process of ®nding a solution.

Another technique is to incorporate redundantconstraints that are implied by those already in theproblem, but having fewer variables. An exampleoccurs in the following problem: a number of carsrequiring di�erent options are to be assembled ona production line. Capacity constraints at theworkstations on the production line prescribeconstraints of the form ``at most r cars out of any sconsecutive cars can require option j''. It is re-quired to sequence the cars so that these con-straints are satis®ed. If too few cars requiring aparticular option are used in one part of the se-quence, than all the remaining cars requiring theoption have to be ®tted into the remainder with theresult that the capacity constraints are violated.Hence, for each option, new constraints can bederived, that any sub-sequence of a certain lengthmust contain at least a speci®ed number of carsrequiring that option. This car sequencing problemis discussed in more detail in Section 7.3.

Another consideration in formulating problemsis that a few variables with large domains are ingeneral preferable to many variables with smalldomains. In the former case, the initial size of thesearch space (i.e. before any pruning is done),which is given by the total number of possible in-stantiations of the variables, is much smaller, andhence usually the problem can be solved morequickly. In particular, zero±one variables are notdesirable and should be avoided if possible.

As an example, the n-queens problem describedearlier can alternatively be formulated using n2

variables xij, where

xij �1 if there is a queen in row i; column j;

0 otherwise:

�The search space in this formulation is much largerthan before: 2n2

, as opposed to nn. In addition, thenew formulation requires a new set of constraintsto represent the fact that there must be exactly onequeen on each row:

Xn

j�1

xij � 1; i � 1; . . . ; n:

Previously, this constraint is satis®ed automati-cally: the domain of each variable represents thesquares on the corresponding row, and in anysolution exactly one value is assigned to the vari-able, i.e. exactly one square in the row is occupied.

Sometimes, a formulation with n variables,each with m values, can be transformed into mvariables each with n values; if m is smaller than nthis reduces the size of the search space. For in-stance, Dincbas et al. (1988a) use a reformulationto reduce the search space size from 472 to 724.

In many problems, if solutions exist, there areclasses of equivalent solutions. For instance, intimetabling problems, it may be possible to inter-change the allocations to the time slots and stillhave a feasible solution; in rostering problems, agroup of sta� may have the same skills and thesame availability, and therefore be interchangeablein the roster. Such symmetries in the problem maycause di�culties for a search algorithm: if theproblem turns out to be unsatis®able, or the al-gorithm is exploring a branch of the search treewhich does not lead to a solution, then all sym-metrical assignments will be explored in turn. Thisis a waste of e�ort, because if one such assignmentis infeasible, then they all are. Such symmetriesshould be avoided, if possible, by including addi-tional constraints in the formulation which allowonly one solution from each class of equivalentsolutions (Puget, 1993).

6. Variable and value ordering heuristics

The order in which variables are considered forinstantiation has a dramatic e�ect on the time

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 565

Page 10: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

taken to solve a CSP, as does the order in whicheach variable's values are considered. There aregeneral principles which are commonly used inselecting the variable and value ordering, and afew speci®c heuristics.

The variable ordering may be either a staticordering, in which the order of the variables isspeci®ed before the search begins, and is notchanged thereafter, or a dynamic ordering, inwhich the choice of next variable to be consideredat any point depends on the current state of thesearch.

Dynamic ordering is not feasible for all treesearch algorithms: for instance, with simple back-tracking there is no extra information availableduring the search that could be used to make adi�erent choice of ordering from the initial or-dering. However, with forward checking andMAC, the current state includes the domains ofthe variables as they have been pruned by thecurrent set of instantiations, and so it is possible tobase the choice of next variable on this informa-tion. A common heuristic is to choose next thevariable with smallest current domain. This is of-ten explained as an implementation of the `fail-®rst' principle (Haralick and Elliott, 1980) or aschoosing the most constrained variable. As a tie-breaker, the most constraining variable can bechosen, for instance the one which constrains thelargest number of future variables (in the absenceof more speci®c information: for instance, onwhich constraints are likely to be di�cult to sat-isfy).

Changing the value ordering produces a rear-rangement of the branches emanating from eachnode of the search tree. This is an advantage if itensures that a branch which leads to a solution issearched earlier than branches which lead todeadends, provided that only one solution is re-quired. If all solutions are required, or if the wholetree has to be searched because there are no solu-tions, then the order in which the branches aresearched is immaterial. A good general principle isto choose a value which seems most likely to leadto a solution (if we can detect such a value), i.e. a`succeed-®rst' principle. There are no cheap, gen-erally applicable, dynamic heuristics implementingthis principle, but in particular cases, problem-

speci®c information may allow a heuristic to bedevised.

7. Applications of constraint satisfaction

In this section, we present several types of ORproblems, and describe how they can be tackledusing constraint satisfaction approaches. Some ofthe studies that we review consider `standard'models for which a variety of approaches have beenadopted in the literature. Other work is of the `casestudy' type for which some of the constraints areusually speci®c to the particular practical problemunder consideration. All of the problems consid-ered are known to be NP-complete (feasibilityproblems) or NP-hard (optimization problems).

7.1. Location

A well-known problem in OR involves the lo-cation of facilities, such as warehouses, to supplydemand to customers. A set f1; . . . ;mg of potentialfacility locations is given, and a ®xed cost fi isincurred if a facility is established at location i(i � 1; . . . ;m). There is a set of customersf1; . . . ; ng, and the cost of supplying customer j(j � 1; . . . ; n) from a facility at location i is cij. Thelocation problem is to choose a subset of the po-tential locations at which to establish facilities, andthen to assign each customer to one of these fa-cilities, so that the total cost is minimized.

A standard zero±one programming formula-tion of this problem is as follows. By de®ningvariables

yi �1 if a facility is established at location i;

0 otherwise;

xij �1 if customer j is supplied from a facility

established at location i;

0 otherwise;

8><>:we obtain the formulation

minimizeXm

i�1

Xn

j�1

cijxij �Xm

i�1

fiyi

566 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 11: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

subject toXm

i�1

xij � 1; j � 1; . . . ; n;

yi ÿ xij P 0; i � 1; . . . ;m; j � 1; . . . ; n;

xij 2 f0; 1g; i � 1; . . . ;m; j � 1; . . . ; n;

yi 2 f0; 1g; i � 1; . . . ;m:

The equality constraints ensure that all customersare supplied from one of the facilities, while theinequality constraints prevent customers from be-ing assigned to any location where a facility is notestablished. In this uncapacitated model, there isno limitation on the number of customers assignedto any facility that is established. Thus, when thefacility locations are chosen, it is straightforwardto assign each customer to a facility with thesmallest supply cost.

Optimal solutions of large instances of the un-capacitated facility location problem can be ob-tained using branch and bound algorithms. Thealgorithm of Erlenkotter (1978) is widely regardedas being one of the most e�cient.

Van Hentenryck and Carillon (1988) evaluate aconstraint satisfaction approach. They use thevariables yi, as de®ned above, zj which is the lo-cation of the facility that supplies customer j,where zj 2 f1; . . . ;mg, and vj which is the supplycost for customer j, where vj 2 fc1j; . . . ; cmjg. Theconstraints are

vj � czj;j; j � 1; . . . ; n;

yi � 0) zj 6� i; i � 1; . . . ;m; j � 1; . . . ; n;Xm

i�1

fiyi �Xn

j�1

vj6C;

where C de®nes an upper bound on the objectivefunction value.

For the ®rst set of constraints, arc consistency isuseful to restrict the domain of vj when the domainof zj changes, and vice versa. Similarly, after ®xingyi � 0, arc consistency in the second constraintallows the value i to be removed from the domainsof z1; . . . ; zn. In an attempt to detect a deadend, theleft-hand side of the third constraint is replaced bya lower bound in which each of the future vari-ables vj is replaced by the smallest value in itsdomain.

The computational evaluation of the constraintsatisfaction approach appears to be strictly limit-ed. Van Hentenryck and Carillon report that aproblem with 21 potential facility locations and 80customers is solved in 90 seconds on a SUN 3/160,and that the computation time is comparable tothat required by a simple branch and bound al-gorithm with rather weak lower bounds. However,we conclude that a more sophisticated branch andbound algorithm such as that of Erlenkotter,where the lower bounds are computed quickly andare very e�ective in restricting the search, is farmore e�cient than this constraint satisfaction ap-proach.

7.2. Scheduling

There are many problems arising in productionindustries that require jobs to be scheduled onmachines. One of the most general and challengingis the job shop scheduling problem in which n jobsare to be scheduled on m machines. Each job j( j � 1; . . . ; n) comprises a set Oj of operations thatmust be executed in a speci®ed order. The machineon which any operation o must be performed is mo

and the corresponding processing time is po. Sincemachine capacity constraints prevent any machinefrom processing more than one operation at thesame time, a sequence of operations must bespeci®ed for each machine. A common objective isto ®nd a schedule that minimizes the makespan,which is the completion time of the last job.

The job shop problem is notoriously di�cult tosolve. For example, there is an instance of Law-rence (1984) with 15 jobs and 10 machines that hasnot been solved with the currently availablebranch and bound algorithms. These algorithmssu�er from the disadvantage that they employlower bounds that are too weak to be e�ective inrestricting the search. Local search heuristics(simulated annealing, tabu search and genetic al-gorithms) are successful in generating near-opti-mal solutions at moderate computational expense.Vaessens et al. (1996) review these heuristics andgive a comparison of computational results.

Constraint satisfaction approaches often usestart time variables so, where so is the time that the

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 567

Page 12: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

processing of operation o starts. Clearly,so 2 f0; 1; . . . ;Cg, where C is an upper boundon the maximum completion time. If o 2 Oj, letpred(o) and succ(o) denote the set of operations onjob j that are predecessors and successors of o,respectively. Then the domain of so can be re-stricted so that so 2 f

Po02pred�o� po0 ; . . . ;C ÿ po ÿP

o02succ�o� po0 g. If O denotes the set of all opera-tions, then the constraints are

so � po6 so0 ; o; o0 2 Oj; o0 2 succ�o�;j � 1; . . . ; n;

so � po6C; o 2 O;

so � po6 so0 or so0 � po0 6 so; o; o0 2 O;

o 6� o0; mo � mo0 :

The ®rst set of constraints ensures that no opera-tion on a job can start before all previous opera-tions on that job are completed. The limit on themaximum completion time is enforced by thesecond set. The third set arises through the ca-pacity of the machines: for two operations o and o0

that require the same machine, either o is pro-cessed before o0, or o0 is processed before o.

Using this formulation, Nuijten and Aarts(1996) derive procedures for establishing arc con-sistency. For any operation o, let esto denote itsearliest start time, which is the smallest value in thedomain of so. Similarly, we de®ne lsto to be thelatest start time, which is the largest value in thedomain of so. From the ®rst constraint, operationo must complete no later than time lsto0 and op-eration o0 can start no earlier than esto � po.Therefore, all values larger than lsto0 ÿ po are re-moved from the domain of so, and all valuessmaller than esto � po are removed from the do-main of so0 . Now suppose that mo � mo0 , so that thethird constraint applies. If o is scheduled before o0,then so6 lsto0 ÿ po; if o is scheduled after o0, thenso P esto0 � po0 . Therefore, if lsto0 ÿ po � 16 esto0

�po0 ÿ 1, then all values in flsto0 ÿ po � 1; . . . ;esto0 � po0 ÿ 1g are deleted from the domain of so.An analogous update is made to the domain of so0 .

In addition to achieving arc consistency, furtherconstraint propagation is often useful. For exam-ple, Thuriot et al. (1994) propose a method fortesting whether one operation must be scheduledbefore another operation that requires the same

machine. Let Ok � O denote the set of operationsthat requires some machine k, and let o; o0 2 Ok. Alower bound on the amount of processing of op-eration o, where o 2 Ok, in any interval �t1; t2� isgiven by

W �o; t1; t2� � min fpo; t2 ÿ t1;

maxfesto � po ÿ t1; 0g;maxft2 ÿ lsto; 0gg:

By considering the amount of processing in theinterval �esto; lsto0 � po0 �, we deduce that if

esto � po � po0 �X

o2Oknfo;o0gW �o; esto; lsto0 � po0 �

> lsto0 � po0 ;

then operation o cannot precede o0. In this case, allvalues larger than lsto ÿ po0 are removed from thedomain of so0 , and all values smaller than esto0 � po0

are removed from the domain of so. Another use-ful constraint propagation device arises from thework of Carlier and Pinson (1989) on the devel-opment of a branch and bound algorithm. Let S bea set of operations requiring the same machine,and let o 62 S be another operation requiring thismachine. If

esto � po �Xo02S

po0 > maxo02Sflsto0 � po0 g;

then o cannot be scheduled before all operations inS. Therefore, all values smaller thanmino02Sfesto0 � po0 g are removed from the domainof so. Symmetric arguments are used to obtain afurther restriction on the domain of so when ocannot be scheduled after all operations in S. Testsof this type are often referred to as edge ®nding.

The usefulness of the constraint propagationmethods described above is dependent on theavailability of an e�cient implementation. Bap-tiste and Le Pape (1995) review the methods andtheir implementations, and conclude that superiorresults are obtained by algorithms that employedge ®nding methods.

Although there are various studies on con-straint satisfaction for the job shop, the mostthorough is undertaken by Nuijten and Aarts(1996). Their algorithm uses edge ®nding con-straint propagation. They obtain lower and upper

568 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 13: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

bounds on the minimum makespan for 40 testproblems of Lawrence (1984) and 3 test problemsof Fisher and Thompson (1963) as follows. To ®nda lower bound, they use a bisection search to ®ndthe smallest value of C for which the problem isunsatis®able, where zero and the sum of all pro-cessing times are initial lower and upper boundson the makespan. The check for unsatis®ability isonly performed through constraint propagation atthe root node, with no variable instantiation. To®nd an upper bound, they perform a series of it-erations with decreasing values of C, where C is setto be the minimum makespan found thus far lesssome decrement, and the decrement decreases insuccessive iterations. They adopt randomization inthe selection of the operation start time to be in-stantiated next, and they restart the search after aspeci®ed number of backtracks. For 31 of the 43test problems, an optimal solution is obtained, andthe lower bound is exact for 23 of these 31 prob-lems. The makespan found by the algorithm de-viates by less than 1% from the best known lowerbound for 35 test problems and by less than 3% for40 test problems. Typical computation times are1500 seconds on a SPARC-station ELC (for eachof 5 independent runs) for problems with 15 jobsand 10 machines, and 2500 seconds for problemswith 15 jobs and 15 machines.

Baptiste and Le Pape (1995) con®rm the e�ec-tiveness of the edge ®nding approach of Nuijtenand Aarts (1996) through an implementation inILOGLOG SCHEDULECHEDULE, an add-on to ILOGLOG SOLVEROLVER.Baptiste et al. (1995) further improve this ap-proach. Speci®cally, they include the randomiza-tion and restart devices of Nuijten and Aarts intheir heuristic algorithm for ®nding an upperbound. Moreover, at a restart, a pair of operationsthat are sequenced in adjacent positions on thesame machine in the previous schedule are con-strained to be sequenced in the same order with acertain probability, where this probability de-creases at each restart. The algorithm is tested on13 of the harder instances that are considered byNuijten and Aarts. The makespan found by thealgorithm deviates by less than 1% from the bestknown lower bound for 11 test problems; devia-tions are 1.54% and 5.84% for the two otherproblems. Typical computation times are 500 sec-

onds on a RS6000 workstation (for each of 5 in-dependent runs) for problems with 15 jobs and 10machines, and 750 seconds for problems with 15jobs and 15 machines. Baptiste et al. also useconstraint satisfaction to obtain optimal solutions,where their heuristic algorithm is employed toobtain an initial upper bound. Results with thisoptimization algorithm are encouraging.

Cheng and Smith (1997) use an alternativeformulation in which variables indicate the orderbetween each pair of operations that require thesame machine. This type of formulation is alsoused in several branch and bound algorithms. Bylimiting the amount of backtracking, they are ableto obtain reasonable quality solutions to a selec-tion of the test problems of Lawrence (1984) andFisher and Thompson (1963) in under 10 secondson a SPARC 10. They do not perform tests withlonger run times, so it is impossible to assesswhether their approach can compete in terms ofsolution quality with that of Baptiste et al. (1995).

7.3. Car sequencing

The car sequencing problem is one of the clas-sical problems in the CSP literature, although it isnot widely known in the OR community. Theproblem arises in the car production industry.After the basic model has been manufactured,various options (for example air-conditioning,metallic paint, ABS brakes, etc.) are added. Dif-ferent versions of the car require di�erent combi-nations of options. The cars are placed on amoving assembly line and pass through a numberof workstation areas, where these options are in-stalled. Depending on the total time the cars spendwithin each workstation area, and the set-up andinstallation times for each option, there are limi-tations on the rates at which the workstations canhandle cars. These are expressed in the form of aratio: ``at most r out of every s consecutive carscan require this option''. Given a set of N cars,each requiring a known set of options, the problemis to sequence the cars on the assembly line so thatno workstation capacity is exceeded.

In reality, many other constraints in addition tothe ratio capacity constraints are imposed. Someof these are described by David and Chew (1995).

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 569

Page 14: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

These include grouping constraints, where it is de-sirable to group together cars requiring a partic-ular process (for example painting, since the sprayguns need to be purged each time the colour ischanged). There may be calendar constraints on thestart and end dates for particular vehicles, andjust-in-time constraints that require production ofeach version of the vehicle to be distributed evenlyover time, to reduce stocks. These clearly make thereal-life problem more complex. Moreover, certainconstraints may con¯ict with each other; thegrouping and capacity constraints may requirethat some cars are simultaneously grouped to-gether and spaced apart! In this case, a distinctionis made between hard constraints (which must notbe violated) and soft constraints, which are desir-able but not essential. A weight is added accordingto the degree of preference for each soft constraint,and the problem then becomes one of optimizingover the preferences.

Consider the basic problem with the simpleratio constraints. If there are m options, let theworkstation capacity for option j be such that atmost rj of every sj cars can require option j(j � 1; . . . ;m). We divide the set of N cars up into nclasses such that all the cars in a given class requirethe same set of options. Let ai denote the numberof cars in class i (i � 1; . . . ; n), where

Pni�1 ai � N .

For each class i and each option j, the data of theproblem can be represented by constants dij, wheredij � 1 if class i needs option j, dij � 0 otherwise.

A zero±one programming formulation of thisproblem is obtained by de®ning variables

xik �1 if the car in position k in the

sequence is in class i;

0 otherwise:

8><>:The constraints of the problem are

XN

k�1

xik � ai; i � 1; . . . ; n;

Xn

i�1

Xsjÿ1

l�0

dijxi;k�l6 rj; j � 1; . . . ;m;

k � 1; . . . ;N ÿ sj � 1;

xik 2 f0; 1g; i � 1; . . . ; n; k � 1; . . . ;N :

The ®rst set of constraints ensures that every carmust appear somewhere in the sequence, and thesecond set prevents the workstation capacitiesfrom being exceeded. We may choose an arbitraryobjective function since in this case we merely wishto ®nd a feasible solution.

Dincbas et al. (1988b) use a constraint satis-faction approach that is based on the followingformulation. As before, the set of N cars is parti-tioned into n classes according to their options,variables yk are used to represent the class of thecar assigned to position k in the sequence, whereyk 2 f1; . . . ; ng, and variables zjk are used to rep-resent whether the car in position k requires optionj, where zjk 2 f0; 1g. The constraints are

yk � i and dij � 1) zjk � 1;

i � 1; . . . ; n; j � 1; . . . ;m; k � 1; . . . ;N ;

jfkjyk � igj � ai; i � 1; . . . ; n;Xsjÿ1

l�0

zj;k�l6 rj; j � 1; . . . ;m;

k � 1; . . . ;N ÿ sj � 1:

The ®rst set of constraints links variables yk andzjk, the second set ensures that exactly ai cars are ofclass i, and the third set comprises the ratio ca-pacity constraints.

An alternative formulation has a variable foreach car, each with domain f1; . . . ;Ng represent-ing that car's position in the sequence; this is akind of `dual' formulation, where the variablesbecome the values and vice versa. It has the dis-advantage that many symmetrical solutions wouldbe possible, and moreover the size of the searchspace would be NN as opposed to nN in the ®rstformulation. However, as pointed out by Smith(1996), this dual formulation highlights the factthat in some CSP formulations the fail-®rst heu-ristic for variable ordering and succeed-®rst heu-ristic for value ordering, which are described inSection 6, may not necessarily be best.

Dincbas et al. (1988b) suggest introducing im-plied constraints, as described in Section 5.Clearly, if too few cars requiring a particular op-tion are placed in one part of the sequence, so thatall the remaining cars requiring that option have tobe placed in the rest of the sequence, it will not be

570 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 15: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

possible to satisfy the capacity constraints. Thus,for each option, we can derive additional con-straints which state that any subsequence of acertain length must contain at least a speci®ednumber of cars requiring that option.

Smith (1996) discusses the choice of heuristicsfor variable and value ordering. She argues that inthis problem, and indeed in any problem whereany possible solution is a permutation of a ®xed setof values, it is better to assign the di�cult cars ®rst.The `di�culty factor' should take into accountboth the option utilization and the total number ofcars requiring that option: a `1 out of 5' optionmay appear harder to satisfy than a `1 out of 2',but if more than half the cars require the latteroption, the problem would of course be infeasible.

Computational results for sets of about 100randomly generated problems with between 5 and200 cars and workstation utilization of 70±80% arereported by Van Hentenryck et al. (1992b). Forless than 50 cars, the problems are solved in a fewseconds on a Sun 3/160; for 100 cars, the solutiontime is less than a minute, but this rises to about5 minutes for 200 cars. The di�erences in utiliza-tion do not greatly a�ect the solution time. They®nd empirically that the average solution time in-creases quadratically with the problem size. Smith(1996) compares di�erent ordering heuristics for20 problems involving 200 cars, and obtains so-lutions in just a few seconds for every feasibleproblem with at least one of the heuristics, al-though there is no overall winner.

David and Chew (1995) deal with a practicalproblem at Renault involving 7500 cars, each ofwhich has 50±100 characteristics, incorporatingboth soft and hard constraints. They adopt a hy-brid approach using simulated annealing in addi-tion to CLP, and obtain good solutions in about2 hours on a Sun Sparcstation II.

ReÂgin and Puget (1997) introduce a generalizedarc consistency algorithm for the sequencing con-straints found in this problem, and report goodresults on a set of di�cult 100-car problems.

7.4. Cutting stock

A cutting stock problem requires material to becut into smaller pieces according to customer re-

quirements, so that the waste is minimized. Anexample of a one-dimensional problem involvesthe cutting of metal rods. Cutting large woodenboards to produce the parts that are required foritems of furniture is an example of a two-dimen-sional problem.

Consider a (two-dimensional) cutting stockproblem in which m di�erent shaped pieces are tobe cut from stock, and the demand for piece i(i � 1; . . . ;m) is di units. There are n di�erent cut-ting patterns, and cutting pattern j (j � 1; . . . ; n)yields qij units of piece i for i � 1; . . . ;m. A total ofp cutting patterns are to be selected. The cost as-sociated with cutting pattern j is cj.

To obtain an integer programming formulationof this problem, we de®ne variables xj to be thenumber of times cutting pattern j is used. Thisyields the formulation

minimizeXn

j�1

cjxj

subject toXn

j�1

qijxj P di; i � 1; . . . ;m;

Xn

j�1

xj � p;

xj 2 f0; 1; . . . ; pg; j � 1; . . . ; n:

Note that this formulation exhibits a close resem-blance with set covering.

For many practical problems, the number ofcutting patterns is too large to allow all possibili-ties to be generated. This di�culty can be over-come by using a column generation approach.Alternatively, there is a wide variety of heuristicsthat can be employed to generate a selection ofcutting patterns. Thus, research has not focused ondeveloping e�cient algorithms for solving theabove set covering formulation. Nevertheless, al-gorithms for solving pure set covering problemsare successful in solving large instances, and sev-eral of these approaches could be adapted for theformulation given above.

Dincbas et al. (1988a) propose a constraintsatisfaction approach. They use variables zk torepresent the cutting pattern for the kth unit of

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 571

Page 16: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

stock (k � 1; . . . ; p), where zk 2 f1; . . . ; ng, vk to bethe cost of cutting the kth unit of stock, wherevk 2 fc1; . . . ; cng, and uik to be the number of unitsof piece i (i � 1; . . . ;m) obtained from cutting thekth unit of stock, where uik 2 fqi1; . . . ; qing. Theconstraints are:

vk � czk ; k � 1; . . . ; p;Xp

k�1

uik P di; i � 1; . . . ;m;

uik � qi;zk ; i � 1; . . . ;m; k � 1; . . . ; p;Xp

k�1

vk 6C;

where C de®nes an upper bound on the objectivefunction value.

Arc consistency in the ®rst set of constraintsrestricts the domain of vk when the domain of zk

changes, and vice versa. A similar observationapplies to uik and zk in the third set. To eliminatemany of the symmetric solutions that result frominterchanging zk and zl for k 6� l, the additionalconstraints vk 6 vk�1 for k � 1; . . . ; p ÿ 1 are im-posed. Another feature of the approach used byDincbas et al. (1988a) is a dichotomous searchprocedure. Rather than instantiating variables inthe normal way, the median value of the currentdomain of some variable is computed, and thenthe search partitions the solutions according towhether the value of the variable is less than orequal to the median, or is greater than the median.

Dincbas et al. (1988a) give computational re-sults for a problem with 72 cutting patterns fromwhich 4 are to be selected, and 6 di�erent shapedpieces are to be cut, thus giving n� 72, p� 4 andm� 6. Under the standard method of instantiatingvariables the problem is solved in 105 seconds on aVAX785. However, use of the dichotomous searchallows the solution time to be reduced to 3 sec-onds.

Proll and Smith (1998) consider a templatedesign problem, which can be viewed as a variantof the cutting stock problem. A template is es-sentially a cutting pattern, and each template has agiven of slots to which any selection of pieces canbe assigned. The objective is to minimize the

number of di�erent templates used, subject toconstraints which limit the amount of under andover production relative to the demand. Proll andSmith propose a CSP formulation which includesvariables yij that represent the number of units ofpiece i in template j. Computational results areprovided for three problems, the largest of whichhas 40 template slots and 50 pieces, where at most4 templates are used.

7.5. Vehicle routing

In the classical vehicle routing problem, thereare n customers to be supplied from a single depot.Customer i (i � 1; . . . ; n) has a requirement of qi,and each vehicle has a capacity Q (although insome variants of the problem capacities vary ac-cording to the vehicle). There is a cost cij and atime tij for travelling between each pair of cus-tomers i and j (i � 0; 1; . . . ; n, j � 0; 1; . . . ; n,i 6� j), where the depot is regarded as customer 0.It is required to ®nd tours for the vehicles, whereeach tour starts and ends at the depot, so that eachcustomer is visited once, the vehicle capacity con-straints are satis®ed, and the total cost is mini-mized. In a common variant of this basic model,there is a time window within which the deliverymust take place.

Branch and bound algorithms for the vehiclerouting problem have met with only limited suc-cess: obtaining optimal solutions for instances withmore than 50 customers often requires excessivecomputation time. However, simulated annealingand tabu search algorithms are successful in gen-erating solutions of very good quality. A review ofthese algorithms is given by Gendreau et al. (1997).

Christodoulou et al. (1994) propose a con-straint satisfaction approach that is based on astandard zero-one programming formulation withvariables

xij �1 if a vehicle travels directly from

customer i to customer j;

0 otherwise:

8>><>>:The constraints are:

572 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 17: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

Xn

j�0

xij � 1; i � 1; . . . ; n;

Xn

i�0

xij � 1; j � 1; . . . ; n;

Xn

j�1

x0j ÿXn

i�1

xi0 � 0;

subtour elimination constraints;

vehicle capacity constraints:

The ®rst two sets of constraints ensure that a ve-hicle travels from and travels to each customer.The third constraint forces all vehicles that leavethe depot to return to the depot. The subtourelimination constraints prevent a solution in whichthe vehicle makes a subtour that does not includethe depot (for example, the subtour de®ned byxij � 1, xjk � 1 and xki � 1 for three distinct cus-tomers i, j and k). For the problem with timewindows, additional variables representing thearrival time at each customer and the corre-sponding departure time are introduced. Each ofthese variables must lie within the time window forthat customer.

After ®xing xij � 1, arc consistency for the im-plied constraints xij � xik 6 1 and xhj � xij6 1,where h 6� i and j 6� k, assigns the values xik � 0and xhj � 0. Similarly, if setting xhk � 1 wouldcreate a subtour or would cause the vehicle ca-pacity constraint to be violated, then the valuexhk � 0 is assigned.

The computational results obtained by Christ-odoulou et al. indicate that, without time win-dows, constraint satisfaction is inferior to otherapproaches. With the introduction of time win-dows, the domains of many of the xij variables arereduced to a single value of zero, and the timerequired to solve the problem is signi®cantly re-duced. The authors claim that problems with up to50 customers can either be solved optimally, or anear-optimal solution is obtained. Since the precisecharacteristics of their test problems are not given,it is di�cult to assess the signi®cance of their re-sults.

Shaw (1998) proposes a hybrid approach forvehicle routing in which local search is combinedwith constraint satisfaction techniques. More pre-

cisely, he considers a large neigbourhood in whichseveral customers are removed from the currentsolution, where a heuristic selects the customersfor removal, and are then reinserted. To ®nd op-timal or good reinsertions, a constraint satisfac-tion approach is used. Computational results for avariety of test problems, some having time win-dows, indicate that this hybrid approach is nearlycompetitive with the best available local searchheuristics that are based on tabu search.

7.6. Timetabling

Timetabling problems arise in many forms,most usually in an educational context, and basi-cally involve resource allocation. As a simple ex-ample of examination timetabling, we have a set ofstudents, a set of examinations, a set of rooms anda set of available time periods, together with a listspecifying the students who take each of the ex-aminations. The objective is to allocate a roomand a time to each examination, subject to variousconstraints. For example, clashes must be avoidedby scheduling every pair of examinations to betaken by the same student at di�erent times. Ca-pacities of the rooms cannot be exceeded. More-over, if two examinations are taken by the same setof students, they must be separated in time, inorder to allow the students su�cient preparationtime in between.

The most basic timetabling problem, which re-quires classes or examinations to be assigned to aminimum number of periods subject to the no-clash constraints, is NP-hard (Karp, 1972); it isreducible to graph colouring, and indeed this is theapproach most frequently used to solve it. Thecomputational study of Johnson et al. (1991)shows that optimal solutions cannot be obtainedusing reasonable computational resources for in-stances of the graph colouring problem with as fewas 90 vertices. Although good quality solutions canbe obtained with simulated annealing at largecomputational expense, heuristics with moremodest computational requirements tend to gen-erate solutions that are far from the optimum. Forpractical timetabling problems, heuristics are onlymoderately successful, because of the di�culty of

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 573

Page 18: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

incorporating all the relevant factors appropriatelyinto a single cost function. Another di�cultycommon to all solution approaches is that prob-lems are often very sensitive to small changes inthe data.

Nuijten et al. (1994) consider the examinationtimetabling problem as a special case of the re-source constrained project scheduling problem.They apply the consistency checking techniquesand randomization procedures that are developedfor the constraint satisfaction approach to jobshop scheduling (see Section 7.2), for a practicalproblem of examination timetabling at theEindhoven University of Technology. The vari-ables are the start times of all the operations, i.e.the examinations. The problem involves separa-tion constraints, which ensure that particularexaminations are su�ciently spaced in time, andno-clash constraints. Since students taking an ex-amination need not all be assigned to the sameroom, the models only consider the overall avail-able capacity of all the examination rooms.

Nuijten et al. (1994) consider two practicalproblems, involving 275 and 651 examinationsrespectively, with varying capacities, separationand no-clash constraints. They use two models: the®rst checks full arc-consistency only, whereas thesecond model transforms the separation con-straints into capacity constraints in order to applyextensive consistency-checking techniques of thetype described in Section 7.2. For each model, theyalso try a modi®ed operation selection procedure,which gives preference to those examinations thatare most di�cult to assign. The second modeloutperforms the ®rst for both problems, but in-terestingly the modi®ed operation selection pro-cedure improves the performance of the ®rst modelbut not that of the second. Nuijten et al. concludethat anything less than full arc consistencychecking degrades performance.

The problem of timetabling school lessons oruniversity lectures is similar to examination time-tabling but more complicated. Practical problemshave many constraints other than the simple no-clash and capacity constraints described above.Lajos (1995) describes the problem of timetablingfor the University of Leeds, where there are 1000so-called `o�erings' (essentially, courses) compris-

ing about 2500 classes per week. Additional con-straints include:· modular option groups, where some clashes are

allowed since students chose a subset of optionsfrom a given set;

· time constraints (e.g., certain classes are con-strained to a particular day because they aretaught by external lecturers);

· smoothness constraints, i.e. reducing the maxi-mum number of classes that can take place si-multaneously in order to smooth out roomutilization;

· spreading constraints, so that classes belongingto the same course are timetabled on separatedays.

This problem is a good candidate for solution byconstraint programming methods. Optimization isnot always required; a feasible timetable is oftenthe main objective, since the qualitative factors canusually be expressed as constraints. Constraintprogramming has the great advantage that its de-clarative nature allows the constraints to be ex-pressed in a natural way, and lookaheadalgorithms are particularly e�ective for this prob-lem in reducing the size of the search space.Nuijten et al. (1994) apply the extensive consis-tency-checking techniques described above for aschool timetabling problem, with good results, andin this case too the modi®ed operation selectionprocedure improves performance even further.Menezes and Barahona (1994) discuss the inter-action between value and variable ordering heu-ristics and lookahead schemes for a timetablingproblem at the New University of Lisbon.

A natural formulation is to represent eachclass as a variable whose domain is the set ofavailable time periods. This is the formulationused by Lajos (1995) but others are possible; forexample, blocking classes together and de®ningthe variables to be the starting time of each block.This approach uses fewer variables, which ingeneral is advantageous, but it greatly increasesthe complexity of the constraints. Lajos uses afail-®rst variable-ordering heuristic, timetablingthe most di�cult o�erings ®rst, with some manualadjustment to deal with infeasibilities, and arandom number generator for value ordering,which eliminates the need for spreading con-

574 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 19: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

straints and greatly improves performance. Theprogram is written in PROLOG and solves typi-cal instances of the problem in about 5 minuteson a Sun 10/20.

7.7. Rostering

Crew rostering problems are well known in OR,and have received considerable attention in the airand rail transport industries. Usually, the generalproblem of allocating sta� to duties is divided intotwo distinct problems: the scheduling stage and therostering stage. The scheduling stage involves de-signing trips (sometimes called tours of duty orrotations) where, in the case of airlines, all thetimetabled ¯ights are grouped into short se-quences, which may occupy one or more days. Forexample, one such trip might be London ! Paris,Paris ! Rome, Rome ! London. This can beformulated as a set-partitioning problem andsolved using a branch and bound algorithm;however, there are many extra constraints gov-erning the feasibility of a trip with respect to legalor trade union requirements on health and safety.Because of the huge problem size, heuristic meth-ods have been developed, although in recent yearsadvances in computer technology have enabledoptimization techniques such as column genera-tion to be applied.

The rostering stage consists of combining thetours of duty into rosters (known in the airlineindustry as lines of work) for the given planningperiod, which is usually one month. These rostersare then allocated to individual sta� members orcrews. In addition to further mandatory con-straints on rosters, for example on the total num-ber of rest days that a crew must have each month,there are also soft constraints expressing thepreferences of the individual crews for the di�erentrosters. Ryan (1992) formulates this problem as ageneralized set-partitioning problem, where thevariables are

xij �1 if crew i is assigned to roster j;

0 otherwise:

�Because of the vast numbers of alternative rosters,real-life problems may potentially have hundreds

of millions of variables. In fact, the main objectivewith practical problems may simply be to ®nd a(legally) feasible roster, but other objective func-tions can be constructed which weight the softconstraints and minimize the deviation from theideal.

Constraint programming has been used for thecrew scheduling problem (see Guerinik and VanCaneghem, 1995) as well as the rostering problem.Caprara et al. (1998) solve a rostering problem forthe Italian Railway Company, essentially adoptinga CLP approach, but combined with an ORmethod, in that their system uses a lower boundobtained by a Lagrangian procedure. The railwaycompany requires rosters in the form of cyclic se-quences of duties representing a monthly workingplan for a set of crews. The number of crews re-quired for each roster is equal to the number ofdays in that roster. The principal objective is to®nd a feasible set of rosters minimizing the totalnumber of crews required. A secondary objective isto minimize the total number of rest days betweentwo duties in the same week, a technically allow-able but undesirable feature in a roster.

The variables in the model of Caprara et al. arethe duties, and the values they take represent theroster in which the duty is placed and its positionin that roster. Additional variables associatedwith duties represented the preceding and suc-ceeding duties and are used to express the con-straints. The rosters are constructed sequentiallyon a succeed-®rst basis. This leads to a partialsolution. The lower bound is then used to evaluatethe number of remaining weeks to an optimalsolution, and in turn this allows the di�culty ofeach constraint to be evaluated. This provides aheuristic for making the remaining assignments ona fail-®rst basis.

Caprara et al. implement their system on aPentium 100 MHz and use the CLP languageECLiPSe; the lower bound procedure is written inC and linked to the CLP program. The computa-tional results contrast the combined approach witha pure OR approach and are comparable in termsof quality and performance, although the CLPmethod is much quicker to develop and can moreeasily be modi®ed to incorporate di�erent con-straints.

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 575

Page 20: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

8. Evaluation of constraint satisfaction

In this section, we evaluate CP as a techniquefor solving CSPs, and compare it with OR meth-ods. Two general comparative papers, writtenfrom an AI standpoint, are those of Van Hen-tenryck (1995) and Simonis (1996). The formerconsiders various techniques for solving combi-natorial search problems, such as branch andbound, branch and cut, and local search, andcompares them with CP. However, this paper isdescriptive rather than analytical. Simonis con-siders di�erent application areas, and attempts toidentify reasons for the failure of CP in someproblems and to determine the critical issues in-volved. He stresses the important di�erence be-tween end-user application development (for aclient's day-to-day operational use) and theoreti-cal studies to test a solver on one particular in-stance of a problem. Simonis concludes that thereare four areas where CP is most successful;scheduling, allocation, transportation and roster-ing. One of the practical reasons for this success isthe ease with which additional problem-speci®cconstraints can be added without any need to re-vise the whole program. Another reason cited isthe incorporation of search strategies based onOR methods!

In many cases, the evidence on which VanHentenryck and Simonis base their conclusions isquite weak. Thus, we provide our own evaluationof CP in the following subsections.

8.1. Criteria for evaluation

There are various reasons why a particulartechnique may be chosen for a problem, including:· ease of implementation;· ¯exibility to handle a variety of constraints that

occur in practical problems;· computation time;· solution quality.

Solution quality becomes important when thetechnique is not guaranteed to ®nd a `best' solu-tion. For optimization problems, solution qualityis the ability to generate a solution with a near-optimal objective function value, whereas for

feasibility problems, it is the ability to ®nd a so-lution in which most of the constraints are satis-®ed.

In practice, the interesting question is, ``whichtechnique should be chosen for a given combina-torial problem?'' Obviously, CP is one possibletechnique. If a best solution is required, then anenumerative method such as branch and bound isalso a candidate. The branch and bound algorithmmay be a general solver for integer or mixed-inte-ger programming problems, or a special-purposealgorithm with bounds and pruning devices de-veloped for a speci®c problem. If the aim is to ®ndan approximate solution, then the competitors ofCP are special-purpose heuristics, and local searchmethods such as simulated annealing, tabu searchand genetic algorithms.

For ease of implementation and ¯exibility, CPscores highly relative to most of the OR techniquesthat are mentioned above. Thus, it remains tocompare CP and OR techniques in terms of com-putation time and solution quality. However, thistask is quite di�cult. The literature contains veryfew direct comparisons of CP with other ap-proaches, and some of those that exist are open tocriticism. For example, the range of instances insome comparisons is too small to form meaningfulconclusions, and the OR techniques with which CPis compared are not always the best available.Many authors simply present solutions of prob-lems using CP, and are naturally mainly interestedin emphasizing the bene®ts of this technique.Moreover, when optimization problems are con-sidered, it is not always clear whether the pre-sented solutions are claimed to be optimal.

8.2. Comparison with integer programming andbranch and bound

For many of the highly structured combinato-rial problems, such as the uncapacitated facilitylocation problem considered in Section 7.1, tightlower bounds (for minimization problems) can begenerated at low computational expense. In suchcases, special-purpose branch and bound algo-rithms are successful in solving quite large probleminstances due to the ability of the lower bounds to

576 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 21: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

prune the search tree, and consequently CP ap-proaches ®nd it di�cult to compete.

On the other hand, some problems such as jobshop scheduling have resisted attempts to developa tight lower bounding scheme. For such prob-lems, we would expect CP approaches to be, at thevery least, competitive with branch and bound.Results of Baptiste et al. (1995) for optimal solu-tions of job shop problems con®rm the competi-tiveness of a CP approach.

Puget (1995) suggests that a critical factor in thesuccess of a CP approach is the amount of prop-agation that the constraints permit; if the nature ofa problem is such that a variable instantiationtriggers the pruning of many values from the do-mains of other variables, then CP is likely to besuccessful. He argues that scheduling and timeta-bling problems are good candidates for CP.

As a general problem solver, CP should becompared with integer programming (IP) or mixedinteger programming (MIP). IP and MIP ap-proaches su�er from the disadvantage that theconstraints must be linear, whereas the non-lin-earities that are permitted in a CSP sometimesallow the variables to be chosen in a way that al-lows a more structured search for an optimal so-lution. Van Hentenryck and Carillon (1988)emphasize the potential for CP in problems with arelatively small number of `key' variables that ef-fectively specify the solution (such as the variablesyi in the uncapacitated facility location problemdescribed in Section 7.1). Instantiation of a keyvariable increases the potential for constraintpropagation, whereas in an IP model the keyvariables are swamped numerically by the othervariables. Little and Darby-Dowman (1995) em-phasize the di�culty of comparisons when theperformance of both techniques is highly variableand sensitive to data or problem size, but arguethat an advantage of CP is that problem-speci®cfeatures can be easily represented in a high-levellanguage, whereas in IP they often hugely increasethe size of the model.

The progressive party problem (Smith et al.,1996), where guests are to be assigned to groupsfor n successive time periods in such a way that nopair of people ever meets more than once, is aproblem where CP succeeds very easily in ®nding a

(feasible) solution, whereas IP does not. For thisproblem, capacity constraints on the size of thegroups are very e�ective in propagating the resultsof assignments to the domains of other variables.Another reason for the lack of success of IP is thelarge number of `all-di�erent' constraints, leadingto enormous formulations with many zero-onevariables, whereas these constraints can be verycompactly expressed using a CSP formulation.However, this problem is primarily of theoreticalinterest as a benchmark problem for CP solvers,and has few practical applications!

Rodosek et al. (to appear) present some em-pirical results for ®ve speci®c problems (the pro-gressive party problem, a generalized assignmentproblem, a packing problem, a set-partitioningproblem, and a logical problem to show that it isnot possible to put 10 pigeons into 9 pigeon-holes).They use the CP solver ECLiPSe and the MIPsolver CPLEX. All of these problems involve all-di�erent constraints and capacity constraints; theresults show that MIP tends to outperform CP ifthe capacity limits are all equal, whereas CP isbetter if the capacities are di�erent (as in the pro-gressive party problem). Rodosek et al. present ahybrid approach, integrating CP and MIP, whichgives better results than either individual method.However, it is not clear to what extent generalconclusions can be drawn from this limited study.

Darby-Dowman and Little (1998) compare theperformance of IP and CP on four problems; agolf scheduling problem that is similar to theprogressive party problem, a crew schedulingproblem (see Section 7.7), a production schedulingproblem that requires jobs to be assigned to un-related parallel machines, and an integer trans-portation problem in which the total supply ateach source must be sent to a single destination.They conclude that, in general, CP performs betteron problems that are highly constrained andtherefore have a small search space, whereas IP issuperior in problems with a large search space andno strong constraints. IP has the advantage ofbeing able to detect global infeasibility. Darby-Dowman and Little argue that the linear relax-ation is often of little help in zero±one problems,unless the problem has a particular structure, suchas a coe�cient matrix that is almost totally uni-

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 577

Page 22: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

modular. In IP, model size is a key factor in per-formance, whereas in CP, the size of the searchspace is more important. The performance of CPcan be greatly improved by the introduction ofadditional constraints (for example, symmetryconstraints) and by the use of problem-speci®cinformation. However, this is not alwaysstraightforward in IP. Darby-Dowman and Littlealso discuss the potential for hybrid methods, butpoint out the di�culties of integrating two meth-ods which use incompatible model and tree searchstructures.

The problem of compatibility is further dis-cussed by Bockmayr and Kasper (1998), whopropose a common framework for CP and IPcalled branch and infer. This involves extending IPby the introduction of symbolic constraints. Theirhybrid method is superior to IP for instances of theuncapacitated facility location problem (see Sec-tion 7.1).

Proll and Smith (1998) present a comparison ofIP and CP for a template design problem whichhas similarities to the cutting stock problem (seeSection 7.4). Column generation, which is gener-ally the method of choice for solving cutting stockproblems, is not actually used in this study, al-though the IP approach bears a slight resemblanceto it, since a population of potential templates(cutting patterns) is generated sequentially. Cer-tainly, the IP solutions are not of such a highquality as the CP solutions. This problem clearlyillustrates the advantages of being able to use non-linear constraints, and incorporate `human prob-lem-solving ingenuity' in the solution strategy.However, for large instances, sophisticated re®ne-ments of the CP approach are required. The factthat CP solutions can easily be improved stillfurther by employing a simple goal programmingmodel to optimize the actual production quantitiesusing speci®ed templates, supports the hypothesisthat using OR methods in conjunction with CPmay well represent the most fruitful approach.

The car sequencing problem does not appear tohave received much attention in the OR commu-nity. It is clear that the naive use of integer pro-gramming is unsuccessful in solving it. Forexample, the IP formulation of Section 7.3 doesnot succeed in ®nding a solution for a small test

instance of the problem (with 25 cars, 5 optionsand 12 classes, giving 300 zero±one variables) inless than 5 minutes (on an IBM 486 DX PC), evenafter the addition of cuts based on the problemdata. However, special-purpose algorithms havebeen developed for other sequencing problems forwhich IP is equally unsuccessful, and for this rea-son direct comparisons between IP techniques andCP may not be fair. Heuristic methods seem to berequired for practical instances of the problem, butthe pure problem may turn out to be amenable toan analytic approach.

Several of the papers mentioned here appear ina recent issue of the INFORMS Journal on Com-puting (10 (3), (1998)), which contains a cluster ofarticles on connections between the IP and CPapproaches. These articles are introduced by Wil-liams and Wilson (1998), who also present a briefsummary of the two approaches and the linksbetween them.

8.3. Comparison with local search heuristics

In its pure form, the CP approach is intended tosearch for a `best' solution. To be used as a methodfor ®nding an approximate solution, modi®cationsare necessary to ensure that the solution space issearched adequately. For example, the random-ization and restart devices proposed by Nuijtenand Aarts (1996) are introduced so that the searchis diversi®ed. It is unlikely that pure CP cancompete with state-of-the-art implementations oflocal search methods.

Simulated annealing is compared with CP byCrabtree (1995) for a resource constrained sched-uling problem, and by David and Chew (1995) forthe car sequencing problem. In general, simulatedannealing might intuitively be expected to performbetter for problems with many solutions, whereasCP would be preferred for tightly constrainedproblems. However, Crabtree ®nds that in practicethe reverse is true for the precedence constraintson the tasks; this suggests that further research isrequired. David and Chew describe some advan-tages of simulated annealing over CP; simulatedannealing can deal with very large practicalproblems, it is possible to control the computation

578 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 23: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

time, it can handle `soft' constraints, and it worksblindly (heuristics for variable and value selectiondo not have to be found).

Vaessens et al. (1996) compare a variety of localsearch heuristics, and the CP approach of Nuijtenand Aarts, for job shop scheduling. Since manycomputational studies are performed using thesame set of test problems, solutions can be com-pared in terms of quality. Moreover, by applyingnormalizing coe�cients to account for the speedsof the computers on which the tests are performed,the relative computation times for the di�erentmethods can be estimated. Clever implementationsof tabu search, such as that of Nowicki andSmutnicki (1996), tend to generate the best qualitysolutions with relatively small computation times.However, the CP approach of Nuijten and Aartsgives better quality solutions than most of thesimulated annealing methods and all of the geneticalgorithms, although its computation times arelarger. The improved CP approach of Baptiste etal. (1995) appears to be at least as good in terms ofsolution quality as all simulated annealing, tabusearch and genetic algorithms, with the exceptionof Nowicki and Smutnicki's method, although CPis computationally expensive.

9. Concluding remarks

Our discussion in Section 8 shows that CPcompares favourably with OR techniques in termsof ease of implementation and the ¯exibility to addnew constraints. Its performance with respect tosolution quality and computation time tends to beproblem dependent. For a CP approach to workwell, there should be a signi®cant amount of con-straint propagation: each variable that is instanti-ated should allow a reduction in the domains ofother variables.

CP and branch and bound are both tree searchtechniques. While CP relies mainly on constraintpropagation to restrict the size of the search tree,the e�ciency of a branch and bound is highlydependent on the bounding scheme that is used. Ifthe lower bounds (for minimization problems) re-quire a signi®cant amount of computation timeand are not strong enough to allow very much

pruning of the branch and bound search tree, thenit is likely that CP would be more e�cient. On theother hand, the availability of tight lower bounds,especially if their computational requirements arelow, would suggest that a branch and bound al-gorithm is likely to outperform CP.

CP is unlikely to be competitive with the bestlocal search methods, such as simulated annealing,tabu search and genetic algorithms, if it is used in apure form, since large regions of the solution spaceare often unexplored. However, if ideas from localsearch are incorporated, such as the randomiza-tion and restart procedures of Nuijten and Aarts(1996), then CP becomes a serious competitor tolocal search for obtaining approximate solutions.

Although CP is still relatively in its infancy,whereas OR methods are often well developed andsophisticated, there are problems for which CP iscompetitive. Since further improvements to CPmethodology are anticipated, we feel that the op-erational researcher should be aware of CP as atechnique for tackling combinatorial optimizationproblems. Moreover, there is an increasing beliefthat hybrid methods often perform better thanpure methods. A closer collaboration between thedomains of AI and OR would bene®t the devel-opment of algorithms in both disciplines. For ex-ample, CP algorithms could be improved byincorporating bounding schemes that are obtainedusing OR techniques. Similarly, if CP is to be usedas a technique for obtaining approximate solu-tions, then ideas from local search should be in-corporated. On the other hand, branch and boundalgorithms may bene®t from constraint propaga-tion techniques to help prune the search trees, and,as observed by Shaw (1998), constraint satisfactionapproaches can be employed to help search largeneighbourhoods in local search heuristics.

Acknowledgements

The authors are grateful to Rachel Bothamleyfor collecting several of the references used in thispaper, and to Philippe Baptiste for some com-ments on the performance of job shop schedulingalgorithms.

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 579

Page 24: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

References

Baptiste, P., Le Pape, C., 1995. A theoretical and experimental

comparison of constraint propagation techniques for dis-

junctive scheduling. In: Mellish, C.S. (Ed.), Proceedings of

The 14th International Joint Conference on Arti®cial

Intelligence. Morgan Kaufmann, Palo Alto, CA, pp. 600±

606.

Baptiste, P., Le Pape, C., Nuijten, W.P.M., 1995. Constraint-

based optimization and approximation for job shop sched-

uling. In: Sadeh, N. (Ed.), Proceedings of The AAAI-

SIGMAN Workshop on Intelligent Manufacturing Systems

(IJCAI-95), http://www.ilog.com.sg/html/products/optimi-

zation/research_papers.htm.

Bockmayr, A., Kasper, T., 1998. Branch and infer: A unifying

framework for integer and ®nite domain constraint pro-

gramming. INFORMS Journal on Computing 10, 287±300.

Carlier, J., Pinson, E., 1989. An algorithm for solving the job-

shop problem. Management Science 35, 164±176.

Caprara, A., Focacci, F., Lamma, E., Mello, P., Milano, M.,

Toth, P., Vigo, D., 1998. Integrating constraint logic

programming and operations research techniques for the

crew rostering problem. Software ± Practice & Experience

28, 49±76.

Cheng, C.-C., Smith, S.F., 1997. Applying constraint satisfac-

tion techniques to job shop scheduling. Annals of Opera-

tions Research 70, 327±357.

Christodoulou, N., Wallace, M., Kuchenho�, V., 1994. Con-

straint logic programming and its application to ¯eet

scheduling. Information and Decision Technologies 19,

135±144.

Crabtree, I.B., 1995. Resource scheduling ± comparing simu-

lated annealing with constraint programming. BT Technol-

ogy Journal 13, 121±127.

Darby-Dowman, K., Little, J., 1998. Properties of some

combinatorial optimization problems and their e�ect on

the performance of integer programming and constraint

logic programming. INFORMS Journal on Computing 10,

276±286.

David, J.-M., Chew, T.L., 1995. Constraint-based applications

in production planning: examples from the automotive

industry. In: Proceedings of Practical Applications of

Constraint Technology (PACT'95). Practical Applications

Company, Blackpool, UK, pp. 37±51.

Dincbas, M., Simonis, H., Van Hentenryck, P., 1988a. Solving

a cutting-stock problem in constraint logic programming.

In: Kowalski, R.A., Bowen, K.A. (Eds.), Logic Program-

ming. MIT Press, Cambridge, MA, pp. 42±58.

Dincbas, M., Simonis, H., Van Hentenryck, P., 1988b. Solving

the car-sequencing problem in constraint logic program-

ming. In: Kodrato�, Y. (Ed.), Proceedings of European

Conference on Arti®cial Intelligence (ECAI-88), Pitman,

London, pp. 290±295.

Erlenkotter, D., 1978. A dual-based procedure for uncapaci-

tated facility location. Operations Research 26, 992±1009.

Fisher, H., Thompson, G.L., 1963. Probabilistic learning

combinations of local job-shop scheduling rules. In: Muth,

J.F., Thompson, G.L. (Eds.), Industrial Scheduling. Pren-

tice-Hall, Englewood Cli�s, NJ, pp. 225±251.

Gendreau, M., Laporte, G., Potvin, J.-Y., 1997. Vehicle

routing: modern heuristics. In: Aarts, E.H.L., Lenstra,

J.K. (Eds.), Local Search in Combinatorial Optimization.

Wiley, Chichester, UK, pp. 311±336.

Guerinik, N., Van Caneghem, M., 1995. Solving crew sched-

uling problems by constraint programming. In: Montanari,

U., Rossi, F. (Eds.), Proceedings of The First Conference of

Principles & Practice of CP, Lecture Notes in Computer

Science, vol. 976. Springer, Berlin, pp. 481±498.

Haralick, R., Elliott, G., 1980. Increasing tree search e�ciency

for constraint satisfaction problems. Arti®cial Intelligence

14, 263±313.

Johnson, D.S., Aragon, C.R., McGeoch, L.A., Schevon, C.,

1991. Optimization by simulated annealing: An experimen-

tal evaluation; Part II, graph coloring and number parti-

tioning. Operations Research 39, 378±406.

Karp, R.M., 1972. Reducibility among combinatorial prob-

lems. In: Miller, R.E., Thatcher, J.W. (Eds.), Complexity of

Computer Computations. Plenum Press, New York, pp. 85±

103.

Lajos, G., 1995. Complete university modular timetabling using

constraint logic programming. In: Burke, E., Ross, P.

(Eds.), First International Conference on Practice and

Theory of Automated Timetabling, Lecture Notes in

Computer Science, vol. 1153. Springer, Berlin, pp. 146±161.

Lawrence, S., 1984. Resource constrained scheduling: An

experimental investigation of heuristic scheduling tech-

niques. Graduate School of Industrial Administration,

Carnegie-Mellon University, Pittsburgh, PA.

Little, J., Darby-Dowman, K., 1995. The signi®cance of

constraint logic programming to operational research. In:

Lawrence, M., Wilsdon, C. (Eds.), Operational Research

Society Tutorial Papers 1995. Operational Research Society,

Birmingham, UK, pp. 20±45.

Mackworth, A.K., 1977. Consistency in networks of relations.

Arti®cial Intelligence 8, 99±118.

Menezes, F., Barahona, P., 1994. Heuristics and look-ahead

integration to solve constraint satisfaction problems e�-

ciently. Annals of Operations Research 50, 411±426.

Montanari, U., 1974. Networks of constraints: fundamental

properties and applications to picture processing. Informa-

tion Science 7, 95±132.

Nowicki, E., Smutnicki, C., 1996. A fast taboo search algorithm

for the job shop problem. Management Science 42, 797±813.

Nuijten, W.P.M., Aarts, E.H.L., 1996. A computational study

of constraint satisfaction for multiple capacitated job shop

scheduling. European Journal of Operational Research 90,

269±284.

Nuitjen, W.P.M., Gunnen, G.M., Aarts, E.H.L., Dignum,

F.P.M., 1994. Examination time tabling: A case study for

constraint satisfaction. In: Cohn, A.G. (Ed.), Proceedings of

Workshop on Constraint Satisfaction Issues Raised by

Practical Applications (ICAI'94), pp. 11±19.

Proll, L., Smith, B.M., 1998. Integer linear programming

and constraint programming approaches to a template

580 S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581

Page 25: Constraint satisfaction problems: Algorithms and applicationscepac.cheme.cmu.edu/pasilectures/henning/EJOR-BrailsfordSmith.pdf · Constraint satisfaction problems: Algorithms and

design problem. INFORMS Journal on Computing 10,

265±275.

Puget, J.-F., 1993. On the satis®ability of symmetrical con-

strained satisfaction problems. In: Komorowski, J., Ras,

Z.W. (Eds.), Proceedings of Seventh International Sympo-

sium on Methodologies for Intelligent Systems (ISMIS'93),

Lecture Notes in Computer Science/Lecture Notes in Arti-

®cial Intelligence, vol. 689. Springer, Berlin, pp. 350±361.

Puget, J.-F., 1995. A comparison between constraint program-

ming and integer programming. In: Conference on Applied

Mathematical Programming and Modelling (APMOD95),

Brunel University.

R�egin, J.-C., 1994. A ®ltering algorithm for constraints of

di�erence in CSPs. In: Proceedings of Twelfth National

Conference on Arti®cial Intelligence 1 (AAAI-94). MIT

Press, Cambridge, MA, pp. 362±367.

R�egin, J.-C., Puget, J.-F., 1997. A ®ltering algorithm for global

sequencing constraints. In: Smolka, G. (Ed.), Principles and

Practice of Constraint Programming ± CP97, Lecture

Notes in Computer Science, vol. 1330. Springer, Berlin,

pp. 32±46.

Rodosek, R., Wallace, M.G., Hajian, M.T., to appear. A new

approach to integrate mixed integer programming with

CLP. Annals of Operations Research.

Ryan, D., 1992. Solution of massive generalized set partitioning

problems in aircrew rostering. Journal of the Operational

Research Society 43, 459±467.

Sabin, D., Freuder, E.C., 1994. Contradicting conventional

wisdom in constraint satisfaction. In: Cohn, A.G. (Ed.),

Proceedings of European Conference on Arti®cial Intelli-

gence (ECAI-94). Wiley, Chichester, UK, pp. 125±129.

Shaw, P., 1998. Using constraint programming and local search

methods to solve vehicle routing problems. In: Maher, M.,

Puget, J.-F. (Eds.), Principles and Practice of Constraint

Programming ± CP98, Lecture Notes in Computer Science,

vol. 1520. Springer, Berlin, pp. 417±431.

Simonis, H., 1996. A problem classi®cation scheme for ®nite-

domain constraint solving (tutorial paper given at

PACT'96). In: Second International Conference on the

Practical Applications of Constraint Technology.

Smith, B.M., 1996. Succeed-®rst or fail-®rst: A case study in

variable and value ordering heuristics. In: Proceedings of

The Third International Conference on the Practical

Applications of Constraint Technology (PACT'97). Practi-

cal Applications Company, Blackpool, UK, pp. 321±330.

Smith, B.M., Brailsford, S.C., Hubbard, P.M., Williams, H.P.,

1996. The progressive party problem: Integer linear pro-

gramming and constraint programming compared. Con-

straints 1, 119±136.

Thuriot, C., Ershler, J., Lopez, P., 1994. Decision approach to

workload distribution. Production Planning & Control 5,

533±542.

Van Hentenryck, P., 1995. Constraint solving for combinatorial

search problems: A tutorial. In: Montanari, U., Rossi, F.

(Eds.), Proceedings of The First Conference of Principles &

Practice of CP, Lecture Notes in Computer Science, vol.

976. Springer, Berlin, pp. 564±587.

Van Hentenryck, P., Carillon, J.-P., 1988. Generality versus

speci®city: An experience with AI and OR techniques. In:

Proceedings of The Seventh National Conference on Arti-

®cial Intelligence 2 (AAAI 88). AAAI Press/MIT Press,

Cambridge, MA, pp. 660±664.

Van Hentenryck, P., Deville, Y., Teng, T.-M., 1992a. A generic

arc-consistency algorithm and its specializations. Arti®cial

Intelligence 57, 291±321.

Van Hentenryck, P., Simonis, H., Dincbas, M., 1992b.

Constraint satisfaction using constraint logic programming.

Arti®cial Intelligence 58, 113±159.

Vaessens, R.J.M., Aarts, E.H.L., Lenstra, J.K., 1996. Job shop

scheduling by local search. INFORMS Journal on Com-

puting 8, 302±317.

Waltz, D., 1972. Generating semantic descriptions from draw-

ings of scenes with shadows. Technical Report AI271. MIT,

MA.

Williams, H.P., Wilson, J.M., 1998. Connections between

integer linear programming and constraint logic program-

ming ± an overview and introduction to the cluster of

articles. INFORMS Journal on Computing 10, 261±264.

S.C. Brailsford et al. / European Journal of Operational Research 119 (1999) 557±581 581