Docsity

Assignment Problem: Min Cost Perfect Matching using Successive Shortest Path Algorithm, Slides of Data Representation and Algorithm Design

Toggle sidebar
bg1
Chapter 7
* 7.13 Assignment Problem
3
Assignment Problem
Assignment problem.
Input: weighted, complete bipartite graph G = (L ∪ R, E)
with |L| = |R|.
Goal: find a perfect matching of min weight.
1
2
3
4
5
1' 2' 3' 4' 5'
Min cost perfect matching
M = { 1-2', 2-3', 3-5', 4-1', 5-4' }
cost(M) = 8 + 7 + 10 + 8 + 11 = 44
38915 10
410 716 14
913 11 19 10
813 12 20 13
1 7 5 11 9
4
Applications
Natural applications.
Match jobs to machines.
Match personnel to tasks.
Match PU students to writing seminars.
Non-obvious applications.
Vehicle routing.
Signal processing.
Virtual output queueing.
Multiple object tracking.
Approximate string matching.
Enhance accuracy of solving linear systems of equations.
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Assignment Problem: Min Cost Perfect Matching using Successive Shortest Path Algorithm and more Slides Data Representation and Algorithm Design in PDF only on Docsity!

Chapter 7

* 7.13 Assignment Problem

3

Assignment Problem

Assignment problem.

 Input: weighted, complete bipartite graph G = (L ∪ R, E)

with |L| = |R|.

 Goal: find a perfect matching of min weight.

1 2 3 4 5 1' 2' 3' 4' 5' Min cost perfect matching M = { 1-2', 2-3', 3-5', 4-1', 5-4' } cost(M) = 8 + 7 + 10 + 8 + 11 = 44

4

Applications

Natural applications.

 Match jobs to machines.

 Match personnel to tasks.

 Match PU students to writing seminars.

Non-obvious applications.

 Vehicle routing.

 Signal processing.

 Virtual output queueing.

 Multiple object tracking.

 Approximate string matching.

 Enhance accuracy of solving linear systems of equations.

5

Bipartite matching. Can solve via reduction to max flow.

Flow. During Ford-Fulkerson, all capacities and flows are 0/1. Flow

corresponds to edges in a matching M.

Residual graph GM simplifies to:

 If (x, y) ∉ M, then (x, y) is in GM.

 If (x, y) ∈ M, the (y, x) is in GM.

Augmenting path simplifies to:

 Edge from s to an unmatched node x ∈ X.

 Alternating sequence of unmatched and matched edges.

 Edge from unmatched node y ∈ Y to t.

Bipartite Matching

s t 1 1 1 X Y 6

Alternating path. Alternating sequence of unmatched and matched

edges, from unmatched node x ∈ X to unmatched node y ∈ Y.

Alternating Path

x y matching M x y alternating path x y matching M' 7

Cost of an alternating path. Pay c(x, y) to match x-y; receive c(x, y) to

unmatch x-y.

Shortest alternating path. Alternating path from any unmatched node

x ∈ X to any unmatched node y ∈ Y with smallest cost.

Successive shortest path algorithm.

 Start with empty matching.

 Repeatedly augment along a shortest alternating path.

Assignment Problem: Successive Shortest Path Algorithm

1 2 1' 2' 10 6 7 2 cost(2 - 1') = 7 cost(2 - 2'- 1 - 1') = 2 - 6 + 10 = 6 8

Shortest alternating path. Corresponds to shortest s-t path in GM.

Concern. Edge costs can be negative.

Fact. If always choose shortest alternating path, then GM contains no

negative cycles ⇒ compute using Bellman-Ford.

Our plan. Use duality to avoid negative edge costs (and negative cost

cycles) ⇒ compute using Dijkstra.

Finding The Shortest Alternating Path

1 2 1' 2' 10

  • 7 2 s t 0 0

13

Successive shortest path.

Successive Shortest Path Algorithm

Successive-Shortest-Path(X, Y, c) { M ← φ foreach x ∈ X: p(x) ← 0 foreach y ∈ Y: p(y) ← min (^) e into y c(e) while (M is not a perfect matching) { Compute shortest path distances d P ← shortest alternating path using costs cp M ← updated matching after augmenting along P foreach v ∈ X ∪ Y: p(v) ← p(v) + d(v) } return M } p is compatible with M = φ 14

Lemma 1. Let p be compatible prices for matching M. Let d be

shortest path distances in GM with costs cp. All edges (x, y) on shortest

path have cp+d(x, y) = 0.

Pf. Let (x, y) be some edge on shortest path.

 If (x, y) ∈ M, then (y, x) on shortest path and d(x) = d(y) - cp(x, y).

If (x, y) ∉ M, then (x, y) on shortest path and d(y) = d(x) + cp(x, y).

 In either case, d(x) + cp(x, y) - d(y) = 0.

 By definition, cp(x, y) = p(x) + c(x, y) - p(y).

 Substituting for cp(x, y) yields:

(p(x) + d(x)) + c(x, y) - (p(y) + d(y)) = 0.

 In other words, cp+d(x, y) = 0. ▪

Maintaining Compatible Prices

Reduced costs: cp(x, y) = p(x) + c(x, y) - p(y). forward or reverse edges 15

Lemma 2. Let p be compatible prices for matching M. Let d be

shortest path distances in GM with costs cp. Then p' = p + d are also

compatible prices for M.

Pf. (x, y) ∈ M

 (y, x) is the only edge entering x in GM. Thus, (y, x) on shortest path.

 By Lemma 1, cp+d(x, y) = 0.

Pf. (x, y) ∉ M

 (x, y) is an edge in GM ⇒ d(y) ≤ d(x) + cp(x, y).

 Substituting cp(x, y) = p(x) + c(x, y) - p(y) ≥ 0 yields

(p(x) + d(x)) + c(x, y) - (p(y) + d(y)) ≥ 0.

 In other words, cp+d(x, y) ≥ 0. ▪

Maintaining Compatible Prices

Compatible prices. For each node v: (i) cp(x, y) ≥ 0 for for all (x, y) ∉ M. (ii) cp(x, y) = 0 for for all (x, y) ∈ M. 16

Lemma 3. Let M' be matching obtained by augmenting along a min cost

path with respect to cp+d. Then p' = p + d is compatible with M'.

Pf.

 By Lemma 2, the prices p + d are compatible for M.

 Since we augment along a min cost path, the only edges (x, y) that

swap into or out of the matching are on the shortest path.

 By Lemma 1, these edges satisfy cp+d(x, y) = 0.

 Thus, compatibility is maintained. ▪

Maintaining Compatible Prices

Compatible prices. For each node v: (i) cp(x, y) ≥ 0 for for all (x, y) ∉ M. (ii) cp(x, y) = 0 for for all (x, y) ∈ M.

17

Invariant. The algorithm maintains a matching M and compatible prices

p.

Pf. Follows from Lemmas 2 and 3 and initial choice of prices. ▪

Theorem. The algorithm returns a min cost perfect matching.

Pf. Upon termination M is a perfect matching, and p are compatible

prices. Optimality follows from Observation 2. ▪

Theorem. The algorithm can be implemented in O(n^3 ) time.

Pf.

 Each iteration increases the cardinality of M by 1 ⇒ n iterations.

 Bottleneck operation is computing shortest path distances d.

Since all costs are nonnegative, each iteration takes O(n^2 ) time

using (dense) Dijkstra. ▪

Successive Shortest Path: Analysis

18

Weighted bipartite matching. Given weighted bipartite graph, find

maximum cardinality matching of minimum weight.

Successive shortest path algorithm. O(mn log n) time using heap-based

version of Dijkstra's algorithm.

Best known bounds. O(mn1/2) deterministic; O(n2.376) randomized.

Planar weighted bipartite matching. O(n3/2^ log^5 n).

Weighted Bipartite Matching

m edges, n nodes

Input Queued Switching

20

Input-Queued Switching

Input-queued switch.

 n inputs and n outputs in an n-by-n crossbar layout.

 At most one cell can depart an input at a time.

 At most one cell can arrive at an output at a time.

 Cell arrives at input x and must be routed to output y.

x 3 x 2 x 1 y 1 y 2 y 3 inputs outputs