Title: Reconnect 04 Introduction to Integer Programming
1Reconnect 04Introduction to Integer Programming
- Cynthia Phillips, Sandia National Laboratories
2Integer programming (IP)
- Min
- Subject to
- Can also have inequalities in either direction
(slack variables) - If , then this is a
mixed-integer program (MIP) - Linear programming (LP) has no integrality
constraints (in P) - IP (easily) expresses any NP-complete problem
3Terminology
- In this context programming means making
decisions. - Leading terms say what kind
- (Pure) Integer programming all integer decisions
- Linear programming
- Quadratic programming quadratic objective
function - Nonlinear programming nonlinear constraints
- Stochastic programming finite probability
distribution of scenarios - Came from operations research (practical
optimization discipline) - Computer programming (by someone) is required to
solve these.
4Decisions
- The IPs Ive encountered in practice involve
either - Allocation of scarce resources
- Study of a natural system
- Computational biology
- Mathematics
- Maybe during or after this course, you can add to
the list
5Integer Variables
- Use (binary variables) to model
- Yes/no decisions
- Disjunctions
- Logical conditions
- Piecewise linear functions (this not covered in
this lecture)
6General Integer Variables
- Use general integer variables to choose a number
of indivisible objects such as the number of
planes to produce - Integer range should be small (e.g. 1-10)
- Computational tractability
- Larger ranges may be well approximated by
rational variables (number of bags of potato
chips to produce)
7Example Binary Knapsack
- Given set of objects 1..n
- total weight W, item weight/size wi, value vi
8Example Shortest-Path Network Interdiction
- Delay an adversary moving through a network.
- Adversary moves start?target along a shortest
path (in worst case) - Path length sum of edge lengths. Measure of
time, exposure, etc.
5
6
Target
3
1
Start
2
2
5
1
4
Shortest Path Length 8
9Example Shortest-Path Network Interdiction
- Defender blocks the intruder by paying to
increase edge lengths. - Goal Maximize the resulting shortest path.
5
6
Target
3
1
Start
2
2
1
5
2
1
4
Shortest Path Length 11
10Path Interdiction Mixed-Integer Program
- Graph G (V,E)
- Edge lengths for edge (u,v)
- Can increase length of (u,v) by ?uv at cost cuv
- Budget B
- Variables
- du shortest distance from start s to node
u
11Path Interdiction Integer Program
- Objective maximize the shortest path to the
target - maximize dt
- Subject to
- Path to the start has length 0
- ds 0
- Calculate a shortest path length
- Respect the budget
u
?uv
v
12Modeling Dependent Decisions
- Suppose x,y are two binary variables that
represent a decision (where 1 means yes and 0
means no) - The constraint allows x to be
yes only if y is yes
13Example Unconstrained Facility Location
- Given potential facility locations, n customers
to be served - cj cost to build facility j
- hij cost to meet all of customer is demand
from facility j - Sometimes its OK to satisfy customers from
multiple facilities
14Formulation is really important in practice
- Unconstrained facility location
- Could sum constraints
over all customers i to get - Recall n is the number of customers.
- Still requires a facility is built before use
(IPs are equivalent at optimality) - But, for 40 customers, 40 facilities, random
costs - First formulation solves in 2 seconds
- Second formulation solves in 53,121 seconds
(14.75 hours)
15What makes one formulation so much better?
- Understanding this fully is an open problem.
- Some performance differences can be explained by
the way IPs are solved in practice by
branch-and-bound-like algorithms the LP
relaxation
16Recall Integer Programming (IP)
17Linear programming (LP) relaxation of an IP
- Min
- Subject to
- LP can be solved efficiently (in theory and
practice) - Relaxation removing constraints
- All feasible IP solutions are feasible
- LP gives a lower bound
18Linear Programming Geometry
- The solutions to a single inequality
form a half space (in
n-dimensional space)
feasible
19Linear Programming Geometry
- Intersection of all the linear (in)equalities
form a convex polytope - For simplicity, well always assume polytope is
bounded
feasible
20IP Geometry
- Feasible integer points form a lattice inside the
LP polytope
21IP Geometry
- The convex hull of this lattice forms the integer
polytope
22IP/LP Geometry
- A good formulation keeps this region small
- Every node for which the LP bound is lower than
the integer optimal must be processed (e.g.
expanded)
23IP/LP Geometry
- A good formulation keeps this region small
- One measure of this is the Integrality Gap
- Integrality gap maxinstances I(IP (I))/(LP(I))
24Unconstrained Facility Location Revisited
- Given potential facility locations, customers to
be served - cj cost to build facility j
- hij cost to meet all of customer is demand
from facility j
25How the weaker LP cheats
- Using
- Allows the LP to completely satisfy customer i
with facility j (yij 1) even with xj 1/n. - With these constraints
- If xi 1/n, then yij lt 1/n
26Cant we just round the LP Solution?
- Not generally feasible
- If (miraculously) it is feasible, its not
generally good
27Example Maximum Independent Set
- Find a maximum-size set of vertices that have no
edges between any pair
28Example Maximum Independent Set
29Example Maximum Independent Set
- The zero-information solution (vi .5 for all i)
is feasible and its optimal if the optimal MIS
has size at most V/2. - Rounding everything (up) is infeasible.
1/2
1/2
1/2
1/2
1/2
1/2
1/2
30Cant we project the lattice onto the objective
gradient?
- Hard to find a feasible solution to project
(NP-complete!) - Make the objective a constraint and do binary
search - This is a lot harder in n dimensions than it
looks like in 2
gradient
31Perfect formulations
- Sometimes solving an LP is guaranteed to give an
integer solution - All polytope corners have integer coefficients
(naturally integer) - Sometimes only for specific objectives (e.g.
)
32Perfect Formulation Example Minimum Cut
12
1
4
Capacity ue
27
2
s
5
5
9
3
3
1
20
t
8
2
5
2
- Special nodes s and t
- Each edge e has capacity ue. Set of edges S has
capacity - Partition vertex set V into S,T where
- A cut is the edges (u,v) such that
- Find a cut with minimum capacity
33Perfect Formulation Example Minimum Cut IP
- Helper variables ye 1 if e is in the cut and 0
otherwise - The y variables will be integral if the v
variables are.
34Total Unimodularity
- The minimum cut matrix (possibly with slack
variables) is totally unimodular (TU) all
subdeterminants (including the matrix entries)
have value 0, 1, or -1. - All corner solutions x satisfy Axb
- By Kramers rule x will be integral
- Network matrices (adjacency matrices of graphs)
are TU. - Nemhauser and Wolsey (Integer and Combinatorial
Optimization, Wiley, 1988) give some sufficient
conditions for a matrix to be TU. - Note if a matrix is TU, there is always an
efficient combinatorial algorithm to solve the
problem (not necessarily obvious)
35Total Unimodularity is Fragile
- Example Network Interdiction
- Expend a limited budget to maximally damage the
transport capacity of a network
36Network Flow
11/12
1
4
11/27
0/5
9/9
2/2
5/5
s
3
1/1
8/20
t
3/3
2
5
2/8
2/2
- Source(s) s, sink (consumers) t
- Capacity (bottom number)
- Flow (top number)
- Maximize flow from s to t obeying
- Capacity constraints on edges
- Conservation constraints on all nodes other than
s,t
37Network Interdiction
11/12
1
4
11/27
0/5
9/9
2/2
5/5
s
3
1/1
8/20
t
3/3
2
5
2/8
2/2
- Each edge e now has a destruction cost de (cost
to remove e assume linear) - Budget B
- Expend at most B removing (pieces of) edges in
the network so resulting max flow is minimized
38Network Interdiction
- By LP duality (well see later)
- value of max flow value of min cut
- So
- minattacks max flow minattacks min cut
- Pay to knock out transport capacity from s to t
12
1
4
27
5
s
5
9
2
3
3
1
20
t
8
2
5
2
39A Mixed Integer Program for Network Inhibition
0
1
t
s
- Based on min-cut LP
- Find best cut to attack
- Decision variables place vertices on the s or t
side as before - All edges going across the cut must be destroyed
(consume budget) or contribute to residual cut
capacity
40Network Inhibition IP
- Helper variables ye percent of an edge in cut
that is not removed - ze percent of an
edge in the cut that is destroyed
41Total Unimodularity is Fragile
- The matrix is still TU without the budget
constraint - Adding the budget constraint makes the problem
strongly NP-complete - No known polynomial-time approximation algorithms
- Still has some very nice structure that gives a
pseudo-approximation - Pseudo-approximation might give a superoptimal
solution that slightly exceeds the budget or it
could give a true approximation
42Modeling Sets
- Given a set T,
- means select at least
1 element of T - Making sure at least one local warehouse has
inventory for each customer - means select at most 1
element of T - Conflicts (e.g. modeled by a maximum independent
set problem) - Resource constraints
- means select exactly 1
element of T - Time indexed scheduling variables xjt, schedule
job j at time t. This picks a single time for job
j.
43Modeling Disjunctive Constraints
- Let be two
constraints with nonnegative coefficients - To force satisfaction of at least one of these
constraints
44Modeling Disjunctive Constraints - General Number
- Let be m
constraints with nonnegative coefficients - To force satisfaction of at least k of these
constraints
45Modeling a Restricted Set of Values
- Variable x can take on only values in
- Frequently the vi are sorted
- Example capacity of an airplane assigned to a
flight - The yis are a special ordered set.
46Some simple logical constraints
- Want (logical or)
- Suffices if there is pressure in the objective
function to keep y low. - Saw this in minimum cut
- Similarly if we want
(logical and) - Suffices if there is pressure in the objective
function to keep y high.
47Example Protein Structure Comparison
- 2 nonadjacent amino acids share an edge if
theyre physically close when folded
Contact Map
48Example Protein Structure Comparison
- 2 nonadjacent amino acids share an edge if
theyre physically close folded - Noncrossing alignment of two proteins to maximize
shared contacts - Measure of similarity
49Protein Structure Comparison
- Variables xij 1 if amino acid in position i of
the top protein is matched to amino acid in
position j of the bottom protein, 0 otherwise - Helper variables
50Non-crossing alignment
- For any pair of edges, we can tell if they cross
- if the pair is forbidden (simply dont create
this variable). - There are more clever ways to do this (e.g. using
Ramsey theory). See what you can come up with.
51Protein Structure Comparison
- Only consider yijkl if this is a shared contact
((i,k) a contact, (j,l) a contact)
52MIP Applications (Small Sample)
- Logistics
- Capacity planning, scheduling, workforce
planning, military spares management - Infrastructure/network security
- Vulnerability analysis, reinforcement,
reliability, design, integrity of physical
transport media - Sensor placement (water systems, roadways)
- Waste remediation
- Vehicle routing, fleet planning
- Bioinformatics protein structure
prediction/comparison, drug docking - VLSI, robot design
- Tools for high-performance computing (scheduling,
node allocation, domain decomposition, meshing)
53Solving Integer Programs
- NP-hard
- Many special cases have efficient solutions or
provably-good approximation bounds - Need time to explore structure
- General IPs can be hard due to size and/or
structure - (Sufficiently) optimal solution is important
- When lives or big at stake
- For rigorous benchmarking of heuristic/approximati
on methods - To gain structural insight for better
algorithms/proofs.