week 11.2, wednesday, oct 30 - purdue university · 2019. 10. 30. · 1 week 11.2, wednesday, oct...
TRANSCRIPT
![Page 1: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/1.jpg)
1
Week 11.2, Wednesday, Oct 30Midterm 2 Tonght! October 30 (8-9:30PM) MTHW 210 and BRNG 2280
Friday PSO BRNG 2280 (Exam Capacity 62)All Others MTHW 210 (Exam Capacity 111)
Practice Midterm 2 & Solutions on PiazzaNo PSOs this week (Due to Midterm)
![Page 2: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/2.jpg)
Friday PSO BRNG 2280 (Exam Capacity 62) All Others MTHW 210 (Exam Capacity 111) Focus: Dynamic Programing and Graph
Algorithms Lectures 15 to 28 No Network Flow (today’s lecture)
Same Rules as Midterm 1 Allowed to prepare 1 page of handwritten notes No calculators, phones, smartwatches etc… Make sure your writing implement shows up clearly
when scanned! Number 2 pencils work
![Page 3: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/3.jpg)
3
Chapter 7
Network Flow
Slides by Kevin Wayne.Copyright © 2005 Pearson-Addison Wesley.All rights reserved.
![Page 4: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/4.jpg)
4
Soviet Rail Network, 1955
Reference: On the history of the transportation and maximum flow problems.Alexander Schrijver in Math Programming, 91: 3, 2002.
![Page 5: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/5.jpg)
5
Maximum Flow and Minimum Cut
Max flow and min cut. Two very rich algorithmic problems. Cornerstone problems in
combinatorial optimization. Beautiful mathematical duality.
Nontrivial applications / reductions. Data mining. Open-pit mining. Project selection. Airline scheduling. Bipartite matching. Baseball elimination. Image segmentation. Network connectivity.
Network reliability. Distributed computing. Egalitarian stable matching. Security of statistical data. Network intrusion detection. Multi-camera scene reconstruction. Many many more …
![Page 6: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/6.jpg)
6
Flow network. Abstraction for material flowing through the edges. G = (V, E) = directed graph, no parallel edges. Two distinguished nodes: s = source, t = sink. c(e) = capacity of edge e.
Minimum Cut Problem
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4capacity
source
sink
![Page 7: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/7.jpg)
7
Def. An s-t cut is a partition (A, B) of V with s ∈ A and t ∈ B.
Def. The capacity of a cut (A, B) is:
Cuts
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4
Capacity = 10 + 5 + 15= 30
A
cap( A, B) = c(e)e out of A
∑
![Page 8: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/8.jpg)
8
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4A
Cuts
Def. An s-t cut is a partition (A, B) of V with s ∈ A and t ∈ B.
Def. The capacity of a cut (A, B) is:
cap( A, B) = c(e)e out of A
∑
Capacity = 9 + 15 + 8 + 30= 62
![Page 9: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/9.jpg)
9
Min s-t cut problem. Find an s-t cut of minimum capacity.
Minimum Cut Problem
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4A
Capacity = 10 + 8 + 10= 28
![Page 10: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/10.jpg)
Clicker Question
Find the minimum capacity s-t cut (A, B=V\A)
Choice A: A={s,b}, B={a,c,t}Choice B: A={s,a}, B={b,c, t}Choice C: A={s,a,b}, B={c, t}Choice D: A={s,a,b,c,t}, B={}Choice E: A={a,b}, B={s,c,t}
10
s
a
b
c
2
9
10002
100t104
![Page 11: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/11.jpg)
11
![Page 12: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/12.jpg)
Clicker Question
Find the minimum capacity s-t cut (A, B=V\A)
Choice A: A={s,b}, B={a,c,t}Choice B: A={s,a}, B={b,c, t}Choice C: A={s,a,b}, B={c, t}Choice D: A={s,a,b,c,t}, B={} (Not a s-t cut)Choice E: A={a,b}, B={s,c,t} (Not a s-t cut)
12
s
a
b
c
2
9
10002
100t104
![Page 13: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/13.jpg)
13
Def. An s-t flow is a function that satisfies: For each e ∈ E: [capacity] For each v ∈ V – {s, t}: [conservation]
Def. The value of a flow f is:
Flows
4
0
0
0
0 0
0 4 4
00
0
Value = 40
f (e)e in to v
∑ = f (e)e out of v
∑
0 ≤ f (e) ≤ c(e)
capacityflow
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4 0
v( f ) = f (e) e out of s
∑ .
4
![Page 14: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/14.jpg)
14
Def. An s-t flow is a function that satisfies: For each e ∈ E: [capacity] For each v ∈ V – {s, t}: [conservation]
Def. The value of a flow f is:
Flows
10
6
6
11
1 10
3 8 8
00
0
11
capacityflow
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4 0
Value = 24
f (e)e in to v
∑ = f (e)e out of v
∑
0 ≤ f (e) ≤ c(e)
v( f ) = f (e) e out of s
∑ .
4
![Page 15: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/15.jpg)
15
Max flow problem. Find s-t flow of maximum value.
Maximum Flow Problem
10
9
9
14
4 10
4 8 9
1
0 0
0
14
capacityflow
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4 0
Value = 28
![Page 16: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/16.jpg)
16
Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s.
Flows and Cuts
10
6
6
11
1 10
3 8 8
00
0
11
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4 0
Value = 24
f (e)e out of A
∑ − f (e)e in to A
∑ = v( f )
4
A
![Page 17: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/17.jpg)
17
Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s.
Flows and Cuts
10
6
6
1 10
3 8 8
00
0
11
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4 0
f (e)e out of A
∑ − f (e)e in to A
∑ = v( f )
Value = 6 + 0 + 8 - 1 + 11= 24
4
11
A
![Page 18: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/18.jpg)
18
Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s.
Flows and Cuts
10
6
6
11
1 10
3 8 8
00
0
11
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4 0
f (e)e out of A
∑ − f (e)e in to A
∑ = v( f )
Value = 10 - 4 + 8 - 0 + 10= 24
4
A
![Page 19: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/19.jpg)
19
Flows and Cuts
Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then
Pf.
f (e)e out of A
∑ − f (e) = v( f )e in to A
∑ .
by flow conservation, all termsexcept v = s are 0
![Page 20: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/20.jpg)
20
Flows and Cuts
Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then
Pf.
f (e)e out of A
∑ − f (e) = v( f )e in to A
∑ .
Flow into s is 0
![Page 21: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/21.jpg)
21
Flows and Cuts
Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then
Pf.
f (e)e out of A
∑ − f (e) = v( f )e in to A
∑ .
If e=(u,v) with u and v in A then f(e) was added & subtracted in prior sum
![Page 22: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/22.jpg)
22
Flows and Cuts
Weak duality. Let f be any flow, and let (A, B) be any s-t cut. Then the value of the flow is at most the capacity of the cut.
Cut capacity = 30 ⇒ Flow value ≤ 30
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4
Capacity = 30
A
![Page 23: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/23.jpg)
23
Weak duality. Let f be any flow. Then, for any s-t cut (A, B) we havev(f) ≤ cap(A, B).
Pf.
Flows and Cuts
s
t
A B
7
6
84
By Flow value lemma.
![Page 24: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/24.jpg)
24
Certificate of Optimality
Corollary. Let f be any flow, and let (A, B) be any cut.If v(f) = cap(A, B), then f is a max flow and (A, B) is a min cut.
Value of flow = 28Cut capacity = 28 ⇒ Flow value ≤ 28
10
9
9
14
4 10
4 8 9
1
0 0
0
14
s
2
3
4
5
6
7
t
15
5
30
15
10
8
15
9
6 10
10
10154
4 0A
![Page 25: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/25.jpg)
25
Towards a Max Flow Algorithm
Greedy algorithm. Start with f(e) = 0 for all edge e ∈ E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck.
s
1
2
t
10
10
0 0
0 0
0
20
20
30
Flow value = 0
![Page 26: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/26.jpg)
26
Towards a Max Flow Algorithm
Greedy algorithm. Start with f(e) = 0 for all edge e ∈ E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck.
s
1
2
t
20
Flow value = 20
10
10 20
30
0 0
0 0
0
X
X
X
20
20
20
![Page 27: Week 11.2, Wednesday, Oct 30 - Purdue University · 2019. 10. 30. · 1 Week 11.2, Wednesday, Oct 30 Midterm 2 Tonght! October 30 (8- 9:30PM) MTHW 210 and BRNG 2280. Friday PSO BRNG](https://reader033.vdocuments.mx/reader033/viewer/2022052021/60353dfff7217a7f430f6a62/html5/thumbnails/27.jpg)
27
Towards a Max Flow Algorithm
Greedy algorithm. Start with f(e) = 0 for all edge e ∈ E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck.
greedy = 20
s
1
2
t
20 10
10 20
30
20 0
0
20
20
opt = 30
s
1
2
t
20 10
10 20
30
20 10
10
10
20
locally optimality ⇒ global optimality