Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Maximum Flows

Similar presentations


Presentation on theme: "Introduction to Maximum Flows"— Presentation transcript:

1 Introduction to Maximum Flows
Lecture 8 Introduction to Maximum Flows

2

3

4

5

6

7

8

9

10 The Ford Fulkerson Maximum Flow Algorithm
Begin x := 0; create the residual network G(x); while there is some directed path from s to t in G(x) do begin let P be a path from s to t in G(x); ∆:= δ(P); send ∆ units of flow along P; update the r's; End end {the flow x is now maximum}.

11 The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem
Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)

12 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 2 s 4 t 3 2 1 3 This is the original network, and the original residual network.

13 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 2 s 4 t 3 2 1 3 Find any s-t path in G(x)

14 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 1 2 s 4 t 1 2 3 2 1 1 1 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

15 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 1 2 s 4 t 1 2 3 2 1 1 1 3 Find any s-t path

16 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 1 1 1 s 4 t 1 1 2 3 2 2 1 1 1 1 1 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

17 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 1 1 1 s 4 t 1 1 2 3 2 2 1 1 1 1 1 3 Find any s-t path

18 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 1 1 1 s 4 t 1 2 2 1 3 2 1 1 1 1 1 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

19 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 1 1 1 s 4 t 2 1 1 2 2 3 1 1 1 1 1 3 Find any s-t path

20 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 1 1 1 s 4 t 2 1 1 2 2 1 1 1 1 2 1 1 2 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

21 Ford-Fulkerson Max Flow
4 2 5 1 3 1 1 2 1 1 1 s 4 t 1 2 1 2 1 2 1 1 2 1 2 1 3 Find any s-t path

22 Ford-Fulkerson Max Flow
4 3 2 5 1 1 2 3 1 1 1 1 s 4 t 2 1 1 2 1 2 1 1 2 1 1 2 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

23 Ford-Fulkerson Max Flow
3 4 2 5 1 1 2 3 1 1 1 1 s 4 t 1 2 1 2 1 2 1 1 2 1 2 1 3 There is no s-t path in the residual network. This flow is optimal

24 Ford-Fulkerson Max Flow
4 3 2 2 5 5 1 1 2 3 1 1 1 1 s s 4 4 t 2 1 2 1 1 2 1 1 1 2 1 2 3 3 These are the nodes that are reachable from node s.

25 Ford-Fulkerson Max Flow
1 2 s 4 5 3 t Here is the optimal flow

26

27

28 Review for cutset theorem

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49 The Capacity Scaling Algorithm
and 6.855J The Capacity Scaling Algorithm Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)

50

51

52

53

54

55

56 The Capacity Scaling Algorithm
Animation

57 The Original Costs and Node Potentials
4 2 4 7 5 2 1 1 6 2 Introduce myself and the Tas. It is critical that students sign up for the virtual campus web site. Hand out instructions on how to use it. Make sure that everyone signs up on the list. Also, create a class list that is separate from the web site. Ask for a show of where students come from. There should be four major contingencies: Grad EECS, ORC, Transportation, Rest 3 5

58 The Original Capacities and Supplies/Demands
5 -2 10 2 4 30 25 23 20 1 20 20 Introduce myself and the Tas. It is critical that students sign up for the virtual campus web site. Hand out instructions on how to use it. Make sure that everyone signs up on the list. Also, create a class list that is separate from the web site. Ask for a show of where students come from. There should be four major contingencies: Grad EECS, ORC, Transportation, Rest 3 25 5 -7 -19

59 Set  = 16. This begins the -scaling phase.
5 -2 10 We send flow from nodes with excess   to nodes with deficit  . 2 4 30 25 23 20 1 20 We ignore arcs with capacity  . 20 Introduce myself and the Tas. It is critical that students sign up for the virtual campus web site. Hand out instructions on how to use it. Make sure that everyone signs up on the list. Also, create a class list that is separate from the web site. Ask for a show of where students come from. There should be four major contingencies: Grad EECS, ORC, Transportation, Rest 3 25 5 -7 -19

60 Select a supply node and find the shortest paths
shortest path distance 7 8 4 2 4 7 5 The shortest path tree is marked in bold and blue. 2 1 1 6 2 Introduce myself and the Tas. It is critical that students sign up for the virtual campus web site. Hand out instructions on how to use it. Make sure that everyone signs up on the list. Also, create a class list that is separate from the web site. Ask for a show of where students come from. There should be four major contingencies: Grad EECS, ORC, Transportation, Rest 3 5 8 6

61 Update the Node Potentials and the Reduced Costs
-7 -8 4 3 2 4 7 To update a node potential, subtract the shortest path distance. 5 2 6 1 1 1 6 2 3 5 -6 -8

62 Send Flow Along a Shortest Path in G(x, 16)
5 -2 10 Send flow from node 1 to node 5. 2 4 30 25 23 20 1 1 20 How much flow should be sent? 20 3 25 5 -7 -19

63 Update the Residual Network
5 -2 10 19 units of flow were sent from node 1 to node 5. 2 4 30 23 25 4 20 1 1 20 19 1 19 3 5 6 -19 -7

64 This ends the 16-scaling phase.
5 -2 10 2 4 The -scaling phase continues when e(i)   for some i. e(j)  - for some j. There is a path from i to j. 30 25 4 20 1 1 20 19 1 19 3 5 6 -7

65 This begins and ends the 8-scaling phase.
5 -2 10 2 4 The -scaling phase continues when e(i)   for some i. e(j)  - for some j. There is a path from i to j. 30 25 4 20 1 1 20 19 1 19 3 5 6 -7

66 This begins 4-scaling phase.
5 -2 10 2 4 What would we do if there were arcs with capacity at least 4 and negative reduced cost? 30 25 4 20 1 1 20 19 1 19 3 5 6 -7

67 Select a “large excess” node and find shortest paths.
-7 -8 3 2 4 The shortest path tree is marked in bold and blue. 6 1 1 1 3 5 -6 -8

68 Update the Node Potentials and the Reduced Costs
-11 -7 -8 To update a node potential, subtract the shortest path distance. 2 4 1 2 1 1 Note: low capacity arcs may have a negative reduced cost 4 -4 3 5 -6 -8 -12 -10

69 Send Flow Along a Shortest Path in G(x, 4).
5 -2 10 2 4 Send flow from node 1 to node 7 30 25 4 20 1 1 20 How much flow should be sent? 19 1 19 3 5 6 -7

70 Update the Residual Network
5 -2 6 2 4 4 units of flow were sent from node 1 to node 3 4 26 25 4 4 20 1 1 16 19 4 1 15 3 5 10 -7 -3

71 This ends the 4-scaling phase.
5 -2 6 2 4 4 26 There is no node j with e(j)  -4. 25 4 20 1 1 16 19 4 1 15 3 5 10 -3

72 Begin the 2-scaling phase
5 -2 6 There is no node j with e(j)  -4. 2 4 4 26 25 4 20 What would we do if there were arcs with capacity at least 4 and negative reduced cost? 1 1 16 19 4 1 15 3 5 10 -3

73 Send flow along a shortest path
5 -2 6 2 4 Send flow from node 2 to node 4 4 26 25 4 20 1 1 16 19 4 How much flow should be sent? 1 15 3 5 10 -3

74 Update the Residual Network
3 5 -2 4 2 4 2 units of flow were sent from node 2 to node 4 6 26 25 4 20 1 1 16 19 4 1 15 3 5 10 -3

75 Send Flow Along a Shortest Path
3 4 2 4 Send flow from node 2 to node 3 6 26 25 4 20 1 1 16 19 4 How much flow should be sent? 1 15 3 5 10 -3

76 Update the Residual Network
3 1 2 4 3 units of flow were sent from node 2 to node 3 9 26 25 4 20 1 1 13 19 7 1 12 3 5 13 -3

77 This ends the 2-scaling phase.
1 2 4 Are we optimal? 9 26 25 4 20 1 1 13 19 7 1 12 3 5 13

78 Begin the 1-scaling phase.
1 2 4 Saturate any arc whose capacity is at least 1 and with negative reduced cost. 9 26 25 4 20 1 1 13 19 7 1 12 3 5 13 reduced cost is negative

79 Update the Residual Network
1 2 4 Send flow from node 3 to node 1. 9 26 -1 25 4 20 1 1 13 20 Note: Node 1 is now a node with deficit 7 12 3 5 13 1

80 Update the Residual Network
2 2 4 1 unit of flow was sent from node 3 to node 1. 8 27 25 3 20 1 1 14 20 6 Is this flow optimal? 13 3 5 12

81 The Final Optimal Flow 5 -2 10,8 2 4 30,3 25 23 20 1 20,6 20,20 3
Introduce myself and the Tas. It is critical that students sign up for the virtual campus web site. Hand out instructions on how to use it. Make sure that everyone signs up on the list. Also, create a class list that is separate from the web site. Ask for a show of where students come from. There should be four major contingencies: Grad EECS, ORC, Transportation, Rest 20,20 3 25,13 5 -7 -19

82 The Final Optimal Node Potentials and the Reduced Costs
-7 -11 2 4 Flow is at lower bound. 1 2 1 -4 Introduce myself and the Tas. It is critical that students sign up for the virtual campus web site. Hand out instructions on how to use it. Make sure that everyone signs up on the list. Also, create a class list that is separate from the web site. Ask for a show of where students come from. There should be four major contingencies: Grad EECS, ORC, Transportation, Rest 3 5 Flow is at upper bound -10 -12

83 Max-flow Preflow Push

84

85

86

87

88

89 e(3)=1

90

91 Exact distance: d(i) equals the length of the shortest path from node i to node t in G(x)

92 The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem
Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)

93 Preflow Push 4 2 5 1 3 1 1 2 4 s 4 t 3 2 1 3 This is the original network, and the original residual network.

94 2 2 1 5 2 s 1 4 t 1 3 Initialize Distances 4 5 4 3 2 1 1 3 1 1 2 4 3 2
5 4 3 2 1 1 3 1 1 2 4 2 s 1 4 t 3 2 2 s 1 3 4 5 1 3 t The node label henceforth will be the distance label. d(j) is at most the distance of j to t in G(x)

95 Saturate Arcs out of node s
3 s 4 2 2 2 5 1 5 4 3 2 1 1 3 1 1 2 4 6 2 s 1 4 1 t 3 2 2 2 s s 2 1 3 3 4 4 5 1 3 1 t 3 Saturate arcs out of node s. Move excess to the adjacent arcs Relabel node s after all incident arcs have been saturated.

96 Select, then relabel/push
3 s 4 2 2 2 1 5 5 4 3 2 1 1 3 1 1 2 4 6 2 s 1 4 1 t 3 2 2 s s 2 1 3 4 5 3 1 1 1 t 1 3 Select an active node, that is, one with excess Push/Relabel Update excess after a push

97 Select, then relabel/push
3 s 4 2 2 2 1 5 5 4 3 2 1 1 3 1 1 2 4 2 6 s 4 1 1 t 3 2 s s 3 2 1 3 3 4 5 2 1 1 3 1 2 t 1 Select an active node, that is, one with excess No arc incident to the selected node is admissible. So relabel.

98 Select, then relabel/push
3 s 4 2 2 2 1 5 5 4 3 2 1 1 3 1 1 2 4 2 s 6 1 1 4 t 3 2 s 3 3 s 3 2 1 4 5 2 2 2 2 t 1 1 Select an active node, that is, one with excess Push/Relabel

99 Select, then relabel/push
3 3 s 1 4 2 2 2 2 2 1 1 5 5 4 3 2 1 3 1 3 1 1 2 4 6 2 s 4 1 1 t 3 2 2 3 s s 3 2 1 4 5 5 2 2 2 t 1 1 Select an active node. Push/Relabel

100 Select, then relabel/push
3 2 s 1 4 2 2 2 2 5 1 1 5 4 3 2 1 3 1 3 1 1 2 4 s 2 6 1 4 1 t 3 2 s 3 s 3 2 1 4 5 2 2 2 t 1 1 Select an active node. Push/Relabel

101 Select, then relabel/push
2 3 s 4 1 2 2 2 2 5 2 1 1 5 4 3 2 1 3 1 3 1 1 2 4 6 2 s 4 1 1 t 3 2 3 s s 5 2 3 1 4 5 5 2 2 2 t 1 1 Select an active node. There is no incident admissible arc. So Relabel.

102 Select, then relabel/push
3 1 2 s 4 1 2 2 2 2 5 2 2 1 5 4 3 2 1 3 1 3 1 1 2 4 6 2 s 4 1 1 t 3 2 3 s s 5 3 4 2 1 4 2 2 2 t 1 1 Select an active node. Push/Relabel

103 Select, then relabel/push
3 1 2 s 4 1 2 2 2 2 2 2 1 5 3 5 4 3 2 1 3 1 3 1 1 2 4 5 s 2 6 1 1 4 t 3 2 3 s s 5 5 4 2 3 1 4 2 2 2 t 1 1 Select an active node. There is no incident admissible arc. So relabel.

104 Select, then relabel/push
1 2 3 s 4 1 2 2 2 2 2 2 1 5 3 3 5 4 3 2 1 3 1 3 1 1 2 4 5 6 2 s 1 1 4 t 3 2 s s 3 3 4 2 1 4 5 5 2 2 2 t 1 1 Select an active node. Push/Relabel

105 Select, then relabel/push
1 s 2 4 2 2 2 2 2 3 3 2 5 1 5 4 3 2 1 2 1 3 1 1 2 4 5 s 2 6 1 4 1 1 1 t 3 2 s 3 s 4 3 4 2 1 4 4 5 5 2 2 2 t 1 1 Select an active node. Push/Relabel

106 Select, then relabel/push
1 s 4 2 2 2 2 2 4 2 3 2 2 1 3 5 5 4 3 2 1 2 1 3 1 2 1 2 4 5 6 s 2 1 4 1 t 3 2 2 s s 3 4 4 2 3 1 4 5 5 2 2 2 t 1 1 Select an active node. Push/Relabel

107 Select, then relabel/push
1 s 4 2 2 4 2 2 4 2 3 2 2 1 3 5 5 4 3 2 1 2 1 3 1 2 1 2 4 5 6 s 2 4 1 1 t 3 3 s s 4 4 2 3 1 4 5 5 2 2 2 t 1 1 Select an active node. Push/Relabel

108 Select, then relabel/push
1 s 1 4 4 2 4 2 2 2 5 3 3 5 2 1 2 3 5 4 3 2 1 5 3 1 3 1 2 1 2 4 5 5 6 2 s 1 4 1 t 3 3 s s 4 3 4 2 1 4 5 5 2 2 2 t 1 1 Select an active node. Push/Relabel

109 Select, then relabel/push
1 s 1 4 4 2 4 2 2 2 5 3 3 5 2 1 2 3 5 4 3 2 1 5 3 1 3 1 2 1 2 4 5 5 6 2 s 1 4 1 t 3 3 s s 4 3 4 2 1 4 5 5 2 2 2 t 1 1 One can keep pushing flow between nodes 2 and 5 until eventually all flow returns to node s. There are no paths from nodes 2 and 5 to t, and there are ways to speed up the last iterations.

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132 Assignments Read , 7.3 and 7.6 6.7 6.9 7.2 7.4


Download ppt "Introduction to Maximum Flows"

Similar presentations


Ads by Google