‣ Assignment Problem ‣ Input-Queued Switching

‣ Assignment Problem ‣ Input-Queued Switching

7. NETWORK FLOW III ‣ assignment problem ‣ input-queued switching Lecture slides by Kevin Wayne Copyright © 2005 Pearson-Addison Wesley http://www.cs.princeton.edu/~wayne/kleinberg-tardos Last updated on 7/25/17 11:04 AM 7. NETWORK FLOW III ‣ assignment problem ‣ input-queued switching Assignment problem Input. Weighted, complete bipartite graph G = (X ∪ Y, E) with | X | = | Y |. Goal. Find a perfect matching of min weight. 0 15 0' 7 3 5 1 6 1' 2 9 4 2 1 2' X Y 3 Assignment problem Input. Weighted, complete bipartite graph G = (X ∪ Y, E) with | X | = | Y |. Goal. Find a perfect matching of min weight. 0 15 0' 7 3 min-cost perfect matching 5 M = { 0-2', 1-0', 2-1' } 1 6 1' cost(M) = 3 + 5 + 4 = 12 2 9 4 2 1 2' X Y 4 Princeton writing seminars Goal. Given m seminars and n = 12m students who rank their top 8 choices, assign each student to one seminar so that: ・Each seminar is assigned exactly 12 students. ・Students tend to be “happy” with their assigned seminar. Solution. ・Create one node for each student i and 12 nodes for each seminar j. ・Solve assignment problem where cij is some function of the ranks: f(rank(i, j)) B7 i `MFb j cij = B7 i /Q2b MQi `MF j ∞ 5 Locating objects in space Goal. Given n objects in 3d space, locate them with 2 sensors. Solution. ・Each sensor computes line from it to each particle. ・Let cij = distance between line i from censor 1 and line j from sensor 2. ・Due to measurement errors, we might have cij > 0. ・Solve assignment problem to locate n objects. 6 Kidney exchange If a donor and recipient have a different blood type, they can exchange their kidneys with another donor and recipient pair in a similar situation. Can also be done among multiple pairs (or starting with an altruistic donor). 7 Kidney exchange 1 3 2 8 3 1 3 2 8 3 6 2 5 9 4 6 2 5 9 4 4 7 5 1 6 4 7 5 1 6 weight = 3 + 5 + 7 + 8 + 4 = 27 weight = 2 + 5 + 8 + 6 + 1 + 9 = 31 8 Applications Natural applications. ・Match jobs to machines. ・Match personnel to tasks. ・Match PU students to writing seminars. Non-obvious applications. ・Vehicle routing. ・Kidney exchange. ・Signal processing. ・Earth-mover’s distance. ・Multiple object tracking. ・Virtual output queueing. ・Handwriting recognition. ・Locating objects in space. ・Approximate string matching. ・Enhance accuracy of solving linear systems of equations. 9 Bipartite matching Bipartite matching. Can solve via reduction to maximum flow. Flow. During Ford–Fulkerson, all residual capacities and flows are 0–1; flow corresponds to edges in a matching M. 1 Residual graph GM simplifies to: 1 1 If (x, y) ∉ M, then (x, y) is in GM. ・ s t If , then is in . ・ (x, y) ∈ M (y, x) GM X Y 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. 10 Alternating path Def. An alternating path P with respect to a matching M is an alternating sequence of unmatched and matched edges, starting from an unmatched node x ∈ X and going to an unmatched node y ∈ Y. Key property. Can use P to increase by one the cardinality of the matching. Pf. Set M ʹ = M ⊕ P. symmetric difference y y y x x x matching M alternating path P matching M′ 11 Assignment problem: successive shortest path algorithm Cost of alternating path. Pay c(x, y) to match x–y; receive c(x, y) to unmatch. 1 10 1' 6 P = 2 → 2' → 1 → 1' cost(P) = 2 - 6 + 10 = 6 7 2 2 2' 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. 12 Finding the shortest alternating path Shortest alternating path. Corresponds to minimum cost s↝t path in GM. 1 10 1' 0 -6 s t 0 7 2 2 2' Concern. Edge costs can be negative. Fact. If always choose shortest alternating path, then GM contains no negative cycles ⇒ can compute using Bellman-Ford. Our plan. Use duality to avoid negative edge costs (and negative cycles) ⇒ can compute using Dijkstra. 13 Equivalent assignment problem Duality intuition. Adding a constant p(x) to the cost of every edge incident to node x ∈ X does not change the min-cost perfect matching(s). Pf. Every perfect matching uses exactly one edge incident to node x. ▪ original costs c(x, y) modified costs c′(x, y) p(0) = 3 0 15 0' 0 18 0' 7 10 3 6 add 3 to all edges incident to node 0 5 5 1 6 1' 1 6 1' 2 2 9 9 4 4 2 1 2' 2 1 2' X Y X Y 14 Equivalent assignment problem Duality intuition. Subtracting a constant p(y) to the cost of every edge incident to node y ∈ Y does not change the min-cost perfect matching(s). Pf. Every perfect matching uses exactly one edge incident to node y. ▪ original costs c(x, y) modified costs c′(x, y) 0 15 0' p(0') = 5 0 10 0' 7 7 3 subtract 5 from all edges 3 incident to node 0' 5 0 1 6 1' 1 6 1' 2 2 9 4 4 4 2 1 2' 2 1 2' X Y X Y 15 Reduced costs Reduced costs. For x ∈ X, y ∈ Y, define cp(x, y) = p(x) + c(x, y) – p(y). Observation 1. Finding a min-cost perfect matching with reduced costs is equivalent to finding a min-cost perfect matching with original costs. original costs c(x, y) reduced costs cp(x, y) p(0) = 0 0 15 0' p(0') = 11 0 4 0' 7 1 3 0 5 0 p(1) = 6 1 6 1' p(1') = 6 1 6 1' 2 5 9 cp(1, 2') = p(1) + 2 – p(2') 0 4 0 p(2) = 2 2 1 2' p(2') = 3 2 0 2' X Y X Y 16 Compatible prices Compatible prices. For each node v ∈ X ∪ Y, maintain prices p(v) such that: ・cp(x, y) ≥ 0 for all (x, y) ∉ M. ・cp(x, y) = 0 for all (x, y) ∈ M. Observation 2. If prices p are compatible with a perfect matching M, then M is a min-cost perfect matching. reduced costs cp(x, y) Pf. Matching M has 0 cost. ▪ 0 4 0' 1 0 0 1 6 1' 5 0 0 2 0 2' X Y 17 Successive shortest path algorithm SUCCESSIVE-SHORTEST-PATH (X, Y, c) _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ M ← ∅. prices p are compatible with M FOREACH v ∈ X ∪ Y : p(v) ← 0. cp(x, y) = c(x, y) ≥ 0 WHILE (M is not a perfect matching) d ← shortest path distances using costs cp. 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. _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ 18 Successive shortest path algorithm Initialization. ・M = ∅. ・For each v ∈ X ∪ Y : p(v) ← 0. original costs c(x, y) p(0) = 0 p(0') = 0 0 15 0' 7 3 p(1) = 0 p(1') = 0 5 s 1 6 1' t 2 9 4 2 1 2' p(2) = 0 p(2') = 0 19 Successive shortest path algorithm Initialization. ・M = ∅. ・For each v ∈ X ∪ Y : p(v) ← 0. reduced costs cp(x, y) p(0) = 0 p(0') = 0 0 15 0' 7 3 p(1) = 0 p(1') = 0 5 s 1 6 1' t 2 9 4 2 1 2' p(2) = 0 p(2') = 0 20 Successive shortest path algorithm Step 1. ・Compute shortest path distances d(v) from s to v using cp(x, y). ・Update matching M via shortest path from s to t. ・For each v ∈ X ∪ Y: p(v) ← p(v) + d(v). shortest path distances d(v) d(0) = 0 d(0') = 5 0 15 0' 7 3 d(s) = 0 d(1) = 0 d(1') = 4 d(t) = 1 5 s 1 6 1' t 2 9 4 2 1 2' d(2) = 0 d(2') = 1 21 Successive shortest path algorithm Step 1. ・Compute shortest path distances d(v) from s to v using cp(x, y). ・Update matching M via shortest path from s to t. ・For each v ∈ X ∪ Y: p(v) ← p(v) + d(v). alternating path d(0) = 0 d(0') = 5 0 15 0' 7 3 d(s) = 0 d(1) = 0 d(1') = 4 d(t) = 1 5 s 1 6 1' t 2 9 matching 4 2-2' 2 1 2' d(2) = 0 d(2') = 1 22 Successive shortest path algorithm Step 1. ・Compute shortest path distances d(v) from s to v using cp(x, y). ・Update matching M via shortest path from s to t. ・For each v ∈ X ∪ Y: p(v) ← p(v) + d(v). reduced costs cp(x, y) p(0) = 0 p(0') = 5 0 10 0' 3 2 p(1) = 0 p(1') = 4 0 s 1 2 1' t 1 4 matching 0 2-2' 2 0 2' p(2) = 0 p(2') = 1 23 Successive shortest path algorithm Step 2. ・Compute shortest path distances d(v) from s to v using cp(x, y).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    46 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us