Topics in Combinatorial Optimization Orlando Lee Unicamp 15 de - - PowerPoint PPT Presentation

topics in combinatorial optimization
SMART_READER_LITE
LIVE PREVIEW

Topics in Combinatorial Optimization Orlando Lee Unicamp 15 de - - PowerPoint PPT Presentation

Topics in Combinatorial Optimization Orlando Lee Unicamp 15 de abril de 2014 Orlando Lee Unicamp Topics in Combinatorial Optimization Agradecimentos Este conjunto de slides foram preparados originalmente para o curso T opicos de


slide-1
SLIDE 1

Topics in Combinatorial Optimization

Orlando Lee – Unicamp 15 de abril de 2014

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-2
SLIDE 2

Agradecimentos

Este conjunto de slides foram preparados originalmente para o curso T´

  • picos de Otimiza¸

c˜ ao Combinat´

  • ria no primeiro

semestre de 2014 no Instituto de Computa¸ c˜ ao da Unicamp. Preparei os slides em inglˆ es simplesmente porque me deu vontade, mas as aulas ser˜ ao em portuguˆ es (do Brasil)! Agradecimentos especiais ao Prof. M´ ario Leston Rey. Sem sua ajuda, certamente estes slides nunca ficariam prontos a tempo. Qualquer erro encontrado nestes slide ´ e de minha inteira responsabilidade (Orlando Lee, 2014).

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-3
SLIDE 3

Matching theory

Matching in graphs is one of subjects of graph theory and combinatorial optimization that accumulated a large body of theory. We will start with the study of matchings in bipartite graphs. We postpone the study of matchings for general graphs for a later part of the course.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-4
SLIDE 4

Matchings

A matching in a graph G = (V , E) is a subset of edges which contains no edges with a common end.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-5
SLIDE 5

Matchings

u v If uv ∈ M then we say that u is matched with v (through M).

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-6
SLIDE 6

Matchings

We say that a vertex incident to an edge of M is covered by M. An uncovered vertex is free of M.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-7
SLIDE 7

Matchings

A matching M is perfect if covers every vertex of G.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-8
SLIDE 8

Matchings

P2n C2n K2n Kn,n Graphs that have perfect matchings.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-9
SLIDE 9

Emparelhamentos

C2n+1 Kn,m Not every graph has a perfect matching.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-10
SLIDE 10

Matchings

A matching is maximal if it cannot be extended to a larger matching. A matching M is maximum if there is no matching larger than M.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-11
SLIDE 11

Problems of interest

Maximum Matching Problem: given a graph G, find a maximum matching of G. Perfect Matching Problem: given a graph G, find, if it exists, a perfect matching of G. Maximum Weight Matching: given an edge-weighted graph (Ga, w), find a maximum weight matching of Ga. Maximum Weight Perfect Matching: given an edge-weighted graph (G, w), find a maximum weight perfect matching of G.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-12
SLIDE 12

Alternating paths

Let M be a matching in a graph G. An M-alternating path or just alternating path is a path whose edges are alternatingly in M and out of M.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-13
SLIDE 13

Augmenting paths

An M-alternating path whose ends are free of M is called M-augmenting path or just augmenting path.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-14
SLIDE 14

Augmenting paths

M M′ P M′ := M △ EP is a matching with |M′| = |M| + 1 Notation: A △ B := (A ∪ B) − (A ∩ B) (symmetric difference).

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-15
SLIDE 15

Berge’s theorem

  • Theorem. (Berge, 1957) A matching M in a graph G is maximum

if and only if G contains no M-augmenting path. Proof. M is maximum = ⇒ G contains no M-augmenting path Suppose that G contains an augmenting path P. Let M′ := M △ EP. Then |M′| = |M| + 1 and M is not maximum.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-16
SLIDE 16

Berge’s theorem

G contains no M-augmenting path = ⇒ M is maximum Suppose thatM is not maximum and let M∗ be a maximum matching of G. So |M∗| > |M|. let us show that G contains an M-augmenting path. Let H := G[M △ M∗].

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-17
SLIDE 17

Berge’s theorem

Example: M M∗ H := G[M △ M∗]

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-18
SLIDE 18

Berge’s theorem

Every vertex in H = G[M △ M∗] has degree one or two. Each component of H is

either a cycle with edges alternating in M and M∗,

  • r a path with edges alternating in M and M∗.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-19
SLIDE 19

Berge’s theorem

Since |M∗| > |M|, H contains more edges from M∗ than from M. Thus, some path component P in H must start and end with edges of M∗. This is an M-aumenting path.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-20
SLIDE 20

Maximum matching in bipartite graphs

Consider the problem of finding a maximum matching in an (X, Y )-bipartite graph G. We have seen that a matching M is maximum if and only if G contains no M-augmenting paths. However, it would be much better if we had a simple certificate of a maximality of a given matching.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-21
SLIDE 21

Vertex cover

A vertex cover in a graph G = (V , E) is a subset U of V such that every edge of G has one end in U.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-22
SLIDE 22

Matching versus vertex cover

  • Lemma. Let M be a matching and U a vertex cover in a graph G.

Then |M| ≤ |U|. Furthermore, if equality holds then M is a maximum matching and U is a minimum vertex cover.

  • Proof. Each edge of M has one end in U. Hence,

|M| ≤ |U|.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-23
SLIDE 23

Matching versus vertex cover

M∗ = U∗ M∗ < U∗ It is not always true that the size of a maximum matching is equal to the size of a minimum vertex cover. We will show that equality holds for bipartite graphs.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-24
SLIDE 24

Maximum matching in bipartite graphs

Let G be a (X, Y )-bipartite graph. Let M be a matching. Let DM be the digraph obtained from G by orienting each edge e = xy of G (with x ∈ X and y ∈ Y ) as follows: if e ∈ M then orient e as (y, x), if e ∈ M then orient e as (x, y). Let XM and YM be the subsets of vertices of X and Y (resp.) that are free of M. Clearly, G contains an M-augmenting path if and

  • nly if DM contains an XMYM-path.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-25
SLIDE 25

Maximum matching in bipartite graphs

X Y G contains an M-augmenting path if and only if DM contains an XMYM-path.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-26
SLIDE 26

Maximum matching in bipartite graphs

The following algorithm obviously produces a maximum matching

  • f a (X, Y )-bipartite graph G.

MaxBipartiteMatching(G)

  • 1. M ← ∅

⊲ or any matching

  • 2. while there exists an XMYM-path Q in DM do

3. let P be the augmenting path corresponding to Q 4. M ← M △ E(P)

  • 5. return M
  • Theorem. (Kuhn, 1955) A maximum matching in a bipartite graph

can be found in time O(nm).

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-27
SLIDE 27

  • nig’s theorem
  • Theorem. (K˝
  • nig, 1931) Let G be a bipartite graph. Then the size
  • f a maximum matching is equal to the size of a minimum vertex
  • cover. Moreover, given a maximum matching, we can find a

minimum vertex cover of G in time O(m).

  • Proof. We have seen that the maximum is at most the minimum.

Let M be a maximum matching and let DM, XM and YM as previously defined. Let RM be the set of vertices reachable from XM in DM. Thus, RM ∩ YM = ∅.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-28
SLIDE 28

  • nig’s theorem

X Y RM So each edge of M has both ends in RM or none at all. Moreover, no edge of G connects X ∩ RM and Y \ RM. Hence, (X \ RM) ∪ (Y ∩ RM) is a vertex cover with the same size

  • f M.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-29
SLIDE 29

Hall’s condition

X Y Does there exist a matching that covers X?

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-30
SLIDE 30

Hall’s condition

X Y S Does there exist a matching that covers X?

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-31
SLIDE 31

Hall’s condition

X Y S Γ(S) Γ(S) := set of neighbors of S |Γ(S)| < |S| = ⇒ no matching covers X

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-32
SLIDE 32

Hall’s condition

X Y S Γ(S) If there exists a matching that covers X, then |Γ(S)| ≥ |S| for all S ⊆ X.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-33
SLIDE 33

Hall’s theorem

  • Theorem. (Hall, 1935)

A (X, Y )-bipartite graph has a matching that covers X if and only if |Γ(S)| ≥ |S| for all S ⊆ X.

  • Proof. We have seen that condition is necessary. Let us show

sufficiency. Let M be a maximum matching. If it covers X then the result follows. Let DM, XM and YM as defined in the MaxBipartiteMatching

  • algorithm. Let RM be the set of vertices reachable from XM in DM.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-34
SLIDE 34

  • nig’s theorem

X Y S So each edge of M has both ends in RM or none at all. Moreover, no edge of G connects X ∩ RM and Y \ RM. Let S := RM ∩ X. Then |Γ(S)| < |S|.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-35
SLIDE 35

Some consequences

  • Corollary. There exists an O(nm) algorithm that given an

(X, Y )-bipartite graph, returns either a matching that covers X or a subset of X that violates Hall’s condition.

  • Corollary. (Frobenius, 1917) A (X, Y )-bipartite graph with

|X| = |Y | has a perfect matching if and only if |Γ(S)| ≥ |S| for all S ⊆ X. A graph G is k-regular if every vertex has degree k. A graph G is regular if is k-regular for some k 0.

  • Corollary. A regular bipartite graph has a perfect matching.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-36
SLIDE 36

Equivalence between Menger’s and K˝

  • nig’s theorems

We have seen that Menger’s theorem implies K˝

  • nig’s theorem.

More precisely, we have shown how to reduce the maximum bipartite matching problem to the problem of finding a maximum packing of st-paths in a digraph D. Moreover, the reduction is polynomial. The reverse reduction is also possible, but much more

  • difficult. See Schrijver’s book (chapter 16).

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-37
SLIDE 37

Maximum weight matching

Maximum weight matching problem: given a bipartite graph G = (V , E) and an edge-weight function w : E → Q+, find a maximum weight matching. Maximum weight perfect matching problem (MWPM): given a bipartite graph G = (V , E) containing a perfect matching and an edge-weight function w : E → Q, find a maximum weight perfect matching. The first problem can be easily reduced to the second one. So we will describe a solution for the second problem.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-38
SLIDE 38

Incidence matrix of a graph

Let G = (V , E) be a graph. The incidence matrix of G is the {0, 1}-matrix M with rows indexed by V and columns indexed by E such that: M[v, e] = 1 if e is incident to v,

  • therwise.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-39
SLIDE 39

ILP formulation

The following ILP is equivalent to the MWPM. max

  • e∈E w(e)x(e)

s.t. x(δ(v)) = 1 for every v ∈ V , x(e) ∈ {0, 1} for every e ∈ E. This is equivalent to: max wx s.a Mx = 1 x ∈ {0, 1}E

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-40
SLIDE 40

LP formulation

Consider the relaxed linear programming (LP). max

  • e∈E w(e)x(e)

s.t. x(δ(v)) = 1 for every v ∈ V , x(e) 0 for every e ∈ E. This is equivalent to: max wx s.a Mx = 1 x 0

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-41
SLIDE 41

Dual problem

The dual problem (DP) is the following. min

  • v∈V y(v)

s.t. y(u) + y(v) w(e) for every e = uv ∈ E, Or equivalently, min y1 s.a yM w We say that a feasible dual solution of (DP) is a w-cover.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-42
SLIDE 42

Weak duality theorem

  • Lemma. Let M be a perfect matching and let y be a w-cover.

Then w(M) y(V ).

  • Proof. Just observe that

w(M) =

  • e∈M

w(e)

  • e=uv∈M

(y(u) + y(v)) =

  • v∈V

y(v) = y(V ). Or, in matricial notation, for x = χM, we have wx yMx = y1.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-43
SLIDE 43

Hungarian method

Egerv´ ary (1931) proved that the strong duality holds even if we require x to be integral. Kuhn (1955) described the first (strongy) polynomial algorithm for the MWPM (inspired on Egerv´ ary’s proof). We present this algorithm which is often called the Hungarian method. As a byproduct, we have that the polytope of the LP formulation is integral, namely, every extreme point (vertex)

  • f the polytope is integral.

Moreover, if the weight function w is integral, then there exists an optimal dual solution (w-cover) which is integral.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-44
SLIDE 44

Complementary slackness

The primal and dual problems are max

  • e∈E w(e)x(e)

s.t. x(δ(v)) = 1 for every v ∈ V , x(e) 0 for every e ∈ E. and min

  • v∈V y(v)

s.t. y(u) + y(v) w(e) for every e = uv ∈ E, Complementary Slackness x(e) > 0 ⇒ y(u) + y(v) = w(e) for every e = uv ∈ E.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-45
SLIDE 45

Complementary slackness

So two solutions x, y of the primal and dual formulation are both

  • ptimal if and only if they satisfy complementary slackness

conditions x(e) > 0 ⇒ y(u) + y(v) = w(e) for every e = uv ∈ E. Let y be a w-cover. Let ¯ w(e) := y(u) + y(v) − w(e) for each e = uv ∈ E. So ¯ w(e) 0 for each edge e ∈ E. Let E = := {e ∈ E : ¯ w(e) = 0}. We say that an edge in E = is tight.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-46
SLIDE 46

Subgraph of tight edges

Complementary slackness x(e) > 0 ⇒ y(u) + y(v) = w(e) for every e = uv ∈ E. If x = χM for some perfect matching then this is equivalent to: M ⊆ E =. So we could try to find a perfect matching M in the equality subgraph G = = (V , E =) using MaxBipartiteMatching. If it finds a perfect matching M then it has maximum weight and we are done.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-47
SLIDE 47

Updating the dual variables

X Y S If no perfect matching exists in G =, then there exists S ⊆ X such that |ΓG =(S)| < |S|.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-48
SLIDE 48

Updating the dual variables

X Y S Since G has a perfect matching, there must exist some edge e in G from S to Y \ ΓG =(S). Clearly, ¯ w(e) = y(u) + y(v) − w(e) > 0 where e = uv.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-49
SLIDE 49

Updating the dual variables

X Y S Hence ǫ := min{¯ w(e) : e = uv, u ∈ S, v ∈ Y \ ΓG =(S)}> 0.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-50
SLIDE 50

Updating the dual variables

X Y −ǫ −ǫ −ǫ −ǫ −ǫ +ǫ +ǫ +ǫ UpdateDual(y, w, S)

  • 1. ǫ := min{¯

w(e) : e = uv, u ∈ S, v ∈ Y \ ΓG =(S)}

  • 2. for each v ∈ S do y(v) ← y(v) − ǫ
  • 3. for each v ∈ ΓG =(S) do y(v) ← y(v) + ǫ
  • 4. return y

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-51
SLIDE 51

Updating the dual variables

  • Lemma. If y is a feasible dual solution and S is a set violating

Hall’s condition in G =, then the vector y ′ returned by UpdateDual is also a feasible dual solution. Moreover, (a) every tight edge for y remains tight for y ′ (b) at least one new edge with an end in Y \ ΓG =(S) becomes tight, (c) if w is integral and y is integral, then y′ is also integral. .

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-52
SLIDE 52

Hungarian algorithm – first version

HungarianAlgorithm(G, X, Y , w)

  • 1. let y be a w-cover
  • 2. compute G =
  • 3. while TRUE do

4. if G = has a perfect matching M 5. then 6. return M and y 7. else 8. let S a subset of X violating Hall’s condition 9. UpdateDual(y, w, S) 10. update G =

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-53
SLIDE 53

Perfect matching in G =

We have seen how to find either a perfect matching or a set violating Hall’s condition. In order to analyze the efficiency of the algorithm, it is more convenient if we explicit this process in the code. Recall the algorithm MaxBipartiteMatching. For a matching M of G = let DM, XM and YM as previously defined but now with respect to G = and not G. So G = has an augmenting path if and only if there exists an XMYM-path in DM.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-54
SLIDE 54

Hungarian algorithm – second version

HungarianAlgorithm(G, X, Y , w)

  • 1. let y be a w-cover
  • 2. M ← ∅
  • 3. compute G =, DM, XM, YM
  • 4. while M is not perfect do

5. if there exists an XMYM-path P in G = 6. then M ← M △ E(P) 7. else 8. let S the set of vertices in X reachable from XM 9. UpdateDual(y, w, S) 10. update G =

  • 11. return M and y

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-55
SLIDE 55

Analysis

An initial feasible w-cover is y(v) = max{w(e) : e ∈ E} for v ∈ X and y(v) = 0 for v ∈ Y . So if w is integral, then y is integral throughout the execution of the algorithm. When M is a perfect matching in G = then M and y satisfy complementary slackness and both are optimal solutions. By (a) and (b) from the lemma, after an update of y and G =, at least one new vertex becomes reachable from XM. Hence the number of consecutive updates in lines 9-10 until an augmentation

  • ccurs in line 5-6 occurs is at most |X|.

The number of augmentations is at most |X|. An XY -path can be found in linear time by breadth-first search.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-56
SLIDE 56

Consequences

  • Theorem. Given a weighted bipartite graph (G, w) containing one

perfect matching, HungarianAlgorithm returns a maximum perfect matching M and a minimum w-cover y in time O(nm2). Moreover, if w is integral, then y is also integral.

  • Corollary. Let G be a bipartite graph containing a perfect
  • matching. Then every extreme point of the polytope

x(δ(v)) = 1 for every v ∈ V , x(e) 0 for every e ∈ E is integral.

  • Exercise. Find a very small non-bipartite graph for which the above

polytope is not integral.

Orlando Lee – Unicamp Topics in Combinatorial Optimization

slide-57
SLIDE 57

References

The proofs of Hall’s and K˝

  • nig’s theorem can be found in several
  • books. The proofs given here are essentially the proofs in Bondy

and Murty’s book. I used the definition of DM in Schrijver’s book (page 264) to simplify some algorithmic aspects (but probably this was used before). For the Hungarian Algorithm, I followed Franks’s book (page 111–113). J.A. Bondy and U.S.R. Murty, Graph Theory with Applications, Norht-Holland, 1976.

  • A. Schrijver, Combinatorial Optimization, Vol. A, Springer.
  • A. Frank, Connections in Combinatorial Optimization, Oxford.

Orlando Lee – Unicamp Topics in Combinatorial Optimization