Network Flow Problems: Total Distance From O To F ?
Network Flow Problems: Total Distance From O To F ?
A Prototypical Example
A new amusement park is being constructed by a large corporation. Cars are not allowed into the park, but
there is a system of narrow, winding pathways for automated people movers and pedestrians. The road
system is shown in the figure below, where O represents the entrance to the park and A-F represent sites of
various popular amusements. The numbers above the arcs give the distances of the arcs.
A F
7
2 5
2
5 4
O B D
7
1 1
3
4
C
E
4
The designers face three questions:
1. Electrical lines must be laid under the pathways to establish communication between all nodes in the
network. Since this is an expensive process, the question to be answered is how this can be
accomplished with a minimum total distance ?
2. Location F is extremely popular with visitors, and it is planned that a small number of people movers
will run directly from the entrance O to site F. The question is which path will provide the smallest
total distance from O to F ?
3. During the peak season the number of people wanting to go from O to F is very large. Thus during this
time various routes may be followed from O to F (irrespective of distance) so as to accommodate the
increased demand through additional trips. However, due to the terrain and the quality of the
construction, there are limits on the number of people mover trips that can run on any given path per
day; these are different for different paths. The question is how to route various trips to maximize the
number of trips that can be made per day without violating the limits on any individual path ?
Objective at Iteration i: To find the i th closest node from O, along with the
corresponding path and distance.
At Iteration i: Determine all nodes in T that are directly linked to at least one
node in P – call this subset of T as Ω.
For each j∈Ω, compute Dj= Minimum{distance of direct link from j to a
permanent node + shortest distance from O to that permanent node}.
Determine the j∈Ω that has the minimum value for Dj. Remove j from T and
add it to P along with the shortest path and distance.
Example: Iteration 1
A P={O}; T={A,B,C,D,E,F}
2 Ω = {A, B, C}
5 DA=Min{LOA+0}=2
O B
DB=Min{LOB+0}=5
DC=Min{LOC+0}=4
4
Closest node = {A}
C
Iteration 2
2 A P={O,A}; T={B,C,D,E,F}
2 7
2
Ω = {B, C, D}
5
O B D
DB=Min{LOB+0, LAB+2}=4
DC=Min{LOC+0}=4
4 DD=Min{LAD+2}=9
C
Iteration 3
P={O,A,C}; T={B,D,E,F}
2 A
2 7 Ω = {B, D, E}
2
5
DB=
O B D
Min{LOB+0, LAB+2,
LOC+4}=4
1
4
DD=Min{LAD+2}=9
4
C
4 E DE=Min{LCE+4}=8
Iteration 4
2 A P={O,A,C,B}; T={D,E,F}
2 7
2
Ω = {D, E}
O 4 B D
4 DD =Min{LAD+2, LBD+4}=8
3
DE =Min{LCE+4, LBE+4}=7
4
C E
4 4
4th closest node = {E}
Iteration 5
P={O,A,C,B,E}; T={D,F}
2 A
Ω = {D, F}
F
2 7
2
DD =
O 4 B D
4 Min{LAD+2, LBD+4,
7
1 LED+7}=8
3
4
DE =Min{LCE+4, LBE+4}=7
C E
4 7
8
O 4 B D
4 DF = Min{LED+7, LDF+5}=13
7
1
3
4
4
C
7
E 6th closest node = {F}
DONE!
2 A 13 F
2 5
2
4
O 4 B D 8
1
3
4
C
4 E 7
THE FORD-FULKERSON ALGORITHM FOR THE MAXIMUM
FLOW PROBLEM
STEP 0: Start with some feasible flow (if one isn't obvious let flow in each
arc be equal to zero) from the source node to the sink node.
STEP 1: If flow in arc (i-j) is less than capacity of arc (i-j) assign it to set I
(set of arcs along which amount of flow can be Increased). If flow in arc (i-j)
is greater than zero assign it to set R (set of arcs along which amount of flow
can be Reduced).
NOTE: An arc can belong to both I and R.
If the flow along an arc (i-j) is from a labeled node to an unlabeled node and
the arc belongs to I, then label the unlabeled node, call the arc a forward arc
and let I(i-j) = Capacity(i-j) - Flow(i-j)
If the flow along an arc is from an unlabeled node to a labeled node and the
arc belongs to R, then label the unlabeled node and call the arc a backward
arc and let R(i-j) = Flow(i-j)
Continue the labeling procedure until (a) the sink has been labeled, or (b) no
more nodes can be labeled.
STEP 4: If the sink has not been labeled, STOP; this is the optimum flow. If
the sink has been labeled go to Step 5.
O 7 B 4 D
6
2 5 1
1
4
C E
4
A F
3 9
5 1
1
O 7 B 4 D
6
2 5 1
1
4
C E
4
A F
3 9
5 1
1
O 7 B 4 D
6
2 5 1
1
4
C E
4
A F
3 9
5 1
1
O 7 B 4 D
6
2 5 1
1
4
C E
4
A F
3 9
5 1
1
O 7 B 4 D
6
2 5 1
1
4
C E
4