IP Quality
IP Quality
IE 8030
Prof. Emily Tucker
Nov. 14, 2024
What’d we cover last time?
• Branch-and-bound
Today
• Branch-and-Bound
IP “Quality”
Spoiler Alert
• General idea: we want the LP relaxation to be close to
the IP
– “High quality”
• Why?
– We use LP relaxations to iteratively solve for IPs
– The closer the LP is, the fewer iterations you need
IP Quality
Motivating Example
• Matthew's Lego Workshop company will be opening a
production facility
– It has enough room to install exactly one of two production lines.
• Costs
– Production line 1: $10,000
– Production line 2: $8,000.
• Constraints
– Production on line 1 max 3𝑥1 + 2𝑥2 − 2000𝑦1
– Production on line 2
– Inventory capacity 0.05𝑥1 + 0.033𝑥2 ≤ 40 + 𝑀(1 − 𝑦1 )
– Domain
0.025𝑥1 + 0.1𝑥2 ≤ 40 + 𝑀𝑦1
• Objective 40𝑥1 + 25𝑥2 ≤ 15000
– Maximize profit (revenues-costs)
𝑥1 , 𝑥2 ≥ 0
𝑦 ∈ 0,1
How 𝑴 affects the LP relaxation
• Quality of LP relaxation
– % away it is from the IP value
LP Obj Value − IP Obj Value
IP Obj Value
• Optimal IP value:
– 1170.37
• Recall
– 𝑦𝑖 indicates if location 𝑖 ∈ 𝐼 is
selected
– 𝑥𝑖𝑗 indicates if population center
𝑗 ∈ 𝐽 is allocated to EMT location
𝑖∈𝐼
Alternate formulation
• Rather than:
– 𝑥𝑖𝑗 ≤ 𝑦𝑖 , ∀𝑖 ∈ 𝐼, 𝑗 ∈ 𝐽
• Could write:
– σ𝑗∈𝐽 𝑥𝑖𝑗 ≤ 𝑀𝑦𝑖 , ∀𝑖 ∈ 𝐼
– Sets: 𝐿 = 1,2 ; 𝐷 = 𝐴, 𝐵
B 2
– Variables: 𝑥1𝐴 , 𝑥1𝐵 , 𝑥2𝐴 , 𝑥2𝐵 , 𝑦1 , 𝑦2
– Constraint options:
Disaggregated Aggregated
𝑥1𝐴 ≤ 𝑦1
𝑥1𝐵 ≤ 𝑦1 𝑥1𝐴 + 𝑥1𝐵 ≤ 2𝑦1 Zoom in
𝑥2𝐴 ≤ 𝑦2 𝑥2𝐴 + 𝑥2𝐵 ≤ 2𝑦2
𝑥2𝐵 ≤ 𝑦2
Zoom in:
Disaggregated Aggregated
𝑥1𝐴 ≤ 𝑦1
𝑥1𝐴 + 𝑥1𝐵 ≤ 2𝑦1
𝑥1𝐵 ≤ 𝑦1
• Idea
– Cutting off feasible continuous
solutions
Example: Fixed Costs
• Decision variables
– 𝑦𝐵 = 1 if we install production line for product 𝐵
– 𝑥𝐵 : the amount of product 𝐵 we produce
• Constraint
– 𝑥𝐵 ≤ 𝑀𝑦𝐵
– Any valid upper bound on production of B can be used for 𝑀
Options for 𝑴 Anytime we tighten
𝑀, we are identifying
• Could say 𝑀 = 1,000,000 a valid inequality
• Why?
– Once 𝑦𝐵 = 1, then we haven’t cut out any feasible 𝑥𝐵 values
– But we have cut out a lot of feasible solutions in the LP relaxation
𝑥𝐵 𝑥
• Any solution with 𝑥𝐵 and 𝑦𝐵 ∈ , 𝐵
1,000,000 6
Example: Logical Constraints
• Decision variables
– 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 binary
– 𝑥5 ≥ 0
• What happens if 𝑥2 = 𝑥3 = 0?
– Constraint can’t be satisfied
– Logically, at least one of 𝑥2 or 𝑥3 needs to be positive
– Initial inequality
• 𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 ≤ 10.5
– Valid inequality
• 𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 ≤ 10 = 10.5
Extending the logic
• More complex example
– Let 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 ≥ 0, integer
• Initial constraint
– 20𝑥1 + 13𝑥3 + 9𝑥3 + 10𝑥4 ≤ 42
They become
extreme points of the
problem with this
constraint added!
The IP with the VI added
Because (4,0) is an extreme point to the feasible region, when we solve the
linear relaxation – we’ll get the integer optimal solution
How?
Linear relaxation
Solve LP relaxation via Simplex
Solving the Relaxation
They become
extreme points of the
problem with this
constraint added!
Can we generate other VIs?
Consider the second equation
𝑥2 − 0.5𝑥3 + 1.5𝑥4 = 1.5
𝑎𝑖𝑗 𝑥𝑗 ≤ 𝑏𝑖 , for 𝑖 = 1, … , 𝑚
𝑗=1
𝑥𝑗 ≥ 0, integer, for 𝑗 = 1, … , 𝑛
LP relaxation
If you solve the relaxation, you’ll end up with a final BFS
𝑎ത𝑖𝑗 is the coefficient in the 𝑖-th row of the BFS
𝑏ത𝑖 RHS
𝑛
𝑎ത𝑖𝑗 𝑥𝑗 = 𝑏ത𝑖
Write the rearranged equality:
𝑗=1
Generic Approach to Find VI
𝑛
• When to use?
– Embedded within IP algos
– Branch and bound is great but can be slow
• Adding cutting planes can speed it up
Branch-and-Cut
Mitchell, 1999
Within Gurobi,
E.g., Branch and Cut
https://www.gurobi.com/pdfs/user-events/2016-frankfurt/Die-Algorithmen.pdf
Can display solver output
# Solve
solver = SolverFactory('gurobi')
Within your Pyomo code, solver.solve(model)
can add the bolded line: results = solver.solve(model, tree=True)
model.pprint()
print("Obj value: " + str(value(model.obj)))
Solver Output
Background
on
license/your
machine
Coef. info
Pre-solve
LP relaxation
of the root
node
Simple problem so only
Solver Output
uses root node
(doesn’t branch)
Nodes its
exploring
• Etc.
Appendix
(Additional Detail on Tightness of LP Relaxations)
Fixed-Cost Example
• You run a company that is interested in launching a new
product: the exciting Product B.
– The cost of installing a production line to produce Product B is
$1000. You cannot produce Product B without installing this
production line.
– You have yet to finalize the projected demand (𝑑𝐵 ) for Product B.
• Constraint
– Can only produce if we install 𝑥𝐵 ≤ 𝑑𝐵 𝑦𝐵
production line
• Objective
– Max profits max [Revenues] – [costs] − 1000𝑦𝐵
Examine the LP Relaxation
• When you relax integrality
– Constraint: 𝑥𝐵 ≤ 𝑑𝐵 𝑦𝐵
• Still in the model, but the value of 𝑦𝐵 has a different domain
– 𝑦𝐵 ∈ 0,1 ⇒ 𝑦𝐵 ≥ 0, 𝑦𝐵 ≤ 1
20
– E.g., if 3𝑥𝐵 + 2𝑥𝐶 ≤ 20, then we won’t produce more than
3
units of product B
Comparing LP Relaxations
• LP1: 𝑥𝐵 ≤ 6𝑦𝐵
• LP2: 𝑥𝐵 ≤ 100𝑦𝐵
• Now suppose that we know in the LP1 relaxation that 𝑥𝐵∗ = 5, then
5
𝑦𝐵∗ =
6
5
• But in LP2, we can set 𝑦𝐵∗ =
100
– This means the objective increases (because costs decrease)
– So LP1 is “tighter” than LP2