Discrete Optimization 2010 Lecture 6 Total Unimodularity ...
Transcript of Discrete Optimization 2010 Lecture 6 Total Unimodularity ...
Total Unimodularity Matching Problem
Discrete Optimization 2010Lecture 6
Total Unimodularity & Matchings
Marc UetzUniversity of Twente
Lecture 6: sheet 1 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Outline
1 Total Unimodularity
2 Matching Problem
Lecture 6: sheet 2 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Question
Under what conditions on A and b is it true that all vertices ofP = {x ∈ Rn | Ax ≤ b, x ≥ 0} happen to be integer?
Answer: If A is totally unimodular, and b integer
Lecture 6: sheet 3 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
(Totally) Unimodular Matrices
Definition
1 An integer square matrix B ∈ Zn×n is unimodular ifdet(B) = ±1
2 An integer matrix A ∈ Zm×n is totally unimodular (TU) ifeach square submatrix B of A has det(B) ∈ {0,±1}.
Some easy facts:
entries of a TU matrix are {0,±1} by definition (1× 1submatrices)
if A is TU, adding or deleting a row or column vector(0, . . . , 1, . . . , 0), the result is again TU
if A is TU, multiplying any row/column by −1, the result isagain TU
Lecture 6: sheet 4 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Motivation
If all vertices of {x ∈ Rn | Ax ≤ b, x ≥ 0} are integer, for any cthe linear program
max ctx
s.t. Ax ≤ b, x ≥ 0
(if not infeasible or unbounded) has an integer optimal solutionas the set of optimal solutions of P is a face of {x | Ax ≤ b, x ≥ 0}
In that case, we can even solve integer linear programmingproblems by solving an LP only (say with Simplex), because anoptimum solution (if it exists) also occurs at a vertex whichhappens to be integer.
Lecture 6: sheet 5 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Integrality of Linear Equality Systems
Theorem
Let B be an integer square matrix that is nonsingular (that is,det(B) 6= 0), consider system Bx = b. Then x is integer for anyinteger right-hand-side b if and only if B is unimodular.
”if” x = B−1b, and by Cramer’s rule (Linear Algebra):
xj =det(B j)
det(B)
with B j = B, but with jth column of B replaced by b”only if” x = B−1b integer for all b, also for bt = (0, . . . , 1, . . . , 0)
such an x exactly equals a column of B−1
so all columns of B−1 are integer, and so is det(B−1)but det(B) det(B−1) = 1, both integer, so both are ±1
Lecture 6: sheet 6 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
TU Matrices and Integrality
Define for A ∈ Rm×n, b ∈ Rm
P(A) = {x ∈ Rn | Ax ≤ b, x ≥ 0}
Theorem
If A is TU and b integer, then P(A) has integer vertices only.
Lecture 6: sheet 7 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Proof
P(A) = {x ∈ Rn | Ax ≤ b, x ≥ 0}
If P(A) = ∅ nothing to prove. We write
P(A) = {x |[
A−E
]x ≤
[b0
]}. As A is TU, so is
[A−E
].
A vertex x of P(A) exists (see Exercise), and is defined by nlinearly independent inequalities of this system, so by Aox = bo for
non-singular subsystem Ao , bo of
[A−E
]x ≤
[b0
].
As Ao non-singular and TU, det(Ao) = ±1, so x = (Ao)−1bo isinteger.
Lecture 6: sheet 8 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
The whole story: Hoffman-Kruskal Theorem
P(A) = {x ∈ Rn | Ax ≤ b, x ≥ 0}
We proved sufficiency:
Theorem
If A is TU and b integer, then P(A) has integer vertices only.
It also holds necessity (see Literature, Theorem 6.25):
Theorem
If P(A) has integer vertices for all integer b, then A is totallyunimodular.
Lecture 6: sheet 9 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Sufficient Condition Total Unimodularity
Theorem
A matrix A is totally unimodular if no more than 2 nonzeros are ineach column, and if the rows can be partitioned into two sets I1and I2 such that
1 If a column has two entries of the same sign, their rows are indifferent sets of the partition
2 If a column has two entries of different sign, their rows are inthe same set of the partition
Proof: By induction on the size of the square submatrices
Lecture 6: sheet 10 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Sufficient Condition Total Unimodularity!"#$%&'
!!
!"
Lecture 6: sheet 11 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Minimum Cost Flows
Theorem
The node-arc incidence matrix of any directed graph G = (V ,E ) istotally unimodular.
Proof: Rows have one +1 and one −1, so take I1 = V , I2 = ∅
Consequence
The linear program for Min-Cost Flow always has integer optimalsolutions, as long as capacities uij and balances b(i) are integer.
The dual linear program always has integer optimal solution, aslong as the costs cij are integer.
Lecture 6: sheet 12 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Outline
1 Total Unimodularity
2 Matching Problem
Lecture 6: sheet 13 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
The Matching Problem
Definition
A matching in an undirected graph G = (V ,E ) is a set M ⊆ E ofpairwise non-incident edges.
Given an undirected graph G = (V ,E ), a maximum matching isone with maximal cardinality. Perfect matching: |M| = |V |/2
!"#$%$&$'%(
!"#$%$&$'%()*)+,&-.$%/)0! 1)$%),%)2%3$4"-&"3)/4,5.)6789:1;)$<),)<"&)'#)3$<='$%&)"3/"<>
!"#$%$&$'%()*)+,?$+,@)+,&-.$%/+,?$+,@)+,&-.$%/ 0)$<)'%")<2-.)&.,&)0"A"B)$<)%'&),)+,&-.$%/)#'4),@@)"# 1C0>)*)+,?$+2+)+,&-.$%/+,?$+2+)+,&-.$%/ $<),)+,&-.$%/)'#)+,?$+2+)-,43$%,@$&D
+,?$+,@)E)+,?$+2++,?$+,@
!"#$%$&$'%()*)+,&-.$%/)0! 1)$<),)5"4#"-&)+,&-.$%/5"4#"-&)+,&-.$%/ $#),@@)F"4&$-"<),4")$%-$3"%&)&'),%)"3/")"#0>
Lecture 6: sheet 14 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Special Case: Bipartite Matching
Special Case
Matching in bipartite graphs G = (V1,V2,E ), where E ⊆ V1 × V2.
!"#$%&"&'()$&*+",-(.%/01'2
! !"#$%&%' ()*+$%)(&,%+&%-! %' .%"#$/(")"$(&01/&,%&$234,%5$
! 6,34&()*+$%)&5"#$(&,&/,%7"%5&10&)4$&.%"#$/(")"$(
!1%&,&(3,8$&'&9)1:;&*:&)1&%- 9<1))1=;
! >/1<8$=?&
@ A"%+&,&=,)34"%5=,)34"%5 10&()*+$%)(&)1&.%"#$/(")"$(&(*34&)4,)&$#$/B<1+B&"(&=,)34$+C&=,7"%5&)4$&D418$&($)&10&()*+$%)(&,(&4,::B&,(&:1(("<8$()*+$%)(&,(&4,::B&,(&:1(("<8$
()*+$%)(.%"#$/(")"$(
V1 V2
Lecture 6: sheet 15 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Bipartite Graphs
Theorem
Graph G = (V ,E ) is bipartite if and only if G contains no oddcycle.
Proof: (w.l.o.g. assume G connected)
Necessity: Trivially, a bipartite graph has no odd cycle.
Sufficiency: Given G with no odd cycle. Pick vo ∈ V . Define
V1 = {v ∈ V | dist(vo , v) even}V2 = {v ∈ V | dist(vo , v) odd}
Then V1 ∪ V2 = V is a bipartition with no edges within V1, V2.
Lecture 6: sheet 16 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Matching Algorithms: Basic Ideas
matchings are an independence system but no matroid
greedy algorithm yields maximal matching, but needn’t bemaximum
for M = maximal matching, and M∗ = maximum matching,|M| ≥ 1
2 |M∗| (Exercise)
Idea for matching algorithm: Start with maximal matching, lookfor augmenting paths
!"#$%&'()*+(,-&#%./0)1"/&$)234"/
! !"#$%&'()&&*+',%(-)"./#0!.,).'1"./'2'3'!456'%-7(',6',7'&*(&'8,7'9&',**&*'.-'2:',**'".4
;)"<",%'-96&)<,."-70'5%1,+6'+"&%*6','#,="#,%'#,.8/"7(4
>)-9%�'#"(/.'(&.'6.?8@'1"./'#,.8/"7(#,.8/"7( ./,.'"67"67AA.'#,="#?#.'#,="#?#0
! B*&,0!.,).'1"./'6-#&'#,="#,%'#,.8/"7('C6&&',9-<&D56'%-7(',6',%.&)7,."7(',?(#&7."7(''$,./6,%.&)7,."7(',?(#&7."7(''$,./6 8,7'9&'E-?7*:'"#$)-<&0
"2
"2
"2!2
!2
"2!2
!2
!2"2
E)&&
E)&&
Lecture 6: sheet 17 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Alternating & Augmenting Paths!"#$%&'#(&)*'+),$&#(&)-.'#/0
!"#$%&!#'&()!M "M !M "M !M "M
!*(+$&#'&()
free free
"M !M "M !M "M
!M "M !M "M !M
,-.$%/!#'0&)12&1!*(+$&#'&(13!#41+*.#14!/$10551"$&(#46
Lecture 6: sheet 18 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Alternating Path Theorem
Observation: Let M be a matching of G = (V ,E ), and let P be anaugmenting path (for M), then M ⊕ P is a matching with oneedge more.
M ⊕ P = M ∪ P \M ∩ P
Theorem (Berge 1957)
M is a maximum matching if and only if there are no augmentingalternating paths (for M).
Proof: Necessity is clear, sufficiency: Assume matching M ′ largerthan M and consider M ⊕M ′. Show that this contains anaugmenting alternating path for M. (see page 129, reader)
Lecture 6: sheet 19 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Maximum Bipartite Matching and Maximum Flow!"#$%&%'($)"*+$+,'!"+-.$/0'12'!"#$%&%'3456
v2
w2
w3
v3
v4
w4
w5
v5
v1
w1
ts
v2
w2
w3
v3
v4
w4
w5
v5
v1
w1
!""#$!%!$&'&()#(*+!"#,
Lecture 6: sheet 20 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Maximum Bipartite Matching and Maximum Flow
Augmenting Path Algorithm for MaxFlow
Flow values are either 0 or 1
flow 1 on (v ,w) ⇔ edge {v ,w} ∈ M
any feasible flow yields matching (why?)
flow value v = size of the matching |M|Computation time O( v(n + m) ) ∈ O( nm )!"#$"#%&'(%)*#+"#%&,-+./0&1"2-3+"+*&43-2./
!"#$%&'(%)*+,%)*$$%-.%/01%)*+,%"22%345+6$7.%+528%,"19:;5<%$6<$%,"8%/$%07$6%1+%9+51;50$%=;)%;1%$>;717?
v2
w2
w3
v3
v4
w4
w5
v5
v1
w1
v1
w1
w3
v4
v5
w2
w4
v2
v3
w5
@2";,A%B%7:+*1$71%"0<,$51;5<%C"1:%;7%)+056%=;)%;1%$>;717?
D*++)A%E%/;C"*1;1$%! 1:$*$%"*$%5+%+66%9892$75+%+66%9892$7F%(+%;)%1:$*$%;7%"5%"0<,$51;5<%C"1:%71"*1;5<%"1%7+,$%-%$56;5<%"1%7+,$%3%%
v w
vvw w
&8%&'(%3$%$;1:$*%);56%1:;7%C"1:.%+*%"%7:+*1901%+)%1:;7%C"1:G%&01%"58%7:+*1901%$6<$%,071%71"*1%"1%7+,$%-%"56%$56%"1%7+,$%3G%(+%;1%8;$267%"5%"0<,$51;5<%C"1:.%1++G%%
Question
What are the flow augmenting paths?
red arc: flow 1, backward arc in residual graph
black arc: flow 0, forward arc in residual graph
So, flow augmentation = augmenting alt. path
Lecture 6: sheet 21 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Problem for Non-Bipartite Graphs
Odd cycles:
flow augm. pathno matching!
Lecture 6: sheet 22 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Edmonds’ Breakthrough
Theorem (Edmonds 1965)
There exists a polynomial time algorithm for finding a maximummatching in any (also non-bipartite) graph. O( n3 ) time
Paths, Trees, and Flowers, Canad. J. Math. 17 (1965)
Main idea: ‘Shrink the blossoms (odd cycles)’
!"#$%&'()*&*+,-)('./0
!"#$%#&'()*&$+*,'-./012'!"#%#'#34,5,'6+'7(+81'54&#'69:$%45"&';$%'<$&=>54+:'6'&634&>&'<6%*4+6945?'&65<"4+:'4+'6+?'(69,$'+$+@A4=6%545#1':%6="'BC(DE)1F
G*#62'7**'<?<9#,'<%#65#'=%$A9#&,H'I$'J>,5',"%4+K'5"#&J>,5',"%4+K'5"#& 5$'$+#'+$*#'6+*'<$+54+>#L
3 >
M
N
? ?
3>MN
N#',K4='5"$,#'*#5649,FWhy breakthrough? (first polynomial time algorithm for aproblem where the constraint matrix isn’t TU)
Lecture 6: sheet 23 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Matching: Integer Linear Programming Formulation
Recall δ(v) = edges incident with v
xe = 1 if edge e is in M
max∑e∈E
xe
s.t.∑
e∈δ(v)
xe ≤ 1 v ∈ V
xe ∈ {0, 1} e ∈ E
With A = node-edge incidence matrix, this is
max 1 · xs.t. Ax ≤ 1
x ≥ 0, integer
Lecture 6: sheet 24 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Matching: Linear Programming Formulation
Theorem
Node-edge incidence matrix A of an undirected graph is totallyunimodular if (and only if) G is bipartite. (Exercise)
Consequence?
The linear program (LP) for the matching problem
max 1 · xs.t. Ax ≤ 1
x ≥ 0
always has an integer optimal solution (a matching), if G bipartite.
And as before, the same holds for the dual LP . . . what is the dual?
Lecture 6: sheet 25 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Matching & Node Cover!"#$%&'()*)+,-.)/,0.1
!
"
#
$
%
&
'()*+!(,*-.
/#0!1234.
56#7208.+!! " 91*-*+$+:+&;<+=6*>02(3.+?1*3+2>+!@"AWe know µ ≤ ν (why?)
Lecture 6: sheet 26 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Matching & Node Cover in Bipartite Graphs
Theorem (Konig 1931)
In any bipartite graph G , the size of a maximum matching equalsthe size of a minimum node cover.
!"#$%& '()*+),
!"#$%#&'()*(+*,(-./+%0.0#(1%+/"(2345!67(897(0"#(:.;#($<(+(&+=.&+>(&+0?".*1&+=.&+>(&+0?".*1 #@A+>:(0"#(:.;#($<(+(&.*.&+>(*$B#(?$C#%&.*.&+>(*$B#(?$C#%D(
E%$$<'(F$*:.B#%(4*$*G.*0#1%+>9(>.*#+%(/%$1%+&&.*1(<$%&A>+0.$*(<$%(&+0?".*17(0"#*(0"#(BA+>(.:(0"#(*$B#(?$C#%(/%$->#&D(!"#(?$*:0%+.*0(&+0%.=(.:(!HI(.<(2(.:(-./+%0.0#7(:$(+*(.*0#1#%(/%.&+>.*0#1#%(/%.&+>GGBA+>(/+.%BA+>(/+.% #=.:0:D
Lecture 6: sheet 27 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Proof of Konig’s Theorem
The Linear Programming relaxations of Matching and Node Coverare the following primal dual pair:
Matchingmax 1 · xs.t. Ax ≤ 1
x ≥ 0
Node Covermin 1 · ys.t. Aty ≥ 1
y ≥ 0
Bipartite graph ⇒ matrix A is TU ⇒ ∃ optimal primal-dual pairthat is integer, and this is the desired matching/node-cover.
Lecture 6: sheet 28 / 29 Marc Uetz Discrete Optimization
Total Unimodularity Matching Problem
Square Submatrix
1 0 1
1
0
1
0
0
0
1
0
1
1 1
0 1
Back
Lecture 6: sheet 29 / 29 Marc Uetz Discrete Optimization