merging constraint programming techniques with mathematical programming tutorial john hooker...

85
Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Post on 22-Dec-2015

224 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Merging Constraint Programming Techniques with Mathematical

Programming

Tutorial

John HookerCarnegie Mellon University

INFORMS 02

November 2002

Page 2: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

This tutorial will available at

http://ba.gsia.cmu.edu/jnh

g

Page 3: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Why Integrate CP and MP?Search/Inference Duality

DecompositionRelaxation

Putting It TogetherSurveys/Tutorials on Hybrid Methods

Page 4: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

gProgrammingProgrammin

• Constraint programming is related to computer programming.

• Mathematical programming has nothing to do with computer programming.

• “Programming” historically refers to logistics plans (George Dantzig’s first application).

• MP is purely declarative.

Page 5: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Why Integrate CP and MP?

Eventual goal: View CP and MP as special cases of a general method

Page 6: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Motivation to Integrate CP and MP

• Inference + relaxation.

• CP’s inference techniques tend to be effective when constraints contain few variables.

• Misleading to say CP is effective on “highly constrained” problems.

• MP’s relaxation techniques tend to be effective when constraints or objective function contain many variables.

• For example, cost and profit.

Page 7: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

• “Horizontal” + “vertical” structure.

• CP’s idea of global constraint exploits structure within a problem (horizontal structure).

• MP’s focus on special classes of problems is useful for solving relaxations or subproblems (vertical structure).

Motivation to Integrate CP and MP

Page 8: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

• Procedural + declarative.

• Parts of the problem are best expressed in MP’s declarative (solver-independent) manner.

• Other parts benefit from search directions provided by user.

Motivation to Integrate CP and MP

Page 9: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Integration Schemes

Recent work can be broadly seen as using four integrative ideas:

• Double modeling - Use both CP and MP models and exchange information while solving.

• Search-inference duality - View CP and MP methods as special cases of a search/inference duality.

• Decomposition - Decompose problems into a CP part and an MP part using a Benders scheme.

• Relaxation - Exploit the relaxation technology of OR (applies to all of the above).

Page 10: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Double Modeling

• Write part of the problem in CP, part in MP, part in both.

• Exchange information - bounds, infeasibility, etc.

• Dual modeling is a feature of other more specific schemes and will not be considered separately.

Page 11: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Search-Inference Duality

• CP and MP have a fundamental isomorphism: search and inference work together in a duality relationship, such as branch and infer (Bockmayr & Kasper).

• Search (a primal method) examines possible solutions.

• Branching (domain splitting), local search, etc.

• Inference (a dual method) deduces facts from the constraint set.

• Domain reduction (CP), solution of relaxation & cutting planes (MP).

• Both the search and inference phases can combine CP/MP.

Page 12: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Decomposition

• Some problems can be decomposed into a master problem and subproblem.

• Master problem searches over some of the variables.

• For each setting of these variables, subproblem solves the problem over the remaining variables.

• One scheme is a generalized Benders decomposition.

• CP is natural for subproblem, which can be seen as an inference (dual) problem.

Page 13: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxation

• MP relies heavily on relaxations to obtain bounds on the optimal value.

• Continous relaxations, Lagrangean relaxations, etc.

• CP constraints can be associated with relaxations as well as “filtering” algorithms that eliminate infeasible values of variables.

• This can prune the search tree in a branch-and-infer approach.

• Relaxation of subproblem can dramatically improve decomposition if included in master problem.

Page 14: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Search/Inference Duality

Branch and InferDiscrete Lot Sizing

Page 15: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Branch and Infer

}4,,1{},,{different-all

30353subject to585min

321

321

321

jxxxx

xxxxxx

We will illustrate how search and inference may be combined to solve this problem by:

• constraint programming

• integer programming

• a hybrid approach

Page 16: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Solve as a constraint programming problem

}4,,1{},,{different-all

30253485

321

321

321

jxxxx

xxxzxxx

Start with z = .Will decrease as feasible solutions are found.

Search: Domain splittingInference: Domain reduction and constraint propagation

Page 17: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Global Constraints

All-different is a global constraint.

• It represents a set of constraints with special structure.

• This allows a special-purpose inference procedure to be applied.

• The modeler recognizes the structure.

Page 18: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Domain Reduction

Domain reduction is a special type of logical inference method.

• It infers that each variable can take only certain values.

• That is, it reduces the domains of the variables.

• Ideally it maintains hyperarc consistency: every value in any given domain is part of some feasible solution.

Page 19: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Bounds Consistency

Bounds consistency means that the minimum and maximum element of any given domain are part of some feasible solution.

It is weaker than hyperarc consistency but easier to maintain.

Page 20: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Constraint Propagation

• Domains reduced by one constraint are passed to next constraint and reduced further.

• Constraint store (set of domains) allows communication among constraints.

• Keep cycling through domain reduction procedures until fixed point is reached.

• Do this at every node of a branching tree.

Page 21: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Domain reduction for inequalities

• Bounds propagation on 30253485

321

321

xxxzxxx

impliesFor example, 30253 321 xxx

25

812305

2330 312

xxx

So the domain of x2 is reduced to {2,3,4}.

Page 22: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Domain reduction for all-different (e.g., Régin)

• Maintain hyperarc consistency on

},,{different-all 321 xxx

Suppose for example:

1 21 21 2 3 4

Domain of x1

Domain of x2

Domain of x3

Then one can reduce the domains:

1 21 2

3 4

Page 23: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

1. z = 1 2 3 42 3 4

1 2 3 4

3 42 32 3 4

24

43

2

2 34

1 2

41

34

1

infeasible 52 51

2. z =

3. z = 4. z =

7. z = 52

8. z = 52 9. z = 52

Domain of x1 Domain of x2 Domain of x3 D2={2,3} D2={4}

Domain of x2

D2={2} D2={3}

D1={3}D1={2}

infeasible

Page 24: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Solve as an integer programming problem

Search: Branch on variables with fractional values in solution of continuous relaxation.Inference: Solve LP relaxation for lower bound. (Generate cutting planes—not illustrated here).

Page 25: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Rewrite problem using integer programming model:

Let yij be 1 if xi = j, 0 otherwise.

jiy

jy

iy

ijyx

xxx

xxx

ij

iij

jij

jiji

, all},1,0{

4,3,2,1,1

3,2,1,1

3,2,1,

30253subject to

485min

3

1

4

1

4

1

321

321

Page 26: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

31

3/1

49

0001

1000

00 3/2

z

y

y12 = 1y13 = 1

y14 = 1

500010000010

2/12/1

z

y

4.490001

00010010/910/1

z

y

500001001000

2/12/1

z

y

y11 = 1

Infeas.

8.500100

000010

10/1315/2

z

y

Infeas. Infeas.

Infeas.

Infeas. Infeas.

4.500001000100

10/910/1

z

y

z = 51

z = 54

Infeas. Infeas.

Infeas. z = 52

Page 27: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Solve using a hybrid approach

Search:

• Branch on fractional variables in solution of knapsack constraint relaxation 3x1 + 5x2 + 2x3 30.

• Do not relax constraint with yij’s. This makes relaxation too large without much improvement in quality.

• If variables are all integral, branch by splitting domain.

• Use branch and bound.

Inference:

• Use bounds propagation.

• Maintain hyperarc consistency for all-different.

• Get bounds by solving LP relaxation.

Page 28: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

1 2 3 42 3 4

1 2 3 4

24

3

x = (2.7, 4, 1) z = 49.3

x1 2 x1 3

x = (2, 4, 3) z = 54

x2 4x2 3

infeasible z =

3 42 3 4

1 2 3 4

x = (3, 3.8, 1) z = 49.4

3 42 32 3 4

34

1 2

x = (3, 4, 1) z = 51

Page 29: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Discrete Lot Sizing

• Manufacture at most one product each day.

• When manufacturing starts, it may continue several days.

• Switching to another product incurs a cost.

• There is a certain demand for each product on each day.

• Products are stockpiled to meet demand between manufacturing runs.

• Minimize inventory cost + changeover cost.

Page 30: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Discrete lot sizing example

t = 1 2 3 4 5 6 7 8

A B A

yt = A A A B B 0 A 0

job

0 = dummy job

Page 31: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

0 ,}1,0{ , ,

all ,1, all ,, all ,

, all ,, all ,1

, all ,1, all ,

, all ,, all ,s.t.

min

1,

1,

1,

1,

1,

,

itit

ijtitit

iit

itit

jtijt

tiijt

jttiijt

tiit

itit

tiitit

itititti

it ijijtijitit

sxzy

tytiCyxtiy

tiytiyy

tiyztiyz

tiyyztisdxs

qsh

IP model

(Wolsey)

Page 32: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Modeling variable indices with element

To implement variably indexed constant

Replace with z and add constraintwhich sets z = ay

zaay n ),,,(,element 1 ya

ya

To implement variably indexed variable

Replace with z and add constraintwhich posts the constraint z = xy.

There are straightforward filtering algorithms for element.

zxxy n ),,,(,element 1 yx

yx

Page 33: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

tixiytisCx

tisdxstqv

tshu

vu

itt

itit

itititti

yyt

iitit

ttt

tt

, all ,0, all ,0,0

, all , all ,

all ,s.t.

)(min

1,

1

stock level

changeover cost

total inventory + changeover cost

inventory balance

daily production

Hybrid model

Page 34: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

tixiytisCx

tisdxstqv

tshu

vu

itt

itit

itititti

yyt

iitit

ttt

tt

, all ,0, all ,0,0

, all , all ,

all ,s.t.

)(min

1,

1

Generate inequalities to put into relaxation (to be discussed)

Put into relaxation

Apply constraint propagation to everything

To create relaxation:

Page 35: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Solution

Search: Domain splitting, branch and bound using relaxation of selected constraints.

Inference: Domain reduction and constraint propagation.

Characteristics:

• Conditional constraints impose consequent when antecedent becomes true in the course of branching.

• Relaxation is somewhat weaker than in IP because logical constraints are not all relaxed.

• But LP relaxations are much smaller--quadratic rather than cubic size.

• Domain reduction helps prune tree.

Page 36: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Decomposition

Idea Behind Benders DecompositionLogic Circuit Verification

Machine Scheduling

Page 37: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Idea Behind Benders Decomposition “Learn from one’s mistakes.”

• Distinguish primary variables from secondary variables.

• Search over primary variables (master problem).

• For each trial value of primary variables, solve problem over secondary variables (subproblem).

• Can be viewed as solving a subproblem to generate Benders cuts or “nogoods.”

• Add the Benders cut to the master problem to require next solution to be better than last, and re-solve.

• Can also be viewed as projecting problem onto primary variables.

Page 38: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Logic circuit verification(JNH, Yan)

Logic circuits A and B are equivalent when the following circuit is a tautology:

A

B

x1

x2

x3

andinputs

The circuit is a tautology if the output over all 0-1 inputs is 1.

Page 39: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

x1

x2

x3

inputs

and

or

and

not

not

or

or

not

not

and

y1

y3

y2

y4

y5

y6

For instance, check whether this circuit is a tautology:

The subproblem is to find whether the output can be 0 when the input x is fixed to a given value.

But since x determines the output of the circuit, the subproblem is easy: just compute the output.

Page 40: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

x1

x2

x3

and

or

and

not

not

or

or

not

not

and

y1

y3

y2

y4

y5

y6

For example, let x = (1,0,1).

1

1

1

1

1

0

0

0

1

To construct a Benders cut, identify which subsets of the inputs are sufficient to generate an output of 1.

For instance, suffices.)1,0(),( 32 xx

Page 41: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

x1

x2

x3

and

or

and

not

not

or

or

not

not

and

y1

y3

y2

y4

y5

y6

1

1

1

1

1

0

0

0

1

For this, it suffices that y4 = 1 and y5 = 1.

For this, it suffices that y2 = 0.

For this, it suffices that y2 = 0.

For this, it suffices that x2 = 0 and x3 = 1.

So, Benders cut is 32 xx

Page 42: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Now solve the master problem

32 xx

One solution is )0,0,0(),,( 321 xxx

This produces output 0, which shows the circuit is not a tautology.

Note: This is actually a case of classical Benders. The subproblem can be written as an LP (a Horn-SAT problem).

Page 43: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Machine scheduling

Assign each job to one machine so as to process all jobs at minimum cost. Machines run at different speeds and incur different costs per job. Each job has a release date and a due date.

• In this problem, the master problem assigns jobs to machines. The subproblem schedules jobs assigned to each machine.

• Classical mixed integer programming solves the master problem.

• Constraint programming solves the subproblem, a 1-machine scheduling problem with time windows.

• This provides a general framework for combining mixed integer programming and constraint programming.

Page 44: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Modeling resource-constrained scheduling with cumulative

Jobs 1,2,3 consume 3 units of resources.Jobs 4,5 consume 2 units.Maximum L = 7 units of resources available.

Min makespan = 8

L

1

2 3

4

5resources

021 tt 0543 ttt

7),2,2,3,3,3(),5,5,3,3,3(),,...,(cumulative 51 tt

Start times Durations Resource consumption L

Page 45: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

ieixDixt

jSDt

jRt

C

jijjj

jjxj

jj

jjx

j

j

all,1,),|(),|(cumulative

all,

all,s.t.

min

A model for the machine scheduling problem:

Release date for job j

Cost of assigning machine xj to job j

Machine assigned to job j

Start times of jobs assigned to machine i

Start time for job j

Job durationDeadline

Resource consumption = 1 for each

job

Page 46: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

For a given set of assignments the subproblem is the set of 1-machine problems,

x

ieixDixt jijjj all,1,),|(),|(cumulative

Feasibility of each problem is checked by constraint programming.

Page 47: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Suppose there is no feasible schedule for machine . Then jobs cannot all be assigned to machine .

Suppose in fact that some subset of these jobs cannot be assigned to machine . Then we have a Benders cut

}|{ ixj j

)( somefor xJjix ij

)(xJi

ii

i

Page 48: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

KkixJjix

jSDt

jRt

C

kij

jjxj

jj

jjx

j

j

,,1, all ),( somefor

all,

all,s.t.

min

This yields the master problem,

This problem can be written as a mixed 0-1 problem:

Page 49: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

}1,0{

all },{min}{max

,,1 , all ,1)1(

all ,1

all,

all,s.t.

min

ij

jj

jj

ijj

ij

ix

jij

iij

ji

ijijj

jj

ijijij

y

iRSyD

Kkiy

jy

jSyDt

jRt

yC

kj

Valid constraint added to improve performance

Page 50: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Computational Results (Jain & Grossmann)

Computational Results

0.01

0.1

1

10

100

1000

10000

100000

1 2 3 4 5

Problem size

Se

co

nd

s MILP

CP

OPL

Benders

Problem sizes (jobs, machines)1 - (3,2)2 - (7,3)3 - (12,3)4 - (15,5)5 - (20,5)

Each data point represents an average of 2 instances

MILP and CP ran out of memory on 1 of the largest instances

Page 51: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

An Enhancement: Branch and Check(JNH, Thorsteinsson)

• Generate a Benders cut whenever a feasible solution is found in the master problem tree search.

• Keep the cuts (essentially nogoods) in the problem for the remainder of the tree search.

• Solve the master problem only once but continually update it.

• This was applied to the machine scheduling problem described earlier.

x

Page 52: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Computational results (Thorsteinsson)

Problem Benders Branch andcheck

1 16.2 1.2

2 93.7 10.9

3 120.2 1.0

4 37.2 3.0

5 30.2 1.2

Computation times in secondsProblems have 30 jobs, 7 machines.

Page 53: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxation

Relaxing all-differentRelaxing element

Relaxing cycle (TSP)Relaxing cumulative

Relaxing a disjunction of linear systemsLagrangean relaxation

Page 54: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Uses of Relaxation

• Solve a relaxation of the problem restriction at each node of the search tree. This provides a bound for the branch-and-bound process.

• In a decomposition approach, place a relaxation of the subproblem into the master problem.

Page 55: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Obtaining a Relaxation• OR has a well-developed technology for finding polyhedral relaxations for discrete constraints (e.g., cutting planes).

• Relaxations can be developed for global constraints, such as all-different, element, cumulative.

• Disjunctive relaxations are very useful (for disjunctions of linear or nonlinear systems).

Page 56: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxation of alldifferent

nx

xx

j

n

,,1

),,(alldiff 1

Convex hull relaxation, which is the strongest possible linear relaxation (JNH, Williams & Yan):

Jjj

n

jj

nJnJJJx

nnx

|| with ,,1 all),1|(|||

)1(

21

121

For n = 4:

1,,,

3,3,3,3,3,3

6,6,6,6

10

4321

434232413121

432431421321

4321

xxxx

xxxxxxxxxxxx

xxxxxxxxxxxx

xxxx

Page 57: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxation of element

To implement variably indexed constant

Replace with z and add constraint zaay n ),,,(,element 1

Convex hull relaxation of element constraint is simply

}{max}{min jDj

jDj

azayy

Current domain of y

ya

ya

Page 58: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

If 0 xj m0 for each j, there is a simple convex hull relaxation (JNH):

yy Dj

jDj

yj xzmDx 01

Relaxation of element

To implement variably indexed variable

Replace with z and add constraintwhich posts constraint

zxxy n ),,,(,element 1 )( j

Djxz

y

If 0 xj mj for each j, another relaxation is

y

y

y

y

Dj j

Djy

j

j

Dj j

Djy

j

j

m

Dm

x

z

m

Dm

x

1

1

1

1

yx

yx

Page 59: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Example:

xy, where Dy = {1,2,3} and

50

40

30

3

2

1

x

x

x

Replace xy with z and element(y,(x1,x2,x3),z)

Relaxation:

47

120

47

12

47

15

47

20

47

120

47

12

47

15

47

20321321

321321 10

xxxzxxx

xxxzxxx

Page 60: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxation of cycle

Use classical cutting planes for traveling salesman problem:

),,cycle(subject to

min

1 n

jjy

yy

cj

Visit each city exactly once in a single tour

Distance from city j to city yj

yj = city immediately following city j

Can also write:

),,different(-allsubject to

min

1

1

n

jyy

yy

cjj

yj = jth city in tour

Page 61: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxation of cumulative(JNH, Yan)

Where t = (t1,…,tn) are job start times d = (d1,…,dn) are job durations r = (r1,…,rn) are resource consumption rates L is maximum total resource consumption rate a = (a1,…,an) are earliest start times

Lrdt ,,,cumulative

Page 62: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

One can construct a relaxation consisting of the following valid cuts.

If some subset of jobs {j1,…,jk} are identical (same release time a0, duration d0, and resource consumption rate r0), then

021

0 )1(2)1(1

dQPkPaPttkjj

is a valid cut and is facet-defining if there are no deadlines, where

1,0

Q

kP

r

LQ

Page 63: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

The following cut is valid for any subset of jobs {j1,…,jk}

i

k

i

ijj d

Lr

ikttk

121

21)(

1

Where the jobs are ordered by nondecreasing rjdj.

Analogous cuts can be based on deadlines.

Page 64: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Example:Consider problem with following minimum makespan solution (all release times = 0):

Min makespan = 8

L

1

2 3

4

5

time

resources

0

6

2

3

3

5,5,3,3,3s.t.

min

76

54321

74

5432

145

4321

321

54321

jt

ttttt

tttt

tttt

ttt

tttttz

z

Relaxation:Resulting bound:

17.5makespan z

Facet defining

Page 65: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxing Disjunctions of Linear Systems

kk

kbxA

(Element is a special case.)

Convex hull relaxation (Balas).

0

1

all,

k

kk

k

kk

kk

y

y

xx

kybxAk

Additional variables needed.

Can be extended to nonlinear systems (Stubbs & Mehrotra)

Page 66: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

“Big M” relaxation

0

1

all),1(

k

kk

kkk

y

y

kyMbxAk

Where (taking the max in each row):ki

ki

ki

ki

xk

ki bkkbAxAM

}' all,|{maxmax ''

This simplifies for a disjunction of inequalitieswhere 0 xj mj (Beaumont):

kk

K

kbxa

1

K

k k

kK

k k

kK

M

bx

M

a

111

where

jj

kjk maM ,0max

Page 67: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Example:

10

80

machine large

5

50

machine small

0

machine no

x

z

x

zx

Output of machineFixed cost of machine

Convex hull relaxation:

0,

1

105

8050

32

32

32

32

yy

yy

yyx

yyz

x

z

Big-M relaxation:

0,

1

80

50

55

510

1010

32

32

3

2

3

2

32

yy

yy

yz

yz

yx

yx

yyx

x

z

Page 68: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Putting It Together

Elements of a General SchemeProcessing Network Design

Benders Decomposition

Page 69: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Elements of a General Scheme

• Model consists of

• declaration window (variables, initial domains)

• relaxation windows (initialize relaxations & solvers)

• constraint windows (each with its own syntax)

• objective function (optional)

• search window (invokes propagation, branching, relaxation, etc.)

• Basic algorithm searches over problem restrictions, drawing inferences and solving relaxations for each.

Page 70: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Elements of a General Scheme

• Relaxations may include:

• Constraint store (with domains)

• Linear programming relaxation, etc.

• The relaxations link the windows.

• Propagation (e.g., through constraint store).

• Search decisions (e.g., nonintegral solutions of linear relaxation).

Page 71: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Elements of a General Scheme

• Constraints invoke specialized inference and relaxation procedures that exploit their structure. For example, they

• Reduce domains (in-domain constraints added to constraint store).

• Add constraints to original problems (e.g. cutting planes, logical inferences, nogoods)

• Add cutting planes to linear relaxation (e.g., Gomory cuts).

• Add specialized relaxations to linear relaxation (e.g., relaxations for element, cumulative, etc.)

Page 72: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Elements of a General Scheme

• A generic algorithm:

• Process constraints.

• Infer new constraints, reduce domains & propagate, generate relaxations.

• Solve relaxations.

• Check for empty domains, solve LP, etc.

• Continue search (recursively).

• Create new problem restrictions if desired (e.g, new tree branches).

• Select problem restriction to explore next (e.g., backtrack or move deeper in the tree).

Page 73: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Example: Processing Network Design

• Find optimal design of processing network.

• A “superstructure” (largest possible network) is given, but not all processing units are needed.

• Internal units generate negative profit.

• Output units generate positive profit.

• Installation of units incurs fixed costs.

• Objective is to maximize net profit.

Page 74: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Sample Processing Superstructure

Unit 1

Unit 2

Unit 3

Unit 4

Unit 5

Unit 6

Outputs in fixed proportion

Page 75: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Declaration Window

ui [0,ci] flow through unit i

xij [0,cij] flow on arc (i,j)

zi [0,] fixed cost of unit i

yi Di = {true,false} presence or absence of unit i

Page 76: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Objective Function Window

)(max ii

ii zur

Net revenue generated by unit i per unit flow

Page 77: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxation Window

Type: Constraint store, consisting of variable domains.

Objective function: None.

Solver: None.

Page 78: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Relaxation Window

Type: Linear programming.

Objective function: Same as original problem.

Solver: LP solver.

Page 79: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Constraint Window

Type: Linear (in)equalities.

Ax + Bu = b (flow balance equations)

Inference: Bounds consistency maintenance.

Relaxation: Add reduced bounds to constraint store.

Relaxation: Add equations to LP relaxation.

Page 80: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Constraint Window

Type: Disjunction of linear inequalities.

Inference: None.

Relaxation: Add Beaumont’s projected big-M relaxation to LP.

0i

i

ii

iu

ydz

y

Page 81: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Constraint Window

Type: Propositional logic.

Don’t-be-stupid constraints:

Inference: Resolution (add resolvents to constraint set).

Relaxation: Add reduced domains of yi’s to constraint store.

Relaxation (optional): Add 0-1 inequalities representing propositions to LP.

)()()()()(

)(

32613

32562

324542

65312

43321

yyyyyyyyyyyyyyyyyyyyy

yyyyy

Page 82: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Search Window

Procedure BandBsearch(P,R,S,NetBranch) (canned branch & bound search using NetBranch as branching rule)

Page 83: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

User-Defined Window

Procedure NetBranch(P,R,S,i)

Let i be a unit for which ui > 0 and zi < di. If i = 1 then create P’ from P by letting Di = {T} and return P’. If i = 2 then create P’ from P by letting Di = {F} and return P’.

Page 84: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

Benders Decomposition

• Benders is a special case of the general framework.

• The Benders subproblems are problem restrictions over which the search is conducted.

• Benders cuts are generated constraints.

• The Master problem is the relaxation.

• The solution of the relaxation determines which subproblem to solve next.

Page 85: Merging Constraint Programming Techniques with Mathematical Programming Tutorial John Hooker Carnegie Mellon University INFORMS 02 November 2002

• A. Bockmayr and J. Hooker, Constraint programming, in K. Aardal, G. Nemhauser and R. Weismantel, eds., Handbook of Discrete Optimization, North-Holland, to appear. • S. Heipcke, Combined Modelling and Problem Solving in Mathematical Programming and Constraint Programming, PhD thesis, University of Buckingham, 1999.• J. Hooker, Logic, optimization and constraint programming, INFORMS Journal on Computing, most recent issue.• J. Hooker, Logic-Based Methods for Optimization: Combining Optimization and Constraint Satisfaction, Wiley, 2000.• M. Milano, Integration of OR and AI constraint-based techniques for combinatorial optimization, http://www-lia.deis.unibo.it/Staff/MichelaMilano/tutorialIJCAI2001.pdf• H. P. Williams and J. M. Wilson, Connections between integer linear programming and constraint logic programming—An overview and introduction to the cluster of articles, INFORMS Journal on Computing 10 (1998) 261-264.

Surveys/Tutorials on Hybrid Methods