Semi-Matchings for Bipartite Graphs and Load Balancing - PowerPoint PPT Presentation

1 / 86
About This Presentation
Title:

Semi-Matchings for Bipartite Graphs and Load Balancing

Description:

Semi-Matchings for Bipartite Graphs and Load Balancing Nick Harvey, Richard Ladner, Laszlo Lovasz, Tami Tamir Talk Outline Swiss Bank Problem Formal Definitions ... – PowerPoint PPT presentation

Number of Views:211
Avg rating:3.0/5.0
Slides: 87
Provided by: nick61
Category:

less

Transcript and Presenter's Notes

Title: Semi-Matchings for Bipartite Graphs and Load Balancing


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
Tellers
Customers
German
Customer speaks German and Italian
Italian
French
Romansh
English
5
Customer Assignment
Tellers
Customers
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 Wait Time (Flow Time)
Wait Time
1
1
432110
213
213
Total Wait Time 111033 18 units
8
Square of difference from mean
Teller Load and Variance
Load
Variance
(1-2)21
1
(1-2)21
1
(4-2)24
4
(2-2)20
2
(2-2)20
2
Variance (11400)/5 6/5
Mean Load 10/5 2
9
Optimal Assignment
Tellers
Customers
German
Italian
French
Romansh
English
Variance 0
Total Wait Time (21)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 ? E is a matching if each vertex is incident
    with at most one edge in M

U
V
The blue edges are a matching, M
13
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
Matchings
  • Hungarian Algorithm used to find matchings of
    maximum cardinality

H. W. Kuhn, The Hungarian method for the
assignment problem, Naval Res. Logist. Quart.
283-97, 1955.
15
Semi-Matchings
  • M ? E is 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
432110
213
213
c(M) 111033 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, vi1? 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) lt 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) lt 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, vi1 to M for all i

U
V
v2
degM(v2) 1
degM(v2) 2
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) gt 0

U
V
v2
cM(v2) 1
cM(v2) 3
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 ? with M
  • In ? color the edges of M red and the edges in O
    green
  • 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
Properties of G?
G?
O
  • Acyclic
  • Monotone

32
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) gt 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 lt 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 pgt1, 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 pgt1. 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
1
2
Optimal L?
Optimal semi-matching
Total cost 5
Total cost 6
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 nnum vertices andmnum 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) (nU V and mE )
  • 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
Step 2 assign u2
1
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!

51
Algorithm SM2 Pseudocode
  • Quickly find an initial semi-matching M
  • While M contains a cost-reducing path P
  • Improve M by switching edges along P
  • Stop M is optimal

52
Step 1 Initial Semi-Matching
  • Any semi-matching will work but a near-optimal
    one is better
  • Easy approach
  • Match each u?U with its least-loaded V-neighbor
  • Better approach
  • Sort vertices in U by increasing degree
  • Match each u?U with its least-loaded
    V-neighbor.In case of a tie, choose V-neighbor
    with least degree.

53
Step 1 Greedy Example
U
V
54
Step 2 Find CRP
  • Easy approach
  • For each v?V
  • Build tree T of alternating paths rooted at v
  • If T contains a cost-reducing path, return it
  • Return false
  • Runtime O(V . E )

55
Step 2 Find CRP
  • Better approach
  • Build forest F of alternating paths where each
    tree root is a least-loaded V-vertex that is not
    in F
  • If F contains a cost-reducing path, return it
  • Return false
  • Runtime O(E )

56
Step 2 Find CRP Example
U
V
57
Algorithm SM2 Analysis
  • Step 1 Find Greedy Matching O(E )
  • Step 2 Find CRP O(E )
  • Step 3 Eliminate CRP O(U V )
  • How many CRPs must be eliminated to achieve
    optimality?
  • Depends on cost of Greedy Assignment

58
Algorithm SM2 Num Iterations
  • Worst-possible Greedy Assignment has Total Cost
    U . (U 1)/2
  • Each iteration reduces Total Cost by at least 1
  • Therefore at most O(U 2) iterations
  • Total Runtime O(U 2 . E )
  • Can prove tighter bound O(U 3/2 . E )

59
Coin Towers Problem
  • Start Tower of coins C stories tall
  • Goal C towers of coins each 1 story tall
  • Coins can only move down and right
  • Minimum number of moves is obviously C-1
  • Problem What is maximum number of moves?

60
Coin Towers Example
Tower 1
Tower 2
Tower 3
Tower 4
Tower 5
Tower 6
Total 8 Moves
61
Coin Towers Analysis
  • Assume tower heights non-increasing from left to
    right
  • For any K, each coin moves at most K times before
    passing beyond Tower K
  • Because each move goes right
  • Tower K has maximum height C/K. Thus, each coin
    moves at most C/K times after passing Tower K
  • Because each move goes down
  • For arbitrary K, can prove thateach coins moves
    at most KC/K times
  • Fix Ksqrt(C). Then maximum possible moves is O(C
    . sqrt(C)) O(C1.5)

62
Talk Outline
  • Swiss Bank Problem
  • Formal Definitions
  • Optimal Semi-Matchings
  • Algorithms
  • Experiments

63
Semi-Matching Experiments
  • Compute Optimal Semi-Matchings
  • Compare SM1 SM2 to reduction to assignment
    problem
  • CSA Goldberg Kennedy, 1993
  • LEDA www.algorithmic-solutions.com
  • Use input graph generators from Cherkassky et
    al., 1998

64
(No Transcript)
65
(No Transcript)
66
(No Transcript)
67
(No Transcript)
68
(No Transcript)
69
(No Transcript)
70
Maximum Matching Experiments
  • Compute Maximum Matchings
  • Compare SM1 SM2 to existing matching algorithms
  • BFS Breadth-First Search based alternating-path
    algorithm
  • LO Push-relabel algorithm with Lo heuristic
  • Both from Cherkassky et al., 1998
  • Use input graph generators from Cherkassky et
    al., 1998

71
(No Transcript)
72
(No Transcript)
73
(No Transcript)
74
(No Transcript)
75
(No Transcript)
76
(No Transcript)
77
(No Transcript)
78
Conclusions
  • Optimal Semi-Matchings solve simple load
    balancing problems
  • Minimize maximum load and variance
  • Optimal Semi-Matchings contain Maximum Bipartite
    Matchings
  • Algorithm SM1 has an efficient theoretical bound
  • Algorithm SM2 is efficient in practice at
    computing Optimal Semi-Matchings and Maximum
    Matchings

79
Questions?
80
Algorithm SM1 Example
1
  • Build an alternating tree rooted at u. Edges
    (ui,vj) are in E\M and edges (vj,ui) are M.
  • Select v, the least loaded V-vertex in the tree.
  • Re-assign matching edges on path from u to v

1
2
u
3
2
v
3
4
5
81
Algorithm SM1 Example
U
V
1
Step 4 assign u4
1
2
Can increase the load on v1 or v3
3
2
4
or v1 or v2
or v2
3
All have the same load.
4
5
82
Algorithm SM1 Example
U
V
1
Assign u4 to v3
1
2
3
2
4
3
4
5
83
Algorithm SM1 Example
U
V
1
Step 5 assign u5 Step 6 assign u6
1
2
3
2
4
5
3
6
4
5
84
Algorithm SM1 Example
U
V
1
Step 7 assign u7
1
2
Can increase the load on v3
3
2
or v1 or v2
4
or v1
5
3
or v2
6
v1 is the least loaded
4
7
5
85
Algorithm SM1 Example
U
V
1
1
2
3
2
4
5
3
6
4
7
5
86
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com