Applications of Maximum Flow and Minimum Cut Problems Transshipment problem Transshipment Problem • Given: Directed network Supply (source) nodes Si with supply amounts 11

Download Report

Transcript Applications of Maximum Flow and Minimum Cut Problems Transshipment problem Transshipment Problem • Given: Directed network Supply (source) nodes Si with supply amounts 11

Applications of Maximum Flow
and Minimum Cut Problems
Transshipment problem
Transshipment Problem
• Given: Directed network
Supply (source) nodes Si with supply amounts 11 and 16
Demand (sink) nodes Di with demand amounts 17 and 8
Total supply ≥ total demand
• Goal: Find a feasible flow through the network which satisfies
the total demand (if such a flow exists).
• Ex.
11
S1
2
5
A
2
4
16
S2
B 4
2
5
5
19
15
C 9
D1 17
5
D2 8
Solving the Transshipment Problem via Maximum Flow
• The transshipment problem can be solved by creating and
solving a related instance of maximum flow problem:
– Create a supersource O. For each supply node Si, add an
arc O  Si with capacity equal to the supply amount of Si .
– Create a supersink T. For each demand node Di, add an arc
Di  T with capacity equal to the supply amount of Di .
11
S1
2
11
O 16
5
5
5
A
2
4
16
S2
B 4
2
19
D1
17
17
T
15
C
8
5
9
D2
8
Solving the Transshipment Problem via Maximum Flow
• Find the maximum flow from O to T in the resulting
auxiliary network.
– If maximum flow value = total demand
then the current maximum flow is a feasible flow for the
transshipment problem,
else the transshipment problem is infeasible.
11
S1
2
11
O 16
5
5
5
A
2
4
16
S2
B 4
2
19
D1
17
17
T
15
C
8
5
9
D2
8
Solving the Transshipment Problem via Maximum Flow
• Iteration 1: O  S1  B D  T is an augmenting path
with residual capacity 4 = min{11, 5, 4, 17}.
• After sending 4 units of flow
through the path O  S1  B D  T ,
the new residual network is:
BD1 is now saturated
04
S1
2
7
11
O 16
40 B 40
0
2
51
5
5
A
0
2
40 D1
13
17
0
04
0
0
0 S2
4
19
T
0
0 15
0
0
C 9
8
5
0
D2
Solving the Transshipment Problem via Maximum Flow
• Iteration 2: O  S1  B  C  D1  T is an augmenting path
with residual capacity 1 = min{7, 1, 2, 15, 13}.
• After sending 1 units of flow
through the path O  S1  B  C  D1  T
the new residual network is:
S1B is now saturated
45
S1
2
67
O 16
54 B 0
0
21
01
5
5
A
0
2
4 D1
13
12
1
0
45
0
0
0 S2
4
19
T
0
01 14
15
0
0
C 9
8
5
0
D2
Solving the Transshipment Problem via Maximum Flow
• Iteration 3: O  S1  A  B  C  D1  T is an augmenting
path with residual capacity 1 = min{6, 5, 5, 1, 14, 12}.
• After sending 1 units of flow
through the path O  S1  A  B  C  D1  T
the new residual network is:
BC is now saturated
56
S1
2
65
O 16
5 B 0
01
10
0
45
54
A
0
2
4 D1
12
11
2
1
56
01
0
0 S2
4
19
T
0
12 13
14
0
0
C 9
8
5
0
D2
Solving the Transshipment Problem via Maximum Flow
• Iteration 4: O  S1  A  C  D1  T is an augmenting path
with residual capacity 2 = min{5, 4, 2, 13, 11}.
• After sending 2 units of flow
through the path O  S1  A  C  D1  T
the new residual network is:
AC is now saturated
68
S1
2
53
O 16
5 B 0
1
0
0
42
4
A
0
20
4 D1
9
11
4
2
68
13
0
0 S2
4
19
T
0
2 13
11
20
0
C 9
8
5
0
D2
Solving the Transshipment Problem via Maximum Flow
• Iteration 5: O  S1  S2  C  D1  T is an augmenting path
with residual capacity 2 = min{3, 2, 19, 11, 9}.
• After sending 2 units of flow
through the path O  S1  S2  C  D1  T
the new residual network is:
S1S2 is now saturated
10
8
S1
20
31
O 16
5 B 0
1
0
0
2
4
A
0
0
4 D1
97
64
10
8
3
20
0 S2
4
19
17
T
0
2 11
9
2
20
C 9
8
5
0
D2
Solving the Transshipment Problem via Maximum Flow
• Iteration 6: O  S2  C  D1  T is an augmenting path
with residual capacity 7 = min{16, 17, 9, 7}.
• After sending 7 units of flow
through the path O  S2  C  D1  T
the new residual network is:
D1T is now saturated
10
S1
0
1
5 B 0
1
0
0
2
4
A
0
0
4 D1
613
07
17
10
3
O 916
2
07 S2
4
17
10
T
0
2 29
2
92
C 9
8
5
0
D2
Solving the Transshipment Problem via Maximum Flow
• Iteration 7: O  S2  C  D2  T is an augmenting path
with residual capacity 8 = min{9, 10, 9, 8}.
• After sending 8 units of flow
through the path O  S2  C  D2  T
the new residual network is:
D2T is now saturated
10
S1
0
1
5 B 0
1
0
0
2
4
A
0
0
4 D1
13
0
17
3
O 19
2
715 S2
4
210
T
8
0
2 2
2
917
C 19
08
5
08
D2
Solving the Transshipment Problem via Maximum Flow
• As D2T and D2T are now saturated a maximum flow has been
achieved.
10
S1
0
1
5 B 0
1
0
0
2
4
A
0
0
4 D1
13
0
17
3
O 1
2
15 S2
4
2
T
8
2 2
2
17
C 1
0
5
8
D2
Solving the Transshipment Problem via Maximum Flow
• In our example,
– The maximum flow from O to T is obtained by applying the
Augmenting Path algorithm. The maximum flow value is 25.
The bold red numbers on the arcs show the flow values.
– Since the maximum flow value = 25 = 17 + 8 = total demand,
the current maximum flow is a feasible flow for the
transshipment problem.
Note that at every node inflow = outflow
17
4
4
D
11 S
5
5
1
B
1
5
2
1
10
17 17
2
3
11
5
T
13
2
O 16
2
A
2
8
2
15
8
5
15
4
19
9
8
17
S
D2 8
C
2
16
Solving the Transshipment Problem via Maximum Flow
• If instead the problem was a traffic flow problem and the flows
represent the maximum traffic flow per minute in specified
streets and the max flows were altered so that :
• CD2 takes 10 and D2T takes 10 then what is the maximum
outflow.
• D2T is no longer saturated and we can continue the flow
augmenting algorithm.
S1
1
11
O 116
15
10
10
20
05
52
5
3
15 S2
4
2
13
3
2
2
45
A
0
20
5 B 04
1
02
4
19
2
17
2 15
2
2
17
C 29
4 D1
0
13
17 1717
T
2
28
5
8
8
D2
8
8
Solving the Transshipment Problem via Maximum Flow
• Iteration 8: O  S2  C  D2  T is an augmenting path with
residual capacity 8 = min{1, 2, 2, 2}.
• After sending 1 units of flow
through the path O  S2  C  D2  T
the new residual network is:
OS2 is now saturated
10
S1
0
1
5 B 0
1
0
0
2
4
A
0
0
4 D1
13
0
17
3
O 01
2
16
15 S2
4
12
T
98
2 2
2
18
17
C 12
12
5
98
D2
Solving the Transshipment Problem via Maximum Flow
• Finally we need to saturate D2T and OS1
• Iteration 9: O  S1  A  S2  C  D2 T is an augmenting
path so switch the residual capacities in A  S2
• residual capacity 1 = min{1, 2, 4, 1, 1, 1}.
• After sending 1 units of flow
through the path O  S1  A  S2  C  D2 T
the new residual network is:
10
S1
0
1
5 B 0
1
0
0
2
4
A
40
0
4 D1
13
0
17
3
O 0
2
16 S2
04
1
T
9
2 2
2
18
C 1
1
5
9
D2
Solving the Transshipment Problem via Maximum Flow
• Finally we need to saturate OS1 and D2T
• Iteration 9: O  S1  A  S2  C  D2 T is an augmenting
path so switch the residual capacities in A  S2
• residual capacity 1 = min{1, 2, 4, 1, 1, 1}.
• After sending 1 units of flow
through the path O  S1  A  S2  C  D2 T
the new residual network is:
OS1 and D2T are now saturated
10
11
S1
0
01
5 B 0
1
0
0
12
4
A
34
0
4 D1
13
0
17
34
O 0
2
16 S2
01
01
T
910
2 2
2
18
19
C 01
5 01
910 D2
Solving the Transshipment Problem via Maximum Flow
• In our example,
– The maximum flow from O to T is obtained by applying the
Augmenting Path algorithm. The maximum flow value is 27.
The bold red numbers on the arcs show the flow values.
– Since the maximum inflow value = 27 and the maximum
outflow = 27 demand we have established the maximum
flow along each path.
– Note that at every node inflow = outflow
S1
11
11
O 16
2
5
5
5
4
2
1
16
4
S2
19
5
A
2
19
B 4
2
1
4
2
13
2
D1
17
T
15
C
10
5
10
17
10
D2
10