Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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

2 Network Flows

3 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.

4 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.

5 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

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

7 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.

8 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.

9 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).

10 LP formulation

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

12 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.

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

14 Proof (а)

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

16 Residual Capacities Definition 5.4.

17 Residual graph S t 5 5 5 5 1 4 32 5 1 S t1 2 5 3 1 4 3 2 G GfGf

18 Augmenting Path

19 S t 5 5 5 5 1 4 32 5 1 S t1 2 5 3 1 4 3 2 G GfGf S t 5 5 5 5 1 5 33 5

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

21 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.

22 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- σ).

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

24 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

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

26 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.

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

28 Exercise 6.2 Prove the Corollary 6.7.

29 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.

30 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.

31 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

32 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.

33 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.

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


Download ppt "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."

Similar presentations


Ads by Google