more network flow applications
play

More Network Flow Applications Lecture 16 October 19, 2016 - PowerPoint PPT Presentation

CS 473: Algorithms, Fall 2016 More Network Flow Applications Lecture 16 October 19, 2016 Chandra & Ruta (UIUC) CS473 1 Fall 2016 1 / 31 Part I Baseball Pennant Race Chandra & Ruta (UIUC) CS473 2 Fall 2016 2 / 31 Pennant Race


  1. CS 473: Algorithms, Fall 2016 More Network Flow Applications Lecture 16 October 19, 2016 Chandra & Ruta (UIUC) CS473 1 Fall 2016 1 / 31

  2. Part I Baseball Pennant Race Chandra & Ruta (UIUC) CS473 2 Fall 2016 2 / 31

  3. Pennant Race Chandra & Ruta (UIUC) CS473 3 Fall 2016 3 / 31

  4. Pennant Race: Example Example Team Won Left New York 92 2 Baltimore 91 3 Toronto 91 3 Boston 89 2 Can Boston win the pennant? Chandra & Ruta (UIUC) CS473 4 Fall 2016 4 / 31

  5. Pennant Race: Example Example Team Won Left New York 92 2 Baltimore 91 3 Toronto 91 3 Boston 89 2 Can Boston win the pennant? No, because Boston can win at most 91 games. Chandra & Ruta (UIUC) CS473 4 Fall 2016 4 / 31

  6. Another Example Example Team Won Left New York 92 2 Baltimore 91 3 Toronto 91 3 Boston 90 2 Can Boston win the pennant? Chandra & Ruta (UIUC) CS473 5 Fall 2016 5 / 31

  7. Another Example Example Team Won Left New York 92 2 Baltimore 91 3 Toronto 91 3 Boston 90 2 Can Boston win the pennant? Not clear unless we know what the remaining games are! Chandra & Ruta (UIUC) CS473 5 Fall 2016 5 / 31

  8. Refining the Example Example Team Won Left NY Bal Tor Bos New York 92 2 − 1 1 0 Baltimore 91 3 1 − 1 1 Toronto 91 3 1 1 − 1 Boston 90 2 0 1 1 − Can Boston win the pennant? Chandra & Ruta (UIUC) CS473 6 Fall 2016 6 / 31

  9. Refining the Example Example Team Won Left NY Bal Tor Bos New York 92 2 − 1 1 0 Baltimore 91 3 1 − 1 1 Toronto 91 3 1 1 − 1 Boston 90 2 0 1 1 − Can Boston win the pennant? Suppose Boston does Chandra & Ruta (UIUC) CS473 6 Fall 2016 6 / 31

  10. Refining the Example Example Team Won Left NY Bal Tor Bos New York 92 2 − 1 1 0 Baltimore 91 3 1 − 1 1 Toronto 91 3 1 1 − 1 Boston 90 2 0 1 1 − Can Boston win the pennant? Suppose Boston does Boston wins both its games to get 92 wins 1 Chandra & Ruta (UIUC) CS473 6 Fall 2016 6 / 31

  11. Refining the Example Example Team Won Left NY Bal Tor Bos New York 92 2 − 1 1 0 Baltimore 91 3 1 − 1 1 Toronto 91 3 1 1 − 1 Boston 90 2 0 1 1 − Can Boston win the pennant? Suppose Boston does Boston wins both its games to get 92 wins 1 New York must lose both games 2 Chandra & Ruta (UIUC) CS473 6 Fall 2016 6 / 31

  12. Refining the Example Example Team Won Left NY Bal Tor Bos New York 92 2 − 1 1 0 Baltimore 91 3 1 − 1 1 Toronto 91 3 1 1 − 1 Boston 90 2 0 1 1 − Can Boston win the pennant? Suppose Boston does Boston wins both its games to get 92 wins 1 New York must lose both games; now both Baltimore and 2 Toronto have at least 92 Chandra & Ruta (UIUC) CS473 6 Fall 2016 6 / 31

  13. Refining the Example Example Team Won Left NY Bal Tor Bos New York 92 2 − 1 1 0 Baltimore 91 3 1 − 1 1 Toronto 91 3 1 1 − 1 Boston 90 2 0 1 1 − Can Boston win the pennant? Suppose Boston does Boston wins both its games to get 92 wins 1 New York must lose both games; now both Baltimore and 2 Toronto have at least 92 Winner of Baltimore-Toronto game has 93 wins! 3 Chandra & Ruta (UIUC) CS473 6 Fall 2016 6 / 31

  14. Can Boston win the penant? Team Won Left NY Bal Tor Bos New York 3 6 − 2 3 1 Baltimore 5 4 2 − 1 1 Toronto 4 6 3 1 − 2 Boston 2 4 1 1 2 − (A) Yes. (B) No. Chandra & Ruta (UIUC) CS473 7 Fall 2016 7 / 31

  15. Abstracting the Problem Given A set of teams S 1 For each x ∈ S , the current number of wins w x 2 For any x , y ∈ S , the number of remaining games g xy between 3 x and y A team z 4 Can z win the pennant? Chandra & Ruta (UIUC) CS473 8 Fall 2016 8 / 31

  16. Towards a Reduction z can win the pennant if z wins at least m games 1 no other team wins more than m games 2 Chandra & Ruta (UIUC) CS473 9 Fall 2016 9 / 31

  17. Towards a Reduction z can win the pennant if z wins at least m games 1 to maximize z ’s chances we make z win all its remaining games 1 and hence m = w z + � x ∈ S g xz no other team wins more than m games 2 Chandra & Ruta (UIUC) CS473 9 Fall 2016 9 / 31

  18. Towards a Reduction z can win the pennant if z wins at least m games 1 to maximize z ’s chances we make z win all its remaining games 1 and hence m = w z + � x ∈ S g xz no other team wins more than m games 2 for each x , y ∈ S the g xy games between them have to be 1 assigned to either x or y . each team x � = z can win at most m − w x − g xz remaining 2 games Is there an assignment of remaining games to teams such that no team x � = z wins more than m − w x games? Chandra & Ruta (UIUC) CS473 9 Fall 2016 9 / 31

  19. Flow Network: The basic gadget s : source 1 t : sink 2 x , y : two teams v x 3 m − w x g xy : number of games 4 ∞ remaining between x and s g xy y . u xy t m − w y w x : number of points x 5 ∞ has. m : maximum number of v y 6 points x can win before team of interest is eliminated. Chandra & Ruta (UIUC) CS473 10 Fall 2016 10 / 31

  20. Flow Network: An Example Can Boston win? Team Won Left NY Bal Tor Bos New York 90 11 − 1 6 4 Baltimore 88 6 1 − 1 4 Toronto 87 11 6 1 − 4 Boston 79 12 4 4 4 − NT N 6 1 m = 79 + 12 = 91 : 1 1 4 Boston can get at most s t NB T 91 points. 1 3 BT B Chandra & Ruta (UIUC) CS473 11 Fall 2016 11 / 31

  21. Constructing Flow Network Reduction Construct the flow network G as Notations follows S : set of teams, 1 One vertex v x for each team 1 w x wins for each 2 x ∈ S ′ , one vertex u xy for each team, and pair of teams x and y in S ′ g xy games left 3 A new source vertex s and sink t 2 between x and y . Edges ( u xy , v x ) and ( u xy , v y ) of 3 m be the maximum 4 capacity ∞ number of wins for z , Edges ( s , u xy ) of capacity g xy 4 and S ′ = S \ { z } . 5 Edges ( v x , t ) of capacity equal 5 m − w x Chandra & Ruta (UIUC) CS473 12 Fall 2016 12 / 31

  22. Correctness of reduction Theorem G ′ has a maximum flow of value g ∗ = � x , y ∈ S ′ g xy if and only if z can win the most number of games (including possibly tie with other teams). Chandra & Ruta (UIUC) CS473 13 Fall 2016 13 / 31

  23. Proof of Correctness Proof. Existence of g ∗ flow ⇒ z wins pennant An integral flow saturating edges out of s , ensures that each 1 remaining game between x and y is added to win total of either x or y Capacity on ( v x , t ) edges ensures that no team wins more than 2 m games Conversely, z wins pennant ⇒ flow of value g ∗ Scenario determines flow on edges; if x wins k of the games 1 against y , then flow on ( u xy , v x ) edge is k and on ( u xy , v y ) edge is g xy − k Chandra & Ruta (UIUC) CS473 14 Fall 2016 14 / 31

  24. Proof that z cannot with the pennant Suppose z cannot win the pennant since g ∗ < g . How do we 1 prove to some one compactly that z cannot win the pennant? Chandra & Ruta (UIUC) CS473 15 Fall 2016 15 / 31

  25. Proof that z cannot with the pennant Suppose z cannot win the pennant since g ∗ < g . How do we 1 prove to some one compactly that z cannot win the pennant? Show them the min-cut in the reduction flow network! 2 Chandra & Ruta (UIUC) CS473 15 Fall 2016 15 / 31

  26. Proof that z cannot with the pennant Suppose z cannot win the pennant since g ∗ < g . How do we 1 prove to some one compactly that z cannot win the pennant? Show them the min-cut in the reduction flow network! 2 See Kleinberg-Tardos book for a natural interpretation of the 3 min-cut as a certificate. Chandra & Ruta (UIUC) CS473 15 Fall 2016 15 / 31

  27. The biggest loser? Given an input as above for the pennant competition, deciding if a team can come in the last place can be done in (A) Can be done using the same reduction as just seen. (B) Can not be done using the same reduction as just seen. (C) Can be done using flows but we need lower bounds on the flow, instead of upper bounds. (D) The problem is NP-Hard and requires exponential time. (E) Can be solved by negating all the numbers, and using the above reduction. (F) Can be solved efficiently only by running a reality show on the problem. Chandra & Ruta (UIUC) CS473 16 Fall 2016 16 / 31

  28. Part II An Application of Min-Cut to Project Scheduling Chandra & Ruta (UIUC) CS473 17 Fall 2016 17 / 31

  29. Project Scheduling Problem: n projects/tasks 1 , 2 , . . . , n 1 dependencies between projects: i depends on j implies i cannot 2 be done unless j is done. dependency graph is acyclic each project i has a cost/profit p i 3 p i < 0 implies i requires a cost of − p i units 1 p i > 0 implies that i generates p i profit 2 Goal: Find projects to do so as to maximize profit. Chandra & Ruta (UIUC) CS473 18 Fall 2016 18 / 31

  30. Example Chandra & Ruta (UIUC) CS473 19 Fall 2016 19 / 31

  31. Notation For a set A of projects: A is a valid solution if A is dependency closed , that is for every 1 i ∈ A , all projects that i depends on are also in A . Chandra & Ruta (UIUC) CS473 20 Fall 2016 20 / 31

Recommend


More recommend