Exercise 6.1 Find the number of different shortest paths from point A to point B in a city with perfectly horizontal streets and vertical avenues as shown.

Slides:



Advertisements
Similar presentations
Maximum flow Main goals of the lecture:
Advertisements

Lecture 5: Network Flow Algorithms Max-Flow Min-Cut Single-Source Shortest-Path (SSSP) Job Sequencing.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Bioinformatics III1 We will present an algorithm that originated by Ford and Fulkerson (1962). Idea: increase the flow in a network iteratively until it.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 8 Network models.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 19.
1 Maximum Flow w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
The max flow problem
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Lecture 5: Network Flow Algorithms Single-Source Shortest-Path (SSSP) (Dijkstra's Algorithm) Max Flow - Min Cut (Ford-Fulkerson) Job Sequencing.
Theory of Computing Lecture 13 MAS 714 Hartmut Klauck.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 11, 2014.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
10. Lecture WS 2006/07Bioinformatics III1 V10: Network Flows V10 follows closely chapter 12.1 in on „Flows and Cuts in Networks and Chapter 12.2 on “Solving.
Maximum Flow. p2. Maximum Flow A flow network G=(V, E) is a DIRECTED graph where each has a nonnegative capacity u.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Chapter 7 April 28 Network Flow.
15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
Network Flows. Menger ’ s Theorem Theorem 7.1. (Menger [1927] ) Let G be a graph (directed or undirected), let s and t be two vertices, and k  N. Then.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
10/11/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 21 Network.
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
NP-completeness NP-complete problems. Homework Vertex Cover Instance. A graph G and an integer k. Question. Is there a vertex cover of cardinality k?
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
1 Network Flow CSC401 – Analysis of Algorithms Chapter 8 Network Flow Objectives: Flow networks –Flow –Cut Maximum flow –Augmenting path –Maximum flow.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
1 Assignment #3 is posted: Due Thursday Nov. 15 at the beginning of class. Make sure you are also working on your projects. Come see me if you are unsure.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
C&O 355 Lecture 19 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A A A A A.
A directed graph G consists of a set V of vertices and a set E of arcs where each arc in E is associated with an ordered pair of vertices from V. V={0,
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
CSE 421 Algorithms Richard Anderson Lecture 21 Shortest Paths and Network Flow.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
V15: Max-Flow Min-Cut V15 continues chapter 12 in Gross & Yellen „Graph Theory“ Theorem [Characterization of Maximum Flow] Let f be a flow in a.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
CS4234 Optimiz(s)ation Algorithms
Richard Anderson Lecture 23 Network Flow
Maximum Flow 9/13/2018 6:12 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Lecture 22 Network Flow, Part 2
Instructor: Shengyu Zhang
Edmonds-Karp Algorithm
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Flow Networks General Characteristics Applications
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Maximum Flow Neil Tang 4/8/2008
Lecture 22 Network Flow, Part 2
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

Exercise 6.1 Find the number of different shortest paths from point A to point B in a city with perfectly horizontal streets and vertical avenues as shown in Figure. No path can cross the fenced off area shown in red in the figure. A B

Network Flows

Network We have a digraph G with edge capacities u: E(G)→ R + and two specified vertices s (the source) and t (the sink). The quadruple (G, u, s, t) is sometimes called a network. Our main motivation is to transport as many units as possible simultaneously from s to t. A solution to this problem will be called a maximum flow.

Flow Definition 6.1. Given a digraph G with capacities u: E(G) → R +, a flow is a function f : E(G) → R + with f(e) ≤ u(e) for all e  E(G). We say that f satisfies the flow conservation rule at vertex v if A flow satisfying the flow conservation rule at every vertex is called a circulation.

s-t-Flow Now given a network (G, u, s, t), an s-t-flow is a flow satisfying the flow conservation rule at all vertices except s and t. We define the value of an s-t-flow f by

Maximum Flow Problem Instance: A network (G, u, s, t). Task: Find a s-t-flow of maximum value.

Job Assignment Problem Given n jobs, their processing times t 1,…,t n  R +, and a nonempty subset S i  {1,..., m}of employees that contribute to each job i  {1,..., n}. Find numbers x ij  R + for all i =1,...,n and j  S i such that all jobs are finished, i.e. for i =1,...,n. Our goal is to minimize the amount of time in which all jobs are done, i.e. T(x) = max j is minimum.

Reduction to Network Flow We apply binary search for the optimum T(x). Then for one specific value T we have to find numbers x ij  R + with for all i and for all j.

Bipartite digraph s t v1v1 w1w1 v2v2 v3v3 v4v4 w2w2 w3w3 t2t2 t1t1 t3t3 t4t4 T T T The feasible solutions x with T(x) ≤ T evidently correspond to the s-t-flows of value in (G, u).

LP formulation

Feasible solution of LP Proposition 6.2. The Maximum Flow Problem always has an optimum solution.

s-t-Cut Recall that an s-t-cut in G is an edge set  + (X) with s  X and t  V(G)\ X. The capacity of an s-t-cut is the sum of the capacities of its edges. By a minimum s-t-cut in (G,u) we mean an s-t-cut of minimum capacity (with respect to u) in G.

s-t-Flow and s-t-Cut Lemma 6.3.

Proof (а)

s-t-Flow and s-t-Cut Lemma 6.3.

Residual Capacities Definition 5.4.

Residual graph S t S t G GfGf

Augmenting Path

S t S t G GfGf S t

Ford-Fulkerson Algorithm Input: A network (G, u, s, t). Output: An s-t-flow f of maximum value.

Remark To find an augmenting path is easy (any s-t-path in G f ). If we choose an arbitrary augmenting path in G f, then –If we allow irrational capacities, the algorithm might not terminate at all. –Even in the case of integer capacities, we may have an exponential number of augmentations.

Instance with irrational capacities (All lines represent edges in both directions. ) S t u(x 1, y 1 )=1, u(x 2, y 2 )=σ, u(x 3, y 3 )= u(x 4, y 4 )= σ 2 x1x1 y1y1 x2x2 x3x3 x4x4 y2y2 y3y3 y4y4 All other edges have capacity 1/(1- σ).

Characterization of Maximum Flow Theorem 5.5. An s-t-flow f is maximum if and only if there is no f-augmenting path.

Proof If there is an augmenting path P, then (3) of the Ford-Fulker- son algorithm computes a flow of greater value, so f is not maximum. If there is no augmenting path, this means that t is not reachable from s in G f. Let R be the set of vertices reachable from s in G f. By the definition of G f, we have f(e) = u(e) for all and f(e) = 0 for all

Proof Now Lemma 6.3(a) says that which by Lemma 6.3(b) implies that f is a maximum flow.

Maximum Flow and Minimum Cut Theorem 6.6. (Ford, Fulkerson [1956], Elias, Feinstein, Shannon [1956] ) In a network the maximum value of an s-t-flow equals the minimum capacity of an s-t-cut.

Integral Flow Theorem Corollary 6.7. If the capacities of a network are integers, then there exists an integral maximum flow.

Exercise 6.2 Prove the Corollary 6.7.

s-t-Paths and Circuits Theorem 6.8. (Gallai[1958], Ford and Fulkerson [1962] ) Let (G, u, s, t) be a network and let f be an s-t-flow in G. Then there exists a family P of s-t-paths and a family C of circuits in G along with weights w: P ∪ C → R + such that f(e) = Σ P  P ∪ C: e  E(P) w(P) for all e  E(G), Σ P  P w(P) = value( f ), and | P | + | C | ≤ | E(G)|. Moreover, if f is integral then w can be chosen to be integral.

Proof We construct P, C and w by induction on the number of edges with nonzero flow. Let e = (v 0, w 0 ) be an edge with f(e) > 0. Unless w 0 = t there must be an edge (w 0, w 1 ) with nonzero flow. Set i := 1, if we stop. Otherwise there must be an edge (w i, w i+1 ) with nonzero flow; we set i := i + 1 and continue. The process must end after at most n steps.

Proof We do the same in other direction. If v 0 ≠ s, there must be an edge (v 1, v 0 ) with nonzero flow, and so on. At the end we have found either circuit or an s-t-path in G, and we have used edges with positive flow only. Let P be this circuit or path. Let Set for and for

Exercise 6.3 Super Alarm Clock Testing A firm has invented a super-strong alarm clock. For publicity purposes, it wants to determine the highest floor in a 100-story building from which such an alarm clock can fall without breaking. The firm has given a tester two identical alarm clocks to experiment with. Of course, the same alarm clock can be dropped multiple times unless it breaks. What is the minimum number of droppings that is guaranteed to determine the highest safe floor in all cases.

Homework Show that in the case of integer capacities, the Ford-Fulkerson Algorithm may have an exponential number of augmentations. Formulate the Super Alarm Clock Testing problem as an Integer Linear Program.

S t R R R R 1 2R iterations. Input size is O(log R).