Professional Documents
Culture Documents
Integer Programming Part 2
Integer Programming Part 2
053/8
March 4, 2014
references:
IP Formulation Guide (on the website) Tutorial on IP formulations. Applied Math Programming
Very quick review of integer programming Building blocks for creating IP models Logical constraints Non-linear functions Set covering and packing. Other combinatorial problems modeled as IPs
Integer Programs
Integer programs: a linear program plus the additional constraints that some or all of the variables must be integer valued. We also permit xj {0,1}, or equivalently, xj is binary This is a shortcut for writing the constraints: 0 xj 1 and xj integer.
x 2 or x 5
x
Suppose that 0 x 8
0 2 4 6 8 10
10
5
x 0 2 4 6 8 10
x 5 5(1-w) = 5w x 2 + 6w
These two constraints eliminate all infeasible solutions, but no feasible solution.
6
x 2 or x 5
x 0 2 4 6 8 10
x 5 M(1-w) x 2 + Mw
These two constraints eliminate all infeasible solutions, but no feasible solution. (But there are more solutions for the LP.)
Assume that all variables are integer valued. Assume a bound u* on coefficients and variables; e.g., xj 10,000 for all j. |aij| 10,000 for all i, j.
That is, we will be able to satisfy any constraint by adding M to the RHS. And we can satisfy any constraint by subtracting M from the RHS.
8
Modeling
x1 + 2x2 12 or 4x2 10x3 1.
Logical constraints.
Suppose that xi is bounded for all i.
or constraints
x1 + 2x2 12 M(1-w) 4x2 10x3 1 + Mw.
IP constraints. Suppose that M is very large.
To show: The logical constraints are equivalent to the IP constraints. Suppose that (x, w) is feasible, for the IP. If w = 1, then x1 + 2x2 12
x1 + 2x2
12
4x2 10x3 1.
the other constraint is redundant
If-then constraints
If A then B is equivalent to (Not A) or B or both. If it is a crow, then it is black. Either it isnt a crow, or it is black, or both. How would one model If x1 12 then x2 7? You may assume that 0 x1 100 0 x2 100 x1, x2 are integers. And let w {0,1} be the new variable.
11
B.
C.
D.
12
Suppose that there is a linear cost of production, after the process is set up. There is a cost of setting up the production process. The process is not set up unless there is production.
13
12 10 8 6 4 2 0
y = 0
if x = 0
y = 2 + 2x
if x 1
10
12 10 8 6 4 2 0
y = 0
if x = 0
y = 2 + 2x
if x 1
y = 2w + 2x w {0,1}
15
Yes. The variables are all correctly defined. No. There is nothing to prevent y = 2x even if x > 0.
B.
16
w
1
10
wx x 10w
y = 2w + 2x
17
w
1
10
wx x Mw
y = 2w + 2x
18
Zor is unable to get any of his reactions going without an expensive set up. Cost to set up $500 $400 $300
19
10 x1 + 5 x2 + 2 x3 204
20
The IP Formulation
Max
s.t.
-500 w1 + 52 x1 2 x1 + 4 x2 + 5 x3 1 x1 + 1 x2 + 1 x3
500 w2 + 30 x2 - 300 w3 + 20 x3
100 30
10 x1 + 5 x2 + 2 x3 204
wi xi for all i.
x 3 M w 3;
x 1 M w 1;
x 2 M w 2;
Is that OK?
21
B.
C.
The constraint wi xi is satisfied by every feasible solution. If xi = 0, then the optimal solution will wi xi is satisfied by every feasible solution. The formulation is wrong if these constraints are eliminated.
22
y = 2x
if 0 x 3
y = 9x
y = -5 + x
if 4 x 7
if 8 x 9
It can be accomplished using integer programming. One method is given on the next slides.
23
y = 2x y = 9x y = -5 + x
3 7 9 x
if 0 x 3 if 4 x 7 if 8 x 9
x is integer valued.
If the variables are defined as above, then y = 2x1 + (9w2 - x2) + ( - 5 w3 + x3)
24
Add constraints
Definitions of the variables. Constraints
0 x1 3 w 1 w1 {0, 1} 4w2 x2 7 w2 w2 {0, 1} 8w3 x3 9 w3
w3 {0, 1} w1 + w 2 + w3 = 1 x = x1 + x 2 + x 3
Suppose that 0 x 9, x integer. xi integer i
If (x, w) satisfies the definitions, then it also satisfies the constraints. If (x, w) satisfies the constraints, then it also satisfies the definitions.
25
Mental Break
26
053 Chocolates
5
4 8 11 10 14
6
7 9
Locate 053 Chocolate stores so that each district has a store in it or next to it. Minimize the number of stores needed.
12 15
13 16
27
28
There is a set of elements S = {1, 2, , m}. In 053-chocolates, elements are districts There is a collection S1, S2, , Sn of subsets of elements. Sj S for each j.
In 053-chocolates, the subsets are districts that are covered by placing a store.
S=
Set Cover Problem: find a minimum size (or min cost) cover of S.
29
30
1 5 4
2 6
7
8 9
Locate as many 053 Chocolate stores as possible so that no two stores are in adjacent districts.
How many stores can you find?
11
10 14
12
15
13
16 16 16
32
We say that index set J is a feasible packing if Si Sj = for all i, j J with i j. Set Cover Problem: find a maximum size (or min cost) cover of S.
33
34
35
Graph Coloring
This is a map of the counties in Colorado. What is the fewest number of colors need to color all of the counties so that no counties with a common border have the same color?
36
Graph Coloring
Exercise: write an integer program whose solution gives the minimum number of colors to color a map.
38
Min s.t
k y k x
k
ik
=1 " i N
Each county is given a color. If counties i and j share a common boundary, then they are not both assigned color k. If county i is assigned color k, then color k is used.
x ik + x jk 1
for (i , j ) A and for k = 1 to 4
x ik y k
x ik {0,1}
y k {0,1}
39
G = (N, A)
N = {1, 2, 3, n} set of exams. 28 periods.
x ik
x ik + x jk 1
Logical constraints Non-linear objectives Set covering, and set packing Coloring and partitioning and many more not mentioned yet
41