Handout #13

advertisement
IEEM 201 – Handout #13
NETWORK MODELS –
MAXIMUM FLOW PROBLEM
Problem description:
A
5
7
O
3
1
4
B
2
5
1
4
C
4
9
D
T
6
E
In the Seervada Park example, during the peak season, to
protect the ecology and the wildlife, the management has
imposed on each trail (i.e., each arc) the upper limit of visitors
per day and the direction. Thus, the management wants to
arrange the flows of visitors so that the maximum number of
visitors can reach the scenic wonder (Node T, the destination)
from the park entrance (Node O, the origin) per day.
In general, this is called the maximum flow problem. The
problem requires the identification of the flows in a network
that have the maximum total magnitude. In the maximum flow
problem, arcs have capacities and are directed arcs typically.
1
IEEM 201 – Handout #13
Residual capacity:
Assuming that there is a flow of 5 units through the arc OB.
7
O
2
5
B
7: capacity of the arc
5: magnitude of flow through the arc
2: residual capacity
Given above, by how much can we increase the flow in the arc?
Given above, by how much can we reduce the flow in the arc?
(Note: According to the textbook, the value 5 in this example
can also be called as the residual capacity for assigning another
kind of “flow” from node B to node O, which has the effect of
reducing the normal flow from node O to node B.)
2
IEEM 201 – Handout #13
Augmenting path:
An augmenting path is a path from the origin to the destination
such that every arc on this path has strictly positive residual
capacity.
O
7
0
B
T
0
5
0
E
6
Solution idea:
We select augmenting path from the network and add flow
until there exist no augmenting paths.
3
IEEM 201 – Handout #13
Detailed solution approach in graph:
Starting graph (no flow in the network):
A
0
3
1
5
0
7
O
0
0
2
4
4
B
0
E
4
T
0
1
0
C
0
0
5
0
0
9
D
6
0
Iteration 1: a flow of 5 units to the path OBET
0
A
3
1
5
5
O
0
2
5
0
0
C
4
B
2
4
0
0
0
0
5
4
D
9
0
T
5
5
1
E
1
0
4
IEEM 201 – Handout #13
Iteration 2: a flow of 3 units to the path OADT
3
A
0
1
2
8
O
0
2
5
3
2
4
4
B
5
C
D
6
T
8
T
9
1
E
4
3
5
0
0
0
0
0
1
0
Iteration 3: a flow of 1 unit to the path OABDT
4
A
0
0
1
9
O
1
2
5
0
0
C
3
B
2
4
3
1
0
0
5
4
D
5
4
5
1
E
1
0
5
IEEM 201 – Handout #13
Iteration 4: a flow of 2 units to the path OBDT
A
4
0
0
1
11
1
0
O
7
3
2
4
1
B
3
6
E
4
T
11
5
1
5
C
3
0
0
0
0
D
1
0
Iteration 5: a flow of 1 unit to the path OCEDT
4
A
0
0
1
12
O
1
0
7
B
2
3
0
1
C
3
1
3
1
0
5
3
D
2
7
T
12
5
0
E
1
1
6
IEEM 201 – Handout #13
Iteration 6: a flow of 1 unit to the path OCET
4
A
0
0
1
13
O
1
0
7
3
B
2
2
1
5
C
D
2
T
13
0
E
2
7
6
1
0
0
2
3
0
2
Iteration 7: a flow of 1 unit to the path OCEBDT
4
A
0
0
1
14
O
1
0
7
0
3
C
0
B
2
1
3
4
1
1
1
4
1
D
8
T
14
6
0
E
0
3
No additional augmenting path exists. Stop.
7
IEEM 201 – Handout #13
Why does last iteration work: Consider OCEBDT
Before selecting this augmenting path (Iteration 6)
Flow through
Input flow
Output flow
the node
into the node
from the node
Node C
Node E
Node B
Node D
After selecting this augmenting path (Iteration 7)
Flow through
Input flow
Output flow
the node
into the node
from the node
Node C
Node E
Node B
Node D
8
IEEM 201 – Handout #13
Remarks:
 For node C and node D (the nodes at two sides), flows going
through them are increased by 1 unit, which contributes to
the overall increment of the flow through the network.
 For node E and node B (the nodes inbetween), flows going
through them keep the same in terms of magnitude.
However, the input or output of the flows may be changed.
 The augmenting path can contain some arc whose direction
is opposite to the direction of the path, as long as that arc has
positive flow and thus allows reduction.
Optimal Solution:
4
A
0
0
1
14
O
1
0
7
B
2
1
0
3
C
3
0
4
1
1
4
1
D
1
8
T
14
6
0
E
0
3
Maximum flow is 14
9
IEEM 201 – Handout #13
We do we reach the optimal solution?
Path
OAD…
Why not an augmenting path
OAB…
OB…
OCB…
OCED…
OCET…
OCEBC…
OCEBO…
OCEBD…
OCEBAD…
OCEBAO…
10
IEEM 201 – Handout #13
Augmenting Path Algorithm for Maximum Flow Problem:
1.
Identify an augmenting path by finding some directed path
from the source to the sink in the residual network such that
every arc on this path has strictly positive residual capacity.
(If no augmenting path exists, the net flows already assigned
constitute an optimal flow pattern.)
2.
Identify the residual capacity c* of this augmenting path by
finding the minimum of the residual capacities of the arcs on
this path. Increase the flow in this path by c*.
3.
Decrease by c* the residual capacity of each arc on this
augmenting path. Increase by c* the residual capacity of each
arc in the opposite direction on this augmenting path. Return
to Step 1.
11
IEEM 201 – Handout #13
DYNAMIC PROGRAMMING AND
SHORTEST PATH PROBLEM REVISITED
Stagecoach problem:
$7
B
E
$1
$4
$2
$4
$6
$3
$3
A
$4
$6
$2
C
H
F
J
$3
$4
$4
$3
$1
D
Stage 1
Stage 2
I
$3
$4
$5
$3
G
Stage 3
Stage 4
In the Stagecoach example, the decision is to find a path from
the origin A to the destination J, with the objective to minimize
the total traveling cost. We formulated and solved this example
as a dynamic programming (DP) problem.
Could we solve the above problem as a shortest path problem?
12
IEEM 201 – Handout #13
Solving the Stagecoach problem as a shortest path problem:
7
B
E
1
4
2
4
6
3
A
4
3
6
2
C
H
F
J
3
4
3
4
1
D
I
3
4
3
5
G
13
IEEM 201 – Handout #13
Seervada Park problem:
A
7
2
2
5
O
4
B
1
3
1
4
C
4
5
D
T
7
E
In the Seervada Park example, one decision is to determine a
path from Node O to Node T that has the smallest total
distance. We solved this problem as a shortest path problem.
Could we solve formulate and solve the above problem as a DP
problem?
14
IEEM 201 – Handout #13
Formulating the Seervada Park problem as a DP problem:
15
Download