Computer Algorithms
Integer Programming
ECE 665Professor Maciej Ciesielski
By DFG
2Department of Electrical Engineering - UMASS
Outline
Mathematical programming paradigm• Linear Programming• Integer Programming
Integer Programming• Example• Unimodularity LP -> IP
• Theorem• Conclusion
Special Linear Programming with Integer Solutions• Assignment Problem• Network Flow Problem
Review Conclusions
3Department of Electrical Engineering - UMASS
Mathematical Programming Paradigm
A mathematical program is an optimization problem of the form:
• Maximize (or Minimize) f(x)
subject to:
• g(x) = 0• h(x) ≥ 0
where x = [x1,...xn] is a subset of Rn, the functions g and h are called constraints, and f is called the objective function.
MathematicalProgrammingparadigm
4Department of Electrical Engineering - UMASS
Linear Programming (LP) The goal of Linear programming is to:
(Max)Minimize: CTxSubject to: Ax ≥ b
x ≥ 0
Where CT is a coefficient vector for f, A is a constraint matrix, and b es a constraint vector.
The constraint set: {x | Ax ≥ b} is a convex polyhedron, and f is linear so it is convex.
Therefore, LP has convexity, and the local min/max is the global min/max
5Department of Electrical Engineering - UMASS
Integer Programming (IP)
The goal of Integer programming is to:
(Max)Minimize: CTxSubject to: Ax b
xi integer
Typically, xi = 0,1 (0,1 Integer Programming)
6Department of Electrical Engineering - UMASS
IP Example (Matching Problem)
Given a graph G , find maximal set of edges in G, such that no two edges are adjacent to the same vertex.
Maximum matching: matching of maximum cardinality. Weighted matching: matching with
)(max iew
1 3
2e1 e2
e3
7Department of Electrical Engineering - UMASS
IP Example (Matching Problem)
otherwise
matchinginincludedisif0
e1x ii
321 xxx max
10x1xx1xx1xx
tos
i
32
31
21
,
.1 3
2e1 e2
e3
8Department of Electrical Engineering - UMASS
IP Example (Matching Problem)
In matrix form:
Where b = [ 1,…1]T , A = incidence matrix of G
10xbAx
tosi ,
.
xcTmax
110101011
eee
e.g.
3
2
1
A
1 2 3
9Department of Electrical Engineering - UMASS
IP Example (Matching Problem)
max 1x1 + 1x2 + 1x3
111
110101011
s.to
3
2
1
xxx
One solution to this IP problem:x1 , x2 , x3 = 0, 1
x1 = 1 , x2 = 0 , x3 = 0Other possible solutions:x1 = 0 , x2 = 1 , x3 = 0, or x1 = 0 , x2 = 0 , x3 =
1
10Department of Electrical Engineering - UMASS
Question…
Can the solution to this IP problem be obtained by dropping the integrality constraint:
xi = 0, 1
And solving the LP problem instead?
In our example, solution to the IP is not obtainable from LP.
Reason: matrix A does not have certain property (total unimodularity) needed to guarantee integer solutions.
11Department of Electrical Engineering - UMASS
If xi = 0, 1 is relaxed, such that xi 0 , then the solution to the associated LP problem is non – integer:
21xxx 321
Reason: the A matrix
110101011
Is not totally unimodular: |A| = - 2
Question…
12Department of Electrical Engineering - UMASS
Given a constraint set in standard form
where A, b are integer
Partition A = [B/N ]; x = [xB, xN ]
B is nonsingular m x m basis, N is non-basic
0xbAx
i
Unimodularity: LP -> IP
13Department of Electrical Engineering - UMASS
Basic solution is
bBx0x
1B
N
In particular, when B = I and B -1 = I then
XB = b
a solution can be obtained by inspection (as in the initial step of Simplex method).
Unimodularity: LP -> IP
14Department of Electrical Engineering - UMASS
Since xB = B –1 b with xN = 0, b integer
A sufficient condition for a basic solution xB to be integer is that
B –1 be an integer matrix
Unimodularity: LP -> IP
15Department of Electrical Engineering - UMASS
A square matrix B is called unimodular if
D = |det B| = 1
An integer matrix A is totally unimodular if every square, nonsingular submatrix of A is unimodular.
Equivalently: A is totally unimodular if every subdeterminant of A is 0, +1, or –1.
Unimodularity
16Department of Electrical Engineering - UMASS
Recall that for B nonsingular: Bted
BB 1
Where B + , adjoint matrix
= [ i j cofactor of element a i j in det A ]T
B + and det B are integer if B –1 is integer
Unimodularity
17Department of Electrical Engineering - UMASS
333231
232221
131211
bbbbbbbbb
B
T
211222111321231122132312
311232113113331113323312
312232213123332132233322
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
B
)()()()()()()()()(
Cofactor of ai j : Determinant obtained by omitting the ith row and the jth column of A and then multiplying by (-1) i + j .
Unimodularity
18Department of Electrical Engineering - UMASS
For B unimodular, B –1 integer:
If A is totally unimodular, every basis matrix B is unimodular and every basic solution
( xB , yN) = ( B –1 b, 0 )
Is integer.
In particular, the optimal solution is integer
Unimodularity
19Department of Electrical Engineering - UMASS
If A is totally unimodular then every basic solution of Ax = b is integer.
For LP’s with equality constraints total unimodularity is sufficient but not necessary.
For LP with inequality constraints, Ax b, total unimodularity of A is both necessary and sufficient for all extreme points of s = {x : Ax b , x 0 } to be integer for every integer vector b.
Theorem 1:
20Department of Electrical Engineering - UMASS
Any IP with totally unimodular constraint matrix can be solved as an LP.
Totally unimodular matrix : a i j = 0 , +1, -1
Also, every determinant of A must be 0, +1 or -1
Conclusion:
21Department of Electrical Engineering - UMASS
are LP with the property that they possess optimal solutions in integers.
• max flow• min – cost flow• assignment problem• shortest path• transportation problem
Network flow problems:
Special Linear Programs with Integer Solutions
22Department of Electrical Engineering - UMASS
Assignment problem(special case of min – cost capacitated flow problems)
[ m jobs x m men ]
otherwise
jobtoassignedismanif0
ji1x ji
c i j = cost of assigning man i to job j
Some Totally Unimodular Linear Programs
23Department of Electrical Engineering - UMASS
ijij
ij xcMaxs. to.
10,
)1(1,1
)1(1,1
1
1
ij
ijm
j
ijm
i
x
manperjobmix
jobpermanmjx
Some Totally Unimodular Linear Programs
24Department of Electrical Engineering - UMASS
111111
X
111
11
1
111
11
1
1111
11
X11 X12 X13 X21 X22 X23 X31 X32 X33
Some Totally Unimodular Linear Programs
25Department of Electrical Engineering - UMASS
xcTmaxIn matrix notation:Ax = 1 where
110
1
1
011
01
1
0111
1
A
m 2m m2...
Exactly m 1’s in each rowExactly 2 1’s in each column
Some Totally Unimodular Linear Programs
26Department of Electrical Engineering - UMASS
• a set of origins V1 ; each origin i V1 ; supplies a1 of commodity.
• a set of destinations V2 ; each destination j V2 ; has a demand bi of commodity.
• cost per unit commodity; cij associated with sending commodity through (i, j ).
Given:
Network Flow Problems
27Department of Electrical Engineering - UMASS
jiji
2i
1
1i
iΓijji
iΓjiij
cx0
iΓVibVi0
iΓViaxx
))((for
for))((for
)(),()(),(
Constraint Set: (Totally unimodular)
Network Flow Problems
28Department of Electrical Engineering - UMASS
nodendestinatiofornodesernalintfornodesourcefor
)(),()(),( f0f
xxiΓijji
iΓjiij
Special case: for single source, single destination, max flow problem
in any case: Ax b
Network Flow Problems
29Department of Electrical Engineering - UMASS
No matter which problem it is:
cutminflowmax
flowtcosmin
the general format is A’x bIt can be shown that• If A is totally unimodular then [A/I ] is also totally
unimodular• The transpose of totally unimodular matrix is also totally
unimodular
• .
IAA'
where A = incidence matrix of the corresponding digraph, totally unimodular. I = identity matrix, A’ is totally unimodular.
Review
30Department of Electrical Engineering - UMASS
• Exploit a special structure of the problem (total unimodularity, etc.) to obtain integer solutions by solving simpler problems.
• Transform the problem to another problem for which an approximate solution is easier to find.
• Once the structure of the problem is well understood, use heuristic, but… stay away from brute force approach.
No efficient algorithms exist for general Integer Programming problems
Review
31Department of Electrical Engineering - UMASS
• Graph Theory• Mathematical Optimization
A large number of CAD problems can be cast in analytical form:
For some problems – efficient algorithms exist.For others – need to resort to heuristic, suboptimal solutions.Some known successful heuristic approaches
• Simulated annealing• LP rounding
Conclusions