1 / 86

Semi-Matchings for Bipartite Graphs and Load Balancing

Semi-Matchings for Bipartite Graphs and Load Balancing. Nick Harvey , Richard Ladner, Laszlo Lovasz, Tami Tamir. Talk Outline. “Swiss Bank” Problem Formal Definitions Optimal Semi-Matchings Algorithms Experiments. “Swiss Bank” Problem. 5 bank tellers each speaks a different language

rpeters
Télécharger la présentation

Semi-Matchings for Bipartite Graphs and Load Balancing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Semi-Matchingsfor Bipartite Graphsand Load Balancing Nick Harvey, Richard Ladner, Laszlo Lovasz, Tami Tamir

  2. Talk Outline • “Swiss Bank” Problem • Formal Definitions • Optimal Semi-Matchings • Algorithms • Experiments

  3. “Swiss Bank” Problem • 5 bank tellers • each speaks a different language • 10 bank customers • each speaks one or more languages • Assume servicing a customer takes1 time unit • Problem: Assign each customer to a teller

  4. Problem Model: Bipartite Graph Customers Tellers German Customer speaks German and Italian Italian French Romansh English

  5. Customer Assignment Customers Tellers German Italian French Romansh English

  6. Optimization Objectives Minimize: • Flow time: • Total time customers wait(or average time) • Makespan: • Maximum time a customer waits • Variance: • Load balance of tellers’ queue lengths

  7. Customer Queues Tellers German Italian French Romansh English Customer Wait Time (Flow Time) Wait Time 1 1 4+3+2+1=10 2+1=3 2+1=3 Total Wait Time: 1+1+10+3+3 = 18 units

  8. Customer Queues Tellers German Italian French Romansh English Square of difference from mean Teller Load and Variance Load Variance (1-2)2=1 1 (1-2)2=1 1 (4-2)2=4 4 (2-2)2=0 2 (2-2)2=0 2 Mean Load 10/5 = 2 Variance: (1+1+4+0+0)/5 = 6/5

  9. Optimal Assignment Customers Tellers German Italian French Romansh English Variance: 0 Total Wait Time: (2+1)*5 = 15 units

  10. Talk Outline • “Swiss Bank” Problem • Formal Definitions • Optimal Semi-Matchings • Algorithms • Experiments

  11. Formal Definitions • Let G = (UV, E) be a bipartite graph U V

  12. Matchings • M  Eis a matching if each vertex is incident with at most one edge in M U V The blue edges are a matching, M

  13. Philip Hall (1904-1982) Matchings • First studied by Philip Hall of Cambridge University • “Marriage Theorem” characterizes the existence of perfect matchings P. Hall, On representatives of subsets, J. London Math. Soc. 10 (1935), 26-30.

  14. Harold W. Kuhn Princeton University Matchings • “Hungarian Algorithm” used to find matchings of maximum cardinality H. W. Kuhn, The Hungarian method for the assignment problem, Naval Res. Logist. Quart. 2:83-97, 1955.

  15. Semi-Matchings • M  Eis a semi-matching if each U-vertex is incident with exactly one edge in M U V The blue edges are a semi-matching, M

  16. Max-Weight Semi-Matchings • Let w: E  R be an edge-weight function • Problem (Lawler ‘76): Find semi-matching M maximizing • Solvable by simple greedy algorithm Eugene Lawler, Combinatorial Optimization: Networks and Matroids. Holt, Rinehart & Winston, 1976.

  17. Optimal Semi-Matching, M • Edges are unweighted • Let degM(v) denote number of M-edges incident with vV • Define cost of M at a vertex vV: • Define c(M) = • M is an optimal semi-matching if c(M) is minimal

  18. Optimal Semi-Matchings • c(M) gives the total weighting time of the “customers” in U U V cM(v) 1 1 4+3+2+1=10 2+1=3 2+1=3 c(M)=1+1+10+3+3 = 18

  19. Talk Outline • “Swiss Bank” Problem • Formal Definitions • Optimal Semi-Matchings • Cost Reducing Paths • Optimality Criterion • Lp-norm • Algorithms • Experiments

  20. Optimality Properties • Optimal Semi-Matchings have useful load balancing properties: • Minimize variance of { degM(v) } • Minimize max { degM(v) } • Minimize Lp-norm of { degM(v) } • Optimal Semi-Matchings contain a maximum matching as a subset • And a max matching is easy to find

  21. Alternating Paths • Let P = (v1, u1, …, uk-1, vk) be a path in G • If {vi, ui} M and {ui, vi+1} E \ M for all i,then P is called an alternating path U V v3 u2 White edges are in E \ M v2 u1 P is an alternating path v1 Blue edges are in M

  22. Cost-Reducing Paths (CRPs) • Let P be an alternating path in G • If degM(vk) < degM(v1)-1 then P is called a cost-reducing path U V v3 degM(v3)= 1 u2 v2 u1 P is not a cost-reducing path v1 degM(v1)= 2

  23. Cost-Reducing Paths (CRPs) • Let P be an alternating path in G • If degM(vk) < degM(v1)-1 then P is called a cost-reducing path U V v2 degM(v2)= 1 u1 v1 degM(v1)= 4 P is a cost-reducing path

  24. Improvement with CRPs • Let P = (v1, u1, …, uk-1, vk) be a CRP • Remove {vi, ui} from M for all i • Add {ui, vi+1}to M for all i U V v2 degM(v2)= 2 degM(v2)= 1 u1 v1 degM(v1)= 4 degM(v1)= 3 P is a cost-reducing path

  25. Improvement with CRPs • cM(v1) decreases by degM(v1) • cM(vk) increases by degM(vk)+1 • Total decrease is (degM(v1)-degM(vk)-1) > 0 U V v2 cM(v2)= 3 cM(v2)= 1 u1 v1 cM(v1)= 10 cM(v1)= 6 c(M)Decrease of 4+ Increase of 2 = Decrease of 2

  26. Talk Outline • “Swiss Bank” Problem • Formal Definitions • Optimal Semi-Matchings • Cost Reducing Paths • Optimality Criterion • Lp-norm • Algorithms • Experiments

  27. Optimality Criterion • Theorem: A semi-matching is optimal if and only if no cost-reducing path exists • Proof: • Any CRP can reduce the cost of a semi-matching – this was just shown • If a semi-matching is not optimal then a cost-reducing path exists – this requires some proof

  28. Proof of Optimality Criterion • Let M be a suboptimal semi-matching • Let O be an optimal semi-matching with smallest symmetric difference  withM • In  color the edges of Mred and the edges in Ogreen • Let G be G restricted to edge-set  = (M \ O)(O \ M)

  29. Construction of G • Direct red edges VU and green edges UV Suboptimal M Optimal O G  M \ O O \ M

  30. Properties of G • Acyclicity • G contains no alternating red/green cycle • Monotonicity • If there is an alternating red/greenpath in G from v1 to v2 in V thendegO(v1)  degO(v2) • Both properties hold by choice of O

  31. degO(v) 2 2 2 2 2 Properties of G G O • Acyclic • Monotone

  32. degM(v) 3 2 3 2 0 G yields CRP for M G M There is acost-reducing red/green path for M

  33. Existence of CRP Proof • Choose V-vertex v1 such thatdegM(v1) > degO(v1) • Build red/green path in G untilwe find V-vertex v2 with degM\O(v2) = 0 • Path from v1 to v2 is a cost-reducing path for M! degM(v2) ≤ degO(v2) - 1 ≤ degO(v1) - 1 < degM(v1) - 1 arrived at v2 on O\M edge monotonicity choice of v1

  34. Talk Outline • “Swiss Bank” Problem • Formal Definitions • Optimal Semi-Matchings • Cost Reducing Paths • Optimality Criterion • Lp-norm • Algorithms • Experiments

  35. Lp-norm of load vector • Let xi = degM(vi) • The Lp-norm of the vector X=(x1,x2,…,xm) is • ||X||1 is always |U| • For any p>1, ||X||p is a measure ofthe balance of the load on V-vertices • ||X||2 is the sum of squares • ||X|| is the load of the most loaded V-vertex • ||X||p is everything in between ||X||p = (i xip)1/p

  36. Optimality of Lp-norm • Theorem: Let p>1. A semi-matching is optimal iff the Lp-norm of its load vector is optimal • Proof outline: Based on following claims • A cost-reducing path can reduce the Lp-norm of the load vector Proof: Simple calculation • A semi-matching M has optimal Lp-norm iff no cost-reducing path relative to M exists Proof: Similar to the proof for optimal total cost

  37. Optimality of L-norm • Theorem: An optimal semi-matching is optimal with respect to L (load on most loaded teller) • Proof: more complicated • The converse does not hold: xi xi 2 2 1 0 2 1 Optimal L Optimal semi-matching Total cost: 6 Total cost: 5

  38. Talk Outline • “Swiss Bank” Problem • Formal Definitions • Optimal Semi-Matchings • Algorithms • Network Flow Algorithms • Algorithm SM1 • Algorithm SM2 • Experiments

  39. Network Flow Algorithms • Can reduce semi-matching problem to known network-flow problems • Assignment ProblemRequires O(n0.5 m . log(n)) time(Gabow and Tarjan, 1989) • Min-cost Max-flow ProblemRequires O(n .m . log2(n)) time(Goldberg and Tarjan, 1987) where n=num vertices andm=num edges

  40. Assignment Problem Assignment Problem G

  41. Min-cost Max-flow Problem Cost Centers U V Source Sink

  42. Talk Outline • “Swiss Bank” Problem • Formal Definitions • Optimal Semi-Matchings • Algorithms • Network Flow Algorithms • Algorithm SM1 • Algorithm SM2 • Experiments

  43. Algorithm SM1 • Simple modification of “Hungarian Algorithm” for Bipartite Matching • Runtime: O(n .m) (n=|U|+|V| and m=|E|) • Same as Hungarian Algorithm • Actual performance is not good

  44. Algorithm SM1 Pseudocode • Initially M is empty • For each uU • Build tree T of alternating paths rooted at u • Let v be a V-vertex in T such that degM(v) is minimum • Switch matching and non-matching edges on path from v to u • Note: u is matched and |M| increased by one

  45. Algorithm SM1 Example U V 1 Initially: no one is assigned. 1 Step 1: assign u1 to a least loaded V-vertex 2 3 4 5

  46. Algorithm SM1 Example U V 1 1 Step 2: assign u2 2 2 3 4 5

  47. Algorithm SM1 Example U V 1 Step 3: assign u3 1 2 3 Can increase the load on v2 2 or v1 or v3 3 v3 is the least loaded 4 5

  48. Algorithm SM1 Example U V 1 1 2 3 2 3 4 5

  49. Talk Outline • “Swiss Bank” Problem • Formal Definitions • Optimal Semi-Matchings • Algorithms • Network Flow Algorithms • Algorithm SM1 • Algorithm SM2 • Experiments

  50. Algorithm SM2 • General idea: Find and remove cost-reducing paths • Runtime: O(|U|3/2 . |E|) • Worse bound than Algorithm SM1 • Actual performance is very good!

More Related