Professional Documents
Culture Documents
Tutorial: Operations Research and Constraint Programming: John Hooker Carnegie Mellon University
Tutorial: Operations Research and Constraint Programming: John Hooker Carnegie Mellon University
Tutorial: Operations Research and Constraint Programming: John Hooker Carnegie Mellon University
Constraint Programming
John Hooker
Carnegie Mellon University
June 2008
Complementary strengths
Computational advantages
Outline of the Tutorial
• CP:
– Inference methods Let’s bring them
– Modeling together!
– Exploits local structure
• OR:
– Relaxation methods
– Duality theory
– Exploits global structure
Problem Speedup
Problem Speedup
Problem Speedup
Problem Speedup
Problem Speedup
• CP Concepts
• Consistency
• Hyperarc Consistency
• Modeling Examples
• CP Filtering Algorithms
• Element
• Alldiff
• Disjunctive Scheduling
• Cumulative Scheduling
• Linear Relaxation and CP
• Why relax?
• Algebraic Analysis of LP
• Linear Programming Duality
• LP-Based Domain Filtering
• Example: Single-Vehicle Routing
• Disjunctions of Linear Systems
LSE tutorial, June 2007
Slide 11
Detailed Outline
• Mixed Integer/Linear Modeling
• MILP Representability
• 4.2 Disjunctive Modeling
• 4.3 Knapsack Modeling
• Cutting Planes
• 0-1 Knapsack Cuts
• Gomory Cuts
• Mixed Integer Rounding Cuts
• Example: Product Configuration
• Lagrangean Relaxation and CP
• Lagrangean Duality
• Properties of the Lagrangean Dual
• Example: Fast Linear Programming
• Domain Filtering
• Example: Continuous Global Optimization
Early Successes
Advantages and Disadvantages
• Real-time control
(Siemens, Xerox)
• Production scheduling
chemicals
aviation
oil refining
steel
lumber
photographic plates
tires
• Transport scheduling (food,
nuclear fuel)
• Warehouse management
• Course timetabling
MP CP
Numerical calculation Logic processing
Relaxation Inference (filtering,
constraint propagation)
Atomistic modeling High-level modeling
(linear inequalities) (global constraints)
Branching Branching
Independence of model Constraint-based
and algorithm processing
• In constraint programming:
• programming = a form of computer programming
(constraint-based processing)
• In mathematical programming:
• programming = logistics planning (historically)
Freight Transfer
Bounds Propagation
Cutting Planes
Branch-infer-and-relax Tree
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42 Knapsack
covering
Knapsack x1 + x2 + x3 + x 4 ≤ 8
packing constraint
constraint xi ∈ {0,1,2,3}
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42
x1 + x2 + x3 + x 4 ≤ 8
xi ∈ {0,1,2,3}
42 − 5 ⋅ 3 − 4 ⋅ 3 − 3 ⋅ 3
x1 ≥ =1
7
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42
x1 + x2 + x3 + x 4 ≤ 8
x1 ∈ {1,2,3}, x2 , x3 , x 4 ∈ {0,1,2,3}
Reduced
domain
42 − 5 ⋅ 3 − 4 ⋅ 3 − 3 ⋅ 3
x1 ≥ =1
7
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42
x1 + x2 + x3 + x 4 ≤ 8
0 ≤ xi ≤ 3, x1 ≥ 1
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42
Cutting
x1 + x2 + x3 + x 4 ≤ 8 plane Continuous
0 ≤ xi ≤ 3, x1 ≥ 1 relaxation
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42
x1 + x2 + x3 + x 4 ≤ 8
0 ≤ xi ≤ 3, x1 ≥ 1
{1,2} is a packing
…because 7x1 + 5x2 alone cannot satisfy the inequality,
even with x1 = x2 = 3.
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42
x1 + x2 + x3 + x 4 ≤ 8
0 ≤ xi ≤ 3, x1 ≥ 1
{1,2} is a packing
which implies
42 − (7 ⋅ 3 + 5 ⋅ 3)
x3 + x 4 ≥ =2
max {4,3}
LSE tutorial, June 2007
Slide 38
Cutting planes (valid inequalities)
∑a x
i ∉P
i i ≥ a0 − ∑ ai Ui
i ∈P
a0 − ∑ ai U i
∑ xi ≥ i ∈P
i ∉P
max {ai }
i ∉P
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42
x1 + x2 + x3 + x 4 ≤ 8
0 ≤ xi ≤ 3, x1 ≥ 1
{1,3} x2 + x4 ≥ 2
{1,4} x2 + x3 ≥ 3
min 90 x1 + 60 x2 + 50 x3 + 40 x 4
7 x1 + 5 x2 + 4 x3 + 3 x 4 ≥ 42
x1 + x2 + x3 + x4 ≤ 8
0 ≤ xi ≤ 3, x1 ≥ 1
x3 + x 4 ≥ 2
x2 + x4 ≥ 2 Knapsack cuts
x 2 + x3 ≥ 3
Propagate bounds
and solve
relaxation of
original problem.
Branch on a x1 ∈ {1,2}
x1 = 3
variable with
nonintegral value
in the relaxation.
x = (3,2,2,1)
x = (3,3,0,2)
Consistency
Hyperarc Consistency
Modeling Examples
x1 + x100 ≥ 1
x1 − x100 ≥ 0
x j ∈ {0,1}
It is not consistent, because x1 = 0 violates no constraint
and yet is infeasible (no solution has x1 = 0).
Adding the constraint x1 = 1 makes the set consistent.
x1 = 0 x1 = 1
min ∑c x
ij
ij ij
s.t. ∑x
i
ij = 1, all j
∑x
j
ij = 1, all i
xij ∈ {0,1}
Subtour elimination constraints
Variable indices
min ∑c
k
y k y k +1
min ∑c
k
ky k
Day: 1 2 3 4 5 6 7 8
A B A
Product
• At most one product manufactured on each day.
• Demands for each product on each day.
• Minimize setup + holding cost.
LSE tutorial, June 2007
Slide 68
Many variables
min ∑ hit sit + ∑ qij δ ijt
t ,i j ≠t
s.t. si ,t −1 + xit = d it + sit , all i , t
zit ≥ y it − y i ,t −1, all i , t
Integer zit ≤ y it , all i , t
programming zit ≤ 1 − y i ,t −1, all i , t
model δ ijt ≥ y i ,t −1 + y jt − 1, all i , j , t
(Wolsey) δ ijt ≥ y i ,t −1, all i , j , t
δ ijt ≥ y jt , all i , j , t
xit ≤ Cy it , all i , t
∑ y it = 1, all t
i
min ∑ qy t −1y t + ∑ hi sit
t i Inventory balance
min ∑ qy t −1y t + ∑ hi sit
t i Inventory balance
L
4
resources 1 5
Min makespan = 8
2 3
time
min z L
1 3 4 18 2 7
Problem data
2 4 4 19 1 4
3 4 3 20 1 4
4 6 4 21 1 4
5 5 5 22 2 4
6 2 5 23 4 7
7 3 4 24 5 8
8 4 3 25 2 8
9 3 4 26 1 3
10 2 8 27 1 3
11 3 4 28 2 6
12 2 5 29 1 8
13 1 4 30 3 3
14 5 3 31 2 3
15 2 3 32 1 3
16 3 3 33 2 3
17 2 6 34 2 3
min z
s.t. z ≥ t1 + 3, z ≥ t2 + 4, etc.
cumulative ( (t1,…, t34 ),(3,4,…,2),(4,4,…,3),8 )
t2 ≥ t1 + 3, t 4 ≥ t1 + 3, etc.
int capacity = 8;
int nbTasks = 34;
range Tasks 1..nbTasks;
int duration[Tasks] = [3,4,4,6,…,2];
int totalDuration =
sum(t in Tasks) duration[t];
int demand[Tasks] = [4,4,3,4,…,3];
struct Precedences {
int before;
int after;
}
{Precedences} setOfPrecedences = {
<1,2>, <1,4>, …, <33,34> };
Capacity
C1
Manufacturing
Unit
Capacity
C2
Capacity
C3
LSE tutorial, June 2007
Slide 80
Filling of storage tank
t u t + (b/r) u + (b/s)
Manufac-
turing rate Packing rate
Filling starts
Batch size
Packing starts Packing ends
Filling ends
LSE tutorial, June 2007
Slide 81
Makespan
min T
bj
s.t. T ≥ uj + , all j
sj Job release time
t j ≥ R j , all j
cumulative ( t ,v , e, m ) m storage tanks
b
v i = ui + i − t i , all i Job duration
si
si
bi 1 − + si ui ≤ Ci , all i Tank capacity
ri
b1 bn
cumulative u, ,…, , e, p
s1 sn p packing units
uj ≥ tj ≥ 0
e = (1,…,1)
LSE tutorial, June 2007
Slide 82
Modeling example: Employee scheduling
alldiff(w1d ,w 2d ,w 3d ), all d
cardinality (w | ( A, B,C, D ),(5,5,5,5),(6,6,6,6) )
w y id d = i , all i , d
y w sd d = s, all s, d
w y id d = i , all i , d
y w sd d = s, all s, d
Element
Alldiff
Disjunctive Scheduling
Cumulative Scheduling
Dz ← Dz ∩ ∪D xj
j ∈Dy
Domain of z
{
Dy ← Dy ∩ j | Dz ∩ Dx j ≠ ∅ }
Dz if Dy = { j }
Dx j ←
D
x j otherwise
Dz = {20,30,60,80,90} Dz = {80,90}
Dy = {1,3,4} Dy = {3}
Dx1 = {10,50} Dx1 = {10,50}
Dx2 = {10,20} Dx2 = {10,20}
Dx3 = {40,50,80,90} Dx3 = {80,90}
Dx4 = {40,50,70} Dx4 = {40,50,70}
y1 ∈ {1}
y 2 ∈ {2,3,5}
y 3 ∈ {1,2,3,5}
y 4 ∈ {1,5}
y 5 ∈ {1,2,3,4,5,6}
1
y1
2
y2
3
y3
4
y4
5
y5
6
y5
6
y5
6
Remove unmarked edges not in
matching.
y5
6
Remove unmarked edges not in
matching.
y1 ∈ {1} y1 ∈ {1}
y 2 ∈ {2,3,5} y 2 ∈ {2,3}
y 3 ∈ {1,2,3,5} y 3 ∈ {2,3}
y 4 ∈ {1,5} y 4 ∈ {5}
y 5 ∈ {1,2,3,4,5,6} y 5 ∈ {4,6}
Processing times
Time window
Because if job 2 is not first, there is not enough time for all 3
jobs within the time windows:
L{2,3,5} − E{3,5} < p{2,3,5}
Because if job 2 is not first, there is not enough time for all 3
jobs within the time windows:
L{2,3,5} − E{3,5} < p{2,3,5}
Latest deadline
Because if job 2 is not first, there is not enough time for all 3
jobs within the time windows:
L{2,3,5} − E{3,5} < p{2,3,5}
Because if job 2 is not first, there is not enough time for all 3
jobs within the time windows:
L{2,3,5} − E{3,5} < p{2,3,5}
In general, we can deduce that job k must precede all the jobs
in set J: k ≪ J
If there is not enough time for all the jobs after the earliest
release time of the jobs in J
LJ ∪{ k } − EJ < pJ ∪{ k } L{2,3,5} − E{3,5} < p{2,3,5}
In general, we can deduce that job k must precede all the jobs
in set J: k ≪ J
If there is not enough time for all the jobs after the earliest
release time of the jobs in J
LJ ∪{ k } − EJ < pJ ∪{ k } L{2,3,5} − E{3,5} < p{2,3,5}
If there is not enough time for all the jobs before the latest
deadline of the jobs in J:
LJ − EJ ∪{ k } < pJ ∪{ k }
min {LJ ′ − pJ ′ }
J ′⊂ J
e.g., J = {3,5}
min {LJ ′ − pJ ′ }
J ′⊂ J
e.g., J = {3,5}
min {LJ ′ − pJ ′ }
J ′⊂ J
e.g., J = {3,5}
E4 6<1+3+3 L{1,2}
LSE tutorial, June 2007
Slide 127
Not-first/not-last rules
We can deduce that job 4 cannot precede jobs 1 and 2:
¬ ( 4 ≪ {1,2} )
Now we can tighten the release time of job 4 to minimum of:
E1 + p1 = 3 E2 + p2 = 4
E4 6<1+3+3 L{1,2}
LSE tutorial, June 2007
Slide 128
Not-first/not-last rules
In general, we can deduce that job k cannot precede all the
jobs in J: ¬(k ≪ J )
if there is too little time after release time of job k to complete
all jobs before the latest deadline in J:
LJ − Ek < pJ
A feasible solution:
We can deduce that job 3 must finish after the others finish: 3 > {1,2}
Because the total energy required exceeds the area between
the earliest release time and the later deadline of jobs 1,2:
(
e3 + e{1,2} > C ⋅ L{1,2} − E {1,2,3} )
We can deduce that job 3 must finish after the others finish: 3 > {1,2}
Because the total energy required exceeds the area between
the earliest release time and the later deadline of jobs 1,2:
(
e3 + e{1,2} > C ⋅ L{1,2} − E {1,2,3} )
Total energy
required = 22
9
8
We can deduce that job 3 must finish after the others finish: 3 > {1,2}
Because the total energy required exceeds the area between
the earliest release time and the later deadline of jobs 1,2:
(
e3 + e{1,2} > C ⋅ L{1,2} − E {1,2,3} )
Total energy
required = 22
9
Area available 8
= 20
5
We can deduce that job 3 must finish after the others finish: 3 > {1,2}
We can update the release time of job 3 to
eJ − (C − c3 )(L{1,2} − E{1,2} )
E{1,2} +
c3
Energy available
for jobs 1,2 if
space is left for job
3 to start anytime
= 10
10
We can deduce that job 3 must finish after the others finish: 3 > {1,2}
We can update the release time of job 3 to
eJ − (C − c3 )(L{1,2} − E{1,2} )
E{1,2} +
c3
Energy available
for jobs 1,2 if
space is left for job 4
3 to start anytime
= 10
Excess energy 10
required by jobs
1,2 = 4
LSE tutorial, June 2007
Slide 136
Edge finding for cumulative scheduling
We can deduce that job 3 must finish after the others finish: 3 > {1,2}
We can update the release time of job 3 to
eJ − (C − c3 )(L{1,2} − E{1,2} )
E{1,2} +
c3
Energy available
for jobs 1,2 if
space is left for job 4 Move up job 3
3 to start anytime release time
= 10 4/2 = 2 units
beyond E{1,2}
Excess energy 10
required by jobs
1,2 = 4 E3
LSE tutorial, June 2007
Slide 137
Edge finding for cumulative scheduling
In general, if (
eJ ∪{k } > C ⋅ LJ − EJ ∪{ k } )
then k > J, and update Ek to
eJ ′ − (C − ck )(LJ ′ − EJ ′ )
max
J ′⊂ J
E J ′ +
c k
e ′ −(C −c )( L ′ −E ′ )>0
J k J J
In general, if (
eJ ∪{k } > C ⋅ LJ ∪{ k } − EJ )
then k < J, and update Lk to
eJ ′ − (C − ck )(LJ ′ − EJ ′ )
min
J ′⊂ J
LJ ′ −
c k
eJ ′ −(C −ck )( LJ ′ −EJ ′ )>0
An example…
min 4 x1 + 7 x2
2 x1 + 3 x2 ≥ 6
2x1 + x2 ≥ 4
2 x1 + x2 ≥ 4
Optimal solution
x1, x2 ≥ 0 x = (3,0)
4x1 + 7x2 = 12
2x1 + 3x2 ≥ 6
Rewrite as
min 4 x1 + 7 x2 min 4 x1 + 7 x2
2 x1 + 3 x2 ≥ 6 2 x1 + 3 x2 − x3 = 6
2 x1 + x2 ≥ 4 2 x1 + x2 − x4 = 4
x1, x2 ≥ 0 x1, x2 , x3 , x4 ≥ 0
Ax = b BxB + NxN = b A = [B N ]
x≥0 xB , xN ≥ 0
Ax = b BxB + NxN = b A = [B N ]
x≥0 xB , xN ≥ 0
x1, x2 , x3 , x4 ≥ 0
x2, x4 basic
x1, x2 basic
2x1 + 3x2 ≥ 6
x1, x4 basic
x3, x4 basic
x1, x3 basic x1
LSE tutorial, June 2007
Slide 149
Algebraic analysis of LP
Ax = b BxB + NxN = b A = [B N ]
x≥0 xB , xN ≥ 0
min 4 x1 + 7 x2
2x1 + 3 x2 − x3 = 6
2x1 + x2 − x4 = 4
x1, x2 , x3 , x4 ≥ 0 Consider this
basic feasible
solution
x1, x4 basic
x1
LSE tutorial, June 2007
Slide 151
Example…
cBxB c Nx N
x1 x2
min [ 4 0 ] + [7 0]
x4 x3
2 0 x1 3 −1 x1 6
BxB + =
2 −1 x 4 1 0 x 4 4
x1 x1 0 NxN b
x , x ≥ 0
4 4
x1, x4 basic
x1
LSE tutorial, June 2007
Slide 154
Example…
Basic solution is
xB = B −1b − B −1NxN = B −1b
cBxB c Nx N x1 1/ 2 0 6 3
= = =
x1 x2 x4 1 −1 4 2
min [ 4 0 ] + [7 0]
x4 x3
2 0 x1 3 −1 x1 6
BxB + =
2 −1 x 4 1 0 x 4 4 Reduced costs are
x1 x1 0 NxN cN − cB B −1N
x , x ≥ 0 1/ 2 0 3 −1
4 4 = [7 0] − [ 4 0]
1 −1 1 0
= [1 2] ≥ [0 0]
Solution is
LSE tutorial, June 2007 optimal
Slide 155
Linear Programming Duality
min cx = max v
x ≥0
Ax ≥ b Ax ≥ b ⇒ cx ≥ v
x≥0
implies
min cx = max v
x ≥0 That is, some surrogate
Ax ≥ b Ax ≥ b ⇒ cx ≥ v (nonnegative linear
x≥0 combination) of
Ax ≥ b dominates cx ≥ v
λA ≤ c and λb ≥ v
LSE tutorial, June 2007
Slide 158
This equality is called strong duality.
Primal Dual
min 4 x1 + 7 x2 = max 6λ1 + 4λ2 = 12
2 x1 + 3 x2 ≥ 6 (λ1 ) 2λ1 + 2λ2 ≤ 4 ( x1 )
2 x1 + x2 ≥ 4 (λ1 ) 3λ1 + λ2 ≤ 7 ( x2 )
x1, x2 ≥ 0 λ1, λ2 ≥ 0
2 x1 + 3 x2 ≥ 6 ⋅ (λ1 = 2)
Dual multipliers
2 x1 + x2 ≥ 4 ⋅ (λ2 = 0)
4 x1 + 6 x2 ≥ 12 Surrogate
dominates
Primal Dual
min cB xB + cN xN max λ b
λ B ≤ cB ( xB )
BxB + NxN = b (λ )
λ N ≤ cN ( xB )
xB , xN ≥ 0
λ unrestricted
Primal Dual
min cB xB + cN xN max λ b
λ B ≤ cB ( xB )
BxB + NxN = b (λ )
λ N ≤ cN ( xB )
xB , xN ≥ 0
λ unrestricted
Primal Dual
min cB xB + cN xN max λ b
λ B ≤ cB ( xB )
BxB + NxN = b (λ )
λ N ≤ cN ( xB )
xB , xN ≥ 0
λ unrestricted
Primal Dual
min cB xB + cN xN max λ b
λ B ≤ cB ( xB )
BxB + NxN = b (λ )
λ N ≤ cN ( xB )
xB , xN ≥ 0
λ unrestricted
Primal Dual
min cB xB + cN xN max λ b
λ B ≤ cB ( xB )
BxB + NxN = b (λ )
λ N ≤ cN ( xB )
xB , xN ≥ 0
λ unrestricted
Column j of A
If x were to change to a value other than x*, the LHS of i-th constraint
Aix ≥ bi would change by some amount ∆bi.
Since the constraint is tight, this would increase the optimal value
as much as changing the constraint to Aix ≥ bi + ∆bi.
So it would increase the optimal value at least λi*∆bi.
min 4 x1 + 7 x2
Suppose we have a feasible solution
2 x1 + 3 x2 ≥ 6 (λ1 = 2) of the original CP with value U = 13.
2 x1 + x2 ≥ 4 (λ1 = 0)
x1, x2 ≥ 0
Since the first constraint is tight, we can propagate
the inequality
U −v*
A1x ≤ b1 +
λ1*
13 − 12
or 2 x1 + 3 x2 ≤ 6 + = 6.5
2
U −v* U −v*
The inequality Ai x ≤ bi + becomes xj ≤
λi
*
rj
min 4 x1 + 7 x2
Suppose we have a feasible solution
2 x1 + 3 x2 ≥ 6 (λ1 = 2) of the original CP with value U = 13.
2 x1 + x2 ≥ 4 (λ1 = 0)
x1, x2 ≥ 0
U −v*
Since x2* = 0, we have x2 ≤
r2
13 − 12
or x2 ≤ = 0.5
2
A vehicle must make several stops and return home, perhaps subject
to time windows.
The objective is to find the order of stops that minimizes travel time.
This is also known as the traveling salesman problem (with time
windows).
Stop j
Travel time cij
Stop i
∑ xij = ∑ x ji = 1, all i
j j
Stop i is preceded and
followed by exactly one stop.
∑ xij = ∑ x ji = 1, all i
j j
Stop i is preceded and
followed by exactly one stop.
0 ≤ xij ≤ 1, all i , j
Because this problem is totally unimodular, it can be solved as an LP.
The relaxation provides a very weak lower bound on the optimal value.
x = ∑x k
min cx
Ak x k ≥ b k , all k
Write each
solution as a ∑y =1 k
convex k
combination x = ∑y x k
k
of points in x
k 1
x
the 0 ≤ yk ≤ 1
polyhedron x2
min cx k
Ak x k ≥ b k , all k 0 ≤ yk ≤ 1
Write each
solution as a ∑y =1 k
convex k
combination x = ∑y x k
k
of points in x
k 1
x
the 0 ≤ yk ≤ 1
polyhedron x2
MILP Representability
Disjunctive Modeling
Knapsack Modeling
Theorem. S ⊂ R is MILP
n
x1
LSE tutorial, June 2007
Slide 189
Example
min x2
Minimize a fixed charge function:
0 if x1 = 0
x2 ≥
f + cx1 if x1 > 0
x1 ≥ 0
x2
Feasible set
x1
LSE tutorial, June 2007
Slide 190
Example
min x2
Minimize a fixed charge function:
0 if x1 = 0
x2 ≥
f + cx1 if x1 > 0
x1 ≥ 0
x2
Union of two
polyhedra
P1, P2
P1
x1
LSE tutorial, June 2007
Slide 191
Example
min x2
Minimize a fixed charge function:
0 if x1 = 0
x2 ≥
f + cx1 if x1 > 0
x1 ≥ 0
x2
Union of two P2
polyhedra
P1, P2
P1
x1
LSE tutorial, June 2007
Slide 192
Example
min x2
Minimize a fixed charge function:
0 if x1 = 0
x2 ≥
f + cx1 if x1 > 0
x1 ≥ 0
x2
The P2
polyhedra
have
different
recession P1
cones.
P1 P2
x1 recession recession
LSE tutorial, June 2007 cone cone
Slide 193
Example
min x2
Minimize a fixed charge function:
0 if x1 = 0
Add an upper bound on x1 x2 ≥
f + cx1 if x1 > 0
0 ≤ x1 ≤ M
x2
The P2
polyhedra
have the
same
recession P1
cone.
P1 P2
x1 recession recession
LSE tutorial, June 2007
M cone cone
Slide 194
Modeling a union of polyhedra
x = ∑ xk
k
y k ∈ {0,1}
LSE tutorial, June 2007
Slide 195
Example
x2
P2
P1
x1
LSE tutorial, June 2007
Slide 196
M
Example
To simplify: min x2
Replace x12 with x1. x11 = 0, x21 ≥ 0
Replace x22 with x2. 0 ≤ x12 ≤ My 2 , − cx12 + x22 ≥ fy 2
Replace y2 with y. y1 + y 2 = 1, y k ∈ {0,1}
x = x1 + x 2
x = ∑ xk
k
fi cij
i j
Fixed
cost Transport
cost
No factory Factory
at location i at location i
min ∑f y + ∑c x
i
i i
ij
ij ij min ∑f y + ∑c x
i
i i
ij
ij ij
y i ∈ {0,1}
∑Q y ≥ ∑ a ; ∑ x
i
i i
j
j
i
ij = 1, all j
Each truck i has yi = 1
capacity Qi and yi = 0
zi = ci
costs ci to
operate ∨
∑ a j xij ≤ Qi i z = 0 , all i
j x = 0
0 ≤ x ≤ 1, all j ij
Truck i used ij
xij , y i ∈ {0,1}
Truck i not used
1 if truck i carries
package j 1 if truck i is used
LSE tutorial, June 2007
Slide 206
Example: Package transport
min∑c y i i
min ∑z
i
i
i
∑Q y ≥ ∑ a ; ∑ x
i i j ij = 1, all j ∑Q y ≥ ∑ a ; ∑ x
i
i i
j
j
i
ij = 1, all j
i j i
∑a x j ij ≤ Qi y i , all i yi = 1
j zi = ci yi = 0
xij ≤ y i , all i , j
∨
∑ a j xij ≤ Qi i z = 0 , all i
xij , y i ∈ {0,1} j x = 0
0 ≤ x ≤ 1, all j ij
ij
xij , y i ∈ {0,1}
∑Q y ≥ ∑ a ; ∑ x
i
i i
j
j
i
ij = 1, all j
∑a x
j
j ij ≤ Qi y i , all i Modeling trick;
unobvious without
xij ≤ y i , all i , j disjunctive approach
xij , y i ∈ {0,1}
Feasible solutions
0-1 knapsack cuts are designed for knapsack constraints with 0-1
variables.
The analysis is different from that of general knapsack constraints,
to exploit the special structure of 0-1 inequalities.
0-1 knapsack cuts are designed for knapsack constraints with 0-1
variables.
The analysis is different from that of general knapsack constraints,
to exploit the special structure of 0-1 inequalities.
Consider a 0-1 knapsack packing constraint ax ≤ a0. (Knapsack
covering constraints are similarly analyzed.)
where πk is the largest coefficient for which the inequality is still valid.
So, π k = J − 1 − max ∑ x j ∑ a j x j ≤ a0 − ak
x j ∈{0,1}
for j ∈J
j∈J j ∈J
This yields x1 + x2 + x3 + x 4 + 2 x5 ≤ 3
Further lifting leaves the cut unchanged.
But if the variables are added in the order x6, x5, the result is different:
x1 + x2 + x3 + x 4 + x5 + x6 ≤ 3
j if Aj ≤ u ≤ A j +1 − ∆ and j ∈ {0,…, p − 1}
where ρ (u ) = j + (u − A j ) / ∆ if Aj − ∆ ≤ u < A j − ∆ and j ∈ {1,…, p − 1}
p + (u − A ) / ∆ if A − ∆ ≤ u
p p
j
with ∆ = ∑ a j − a0 A j = ∑ ak
j ∈J k =1
J = {1,…, p} A0 = 0
Feasible solutions
x3 1
is x2 + [ −4 / 9 1/ 9] ≤ 2 / 3 bˆ =
x4 2 / 3
min cx + dy J = { j | yj is nonbasic}
Ax + Dy = b K = { j | xj is nonbasic}
x, y ≥ 0 and y integral N = nonbasic cols of [A D]
frac(Nˆ ij ) 1
y i + ∑ Nˆ ij y j + ∑ Nˆ ij + + ∑ Nˆ ij+ x j ≥ Nˆ ij bˆi
j ∈J1 j ∈J 2 frac( bˆi ) frac(bˆi ) j∈K
where {
J1 = j ∈ J frac(Nˆ ij ) ≥ frac(bˆ j ) } J 2 = J \ J1
1/ 3 1
The MIR cut is y1 + 1/ 3 + y
2 + (2 / 3)+ x2 ≥ 8 / 3
2/3 2/3
or y1 + (1/ 2)y 2 + x2 ≥ 3
Power
Memory Disk
supply
drive
Quantity of
component i
installed
min ∑c v
j
j j
v j = ∑ qi Aijti , all j
ik
v j = ∑ zi , all j
i
min ∑c v
j
j j
v j = ∑ zi , all j
i
v j = ∑ zi , all j
i
This is propagated by
(a) using specialized filters for element constraints of this form,
(b) adding knapsack cuts for the valid inequalities:
∑ max {A } q ≥ v , all j
i
k ∈Dti
ijk i j
∑ min{A } q ≤ v , all j
i
k ∈Dti
ijk i j
min ∑c v
j
j j
v j = ∑ qi Aijti , all j
ik
This is relaxed as
L j ≤ v j ≤ U j , all j
v j ≤ vj ≤ vj
v j = ∑ zi , all j
i
min ∑c v
j
j j
This is relaxed by relaxing this
and adding the knapsack cuts.
v j = ∑ qi Aijti , all j
ik
This is relaxed as
L j ≤ v j ≤ U j , all j
v j ≤ vj ≤ vj
v j = ∑ zi , all j
i
zi = ∑A
k∈Dti
ijk qik , qi = ∑q
k∈Dti
ik
qj = ∑q
k∈Dti
ik , all i
v j ≤ v j ≤ v j , all j
qi ≤ qi ≤ qi , all i
knapsack cuts for ∑ max {A } q ≥ v , all j i
k∈Dti
ijk i j
qik ≥ 0, all i , k
1000
100
10
Seconds
CPLEX
CLP
Hybrid
1
8x10 16x20 20x24 20x30
0.1
0.01
Problem
Lagrangean Duality
Properties of the Lagrangean Dual
Example: Fast Linear Programming
Domain Filtering
Example: Continuous Global Optimization
Consider an
inequality-constrained
problem
min f ( x )
Hard constraints
g(x ) ≥ 0
x ∈S Easy constraints
Consider an It is related to an
inequality-constrained inference problem
problem
min f ( x ) max v
s∈S
g(x ) ≥ 0 g( x ) ≥ b ⇒ f (x ) ≥ v
x ∈S implies
Primal Dual
min f ( x ) max v
g( x ) ≥ 0 v ≤ min {f ( x ) − λ g ( x )} for some λ ≥ 0
x∈S
x ∈S
or where
These constraints max θ (λ )
λ ≥0
θ (λ ) = min {f ( x ) − λ g ( x )}
are dualized x∈S
Lagrangean Vector of
relaxation Lagrange
multipliers
0 if 3 + λ1 − 2λ2 ≥ 0
x1 =
3 otherwise
Strongest
surrogate
0 if 4 − 3λ1 − λ2 ≥ 0
x2 =
3 otherwise
θ(λ)=0
λ1
θ(λ)=0
θ(λ)=7.5
Solution of Lagrangean dual:
(λ1,λ2) = (5/7, 13/7), θ(λ) = 9 2/7
Optimal solution (2,1) Note duality gap between 10 and 9 2/7
Value = 10
LSE tutorial, June 2007 (no strong duality).
Slide 251
Example
Note: in this example, the Lagrangean dual
min 3 x1 + 4 x2 provides the same bound (9 2/7) as the
− x1 + 3 x2 ≥ 0 continuous relaxation of the IP.
2 x1 + x2 − 5 ≥ 0 This is because the Lagrangean relaxation
x1, x2 ∈ {0,1,2,3} can be solved as an LP:
θ (λ1, λ2 ) = min {(3 + λ1 − 2λ2 )x1 + (4 − 3λ1 − λ2 )x2 + 5λ2 }
x ∈{0,…,3}
j
Subgradient of θ(λ) at λ = λk
Suppose:
min f ( x )
g(x ) ≥ 0 has optimal solution x*, optimal value v*, and
optimal Lagrangean dual solution λ*.
x ∈S
If x were to change to a value other than x*, the LHS of i-th constraint
gi(x) ≥ 0 would change by some amount ∆i.
Since the constraint is tight, this would increase the optimal value
as much as changing the constraint to gi(x) − ∆i ≥ 0.
So it would increase the optimal value at least λi*∆i.
(It is easily shown that Lagrange multipliers are marginal costs. Dual
multipliers for LP are a special case of Lagrange multipliers.)
Global optimum
x2
max x1 + x2
4 x1x2 = 1
2 x1 + x2 ≤ 2
x1 ∈ [0,1], x2 ∈ [0,2]
Local optimum
Feasible set
x1
LSE tutorial, June 2007
Slide 263
To solve it:
x2
Propagate intervals
[0,1], [0,2]
through constraints
to obtain
[1/8,7/8], [1/4,7/4]
x1
x2
x1
x2
x2 ∈ [1,1.75]
Solve linear relaxation.
x2 x2
x1 x1
x2 Solution of x2
relaxation is
feasible,
value = 1.25
This becomes
incumbent
solution
x1 x1
x2 Solution of x2
relaxation is Solution of
feasible, relaxation is
value = 1.25 not quite
feasible,
This becomes value = 1.854
incumbent
solution Also use
Lagrange
multipliers for
domain
filtering…
x1 x1
4 x1 + 2 x2 + 3 x3 ≤ 12
Number of x j ∈ {1,2}
factories of type j
x j ∈ {1,2}
x3=1
= 1 if there is State is sum
a path from of first k terms
state sk to a of ax
feasible
solution,
0 otherwise
f3(8) = max{f4(8+3⋅1), f4(8+3⋅2)} = max{1,0} = 1
f4(14)=0
LSE tutorial, June 2007 f4(11)=1
Slide 279
Example: Capital Budgeting
0 0
4 x1 + 2 x2 + 3 x3 ≤ 12
0
x j ∈ {1,2} 0
0 0
In general the recursion for ax ≤ b is 0
1
fk (sk ) = max {fk +1(sk + ak xk )} 1 0
xk ∈Dxk
1 1
Boundary condition: 1
1
1 if sn +1 ≤ b 1
fn +1(sn +1 ) =
0 otherwise
1 0
Each path to 0 is a feasible
solution. 1 1
Path 1: x = (1,2,1) 1 1
Path 2: x = (1,1,2) 1
Path 3: x = (1,1,1)
fk(sk) for each state sk
Possible costs are 9,11,12.
Dx1 = {1}
24 0
Boundary condition:
0
0 if sn +1 ≤ b
fn +1(sn +1 ) =
−∞ otherwise
fk(sk) for each state sk
34 0
The optimal path is easy to
retrace. 24 0
(x1,x2,x3) = (1,1,2) 0
Basic Idea
Example: Airline Crew Scheduling
Cost of column y
If the solution y* satisfies cy* − λy* < 0, then we can add column y to
the restricted master problem.
u1
u2
v1
v2
v3
v4
v5
v6
Crew
member 1
Crew
member 2
Crew
member 1
Crew
member 2
Crew
member 1
Crew
member 2
Crew
member 1
Dual multiplier
omitted to break
symmetry
Crew
member 2
Crew
member 1
Crew
member 2
5 2
−10 2
2
3
Crew
member 1 4
0 −1
5 6
5 2
0 2
Crew 3
member 2 4
-9 −1
5 6
5 2
−10 2
2
3
Crew
4
member 1 0 −1
5 6
Reduced cost = −1
Add x12 to problem.
5 2
0 2
3
Crew
member 2 4
-9 −1
Reduced cost = −2 5 6
Add x23 to problem.
After x12 and x23 are added to the problem, no
LSE tutorial, June 2007
Slide 309 remaining variable has negative reduced cost.
Pricing problem
min f ( x k , y )
In iteration k we assume x = xk and get optimal
and solve the subproblem S( x k , y ) value vk
y ∈ Dy
The Benders cut says that if we set x = xk again, the resulting cost v
will be at least vk. To do better than vk, we must try something else.
It also says that any other x will result in a cost of at least Bk+1(x),
perhaps due to some similarity between x and xk.
min f ( x k , y )
In iteration k we assume x = xk and get optimal
and solve the subproblem S( x k , y ) value vk
y ∈ Dy
The Benders cuts partially define the projection of the feasible set
onto x. We hope not too many cuts are needed to find the optimum.
min f ( x ) + cy min f ( x ) + cy
k max f ( x k ) + λ ( b − g ( x k ) )
g ( x ) + Ay ≥ b Ay ≥ b − g ( x k ) (λ ) λA ≤ c
x ∈ Dx , y ≥ 0 y ≥0 λ ≥0
min v min v
v ≥ Bi ( x ), i = 1,…, k + 1 v ≥ f ( x ) + λ i (b − g ( x )), i = 1,…, k + 1
x ∈ Dx x ∈ Dx
Machine A
Machine B
Minimum makespan
schedule for jobs 1, 2, 3, 5
on machine A
The problem is
Start time of job j
min M
M ≥ s j + px j j , all j Time windows
r j ≤ s j ≤ d j − px j j , all j Jobs cannot overlap
disjunctive ( (s j x j = i ),( pij x j = i ) ) , all i
The problem is
Start time of job j
min M
M ≥ s j + px j j , all j Time windows
r j ≤ s j ≤ d j − px j j , all j Jobs cannot overlap
disjunctive ( (s j x j = i ),( pij x j = i ) ) , all i
min M
M ≥ s j + px j j , all j with x j = i
r j ≤ s j ≤ d j − px j j , all j with x j = i
∑p
j =1
Aj x Aj ≤ 10, etc.
5
Constraints derived from release times
∑p
j =1
Bj xBj ≤ 10, etc.
5 5
v ≥ ∑ pij xij , v ≥ 2 + ∑ pij xij , etc., i = A, B
j =1 j =3
v ≥ 10( x A 2 + x A3 + x A5 − 2)
v ≥ 8 xB 4 Benders cut from machine A
xij ∈ {0,1} Benders cut from machine B
If all release times are the same, we can strengthen the Benders cuts.
We are now using the cut
v ≥ Mik ∑ xij − J ik + 1
j∈Jik
Min makespan Set of jobs
on machine i assigned to
in iteration k machine i in
iteration k
A stronger cut provides a useful bound even if only some of the jobs in
Jik are assigned to machine i:
v ≥ Mik − ∑ (1 − x
j ∈Jik
ij )pij