Chapter 6- Network Flows Optimization
Chapter 6- Network Flows Optimization
1. Maximum Flows
¨ LP Model
¨ Ford-Fulkerson Algorithm
1
1. Maximum Flows
¨ Many types of networks: transportation network, information
network, electricity network, manufacturing, distributing, planning,
positioning facilities,…
¨ Given a graph with “Source” and “Sink” nodes we want to compute:
The maximum rate at which fluid can flow from Source to Sink
The rate of flow through each edge of the graph
¨ Given a graph:
Edges have flow capacities
Min-
First value is flow capacity a cut
Second value is current flow rate 5, 4,
Edges behave like pipes 2 4
Nodes are junctions of pipes s 6, t
2
8, 5,
7 5
b
Max Flows Problem (cont.)
Flow f(u,v) is a real-valued function
defined for every edge (u,v) in the graph
The flow needs to satisfy the
following 3 properties:
f(u,v) ≤ c(u,v) i.e. capacity of edge
(u,v)
f(u,v) = - f(v,u)
Flow coming into node v = Flow
leaving v
a
5, 2
4, 4
8, 5,
7 5
b
s
Max Flows Problem (cont.)
Residual Graph:
A Graph that contains edges that can admit
more flow
Define a Graph G(V,E’) for G(V,E)
We define residual flow r(u,v) = c(u,v) – f(u,v)
If r(u,v) > 0 then (u,v) is in E’
Original a Residual
Graph a 2 Graph
5, 4, 4
2 4 3
s 6, t s 4 t
2 2
1
8, 5, 5
7
7 5
b Preflow Push
b 4
Algorithm
1.1. LP Model 1 2
(3)
(2)
(4)
0 ≤ xij ≤ cij (5)
¨ Where:
¨ x = volume of flows pass through arc (i, j)
ij
¨ x = total flow entering the sink
0
¨ For a flow to be feasible, it must have two characteristics:
¨ 0≤ flow through each arc ≤ arc capacity
¨ Flow into node i = Flow out of node i
Example
¨ Sunco Oil wants to ship the maximum
possible amount of oil (per hour) via
pipeline from node so to node si in the
following figure. On its way from node so
to node si, oil must pass through some or
all of stations 1, 2, and 3. The various
arcs represent pipelines of different
diameters. The maximum number of
barrels of oil (millions of barrels per hour)
that can be pumped through each arc is
shown in the following table. Each
number is called an arc capacity.
Formulate an LP that can be used to
determine the maximum number of
barrels of oil per hour that can be sent
from so to si.
Solution
1.2. Ford-Fulkerson Algorithm
¨ Questions:
¨ Q1: Given a feasible flow, how can we tell if it is an optimal flow (that is,
maximizes x0)?
¨ Q2: If a feasible flow is nonoptimal, how can we modify the flow to obtain a
new feasible flow that has a larger flow from the source to the sink?
¨ Properties:
¨ P1: The flow through arc (i, j) is below the capacity of arc (i, j). In this case,
the flow through arc (i, j) can be increased. For this reason, we let I
represent the set of arcs with this property.
¨ P2: The flow in arc (i, j) is positive. In this case, the flow through arc (i, j)
can be reduced. For this reason, we let R be the set of arcs with this
property.
Example: Set I and R
Capacity
The Ford-Fulkerson Labeling Procedure
¨ Purpose: to modify a feasible flow in an effort to increase the flow from the source to
the sink.
¨ Step 1: Label the source.
¨ Step 2: Label nodes and arcs (except for arc a0) according to the following rules:
1. If node x is labeled, then node y is unlabeled and arc (x, y) is a member of I; then
label node y and arc (x, y). In this case, arc (x, y) is called a forward arc.
2. If node y is unlabeled, node x is labeled and arc (y, x) is a member of R; label
node y and arc (y, x). In this case, (y, x) is called a backward arc.
¨ Step 3: Continue this labeling process until the sink has been labeled or until no more
vertices can be labeled. If the sink cannot be labeled current flow is optimal.
¨ Output: a chain of labeled arcs (call it C) leading from the source to the sink
adjusting the flow of the arcs in C, we can maintain a feasible flow and increase the
total flow from source to sink.
¨ Case 1 C consists entirely of forward arcs
¨ Case 2 C contains both forward and backward arcs To increase the flow from
source to sink (while maintaining a feasible flow), decrease the flow in all of C’s
backward arcs by min (k1, k2) and increase the flow in all of C’s forward arcs by
min(k1, k2).
Capacity
Example for Case 1
Example for Case 2
The Ford-Fulkerson Algorithm
¨ Step 1 Find a feasible flow (setting each arc’s flow
to zero will do).
¨ Step 2 Using the labeling procedure, try to label
the sink. If the sink cannot be labeled, then the
current feasible flow is a maximum flow; if the sink
is labeled, then go on to step 3.
¨ Step 3 Using the method previously described,
adjust the feasible flow and increase the flow from
the source to the sink. Return to step 2.
Example
Practice
Solution
2. Minimum-Cost Network Flow
Problems (MCNFP)
¨ Let:
¨ xij = number of units of flow sent from node i to node j through arc
(i, j)
¨ bi = net supply (outflow or inflow) at node i
¨ cij = cost of transporting 1 unit of flow from node i to node j via arc (i,
j)
¨ Lij = lower bound on flow through arc (i, j). If there is no lower bound,
let Lij = 0
¨ Uij = upper bound on flow through arc (i, j). If there is no upper
bound, let Uij = ∞
2.1. The LP Model of the MCNFP
(3)
(4)
18
Some Assumptions
1. All data is integral. (Needed for some proofs, and
some running time analysis).
19
Example: The Traffic Assignment
¨ Each hour, an average of 900 cars enter the network in the following figure
at node 1 and seek to travel to node 6. The time it takes a car to traverse
each arc is shown in the following table. In the figure, the number above
each arc is the maximum number of cars that can pass by any point on the
arc during a one-hour period. Formulate an MCNFP that minimizes the
total time required for all cars to travel from node 1 to node 6.
Solution
21
Example: Transshipment Problems
Plants with given production capabilities for a
product.
6 400
310 2
7 180
Retailers
100 3
5
Plants
Warehouses
23
2.2. Finding a feasible solution
One can find a feasible solution when all lower
bounds are 0 by solving a single max flow
problem.
1. If b(j) > 0, create arc (s, j) with usj = b(j),
2. If b(j) < 0, create arc (j, t) with ujt = - b(j)
2 -4
2
2 4 4
5 -4
5 4
s 1 6 t
2
3 5
3
3 -2 24
Finding an artificial feasible solution
One can start with an “artificial” feasible solution with large
cost. The flow in these arcs will be 0 at the end.
1. Add nodes s and t with b(s) = b(t) = 0
2. If b(j) > 0, create arc (j, t) with ujt = b(j) and cjt = 0
3. If b(j) < 0, create arc (s, j) with usj = - b(j) and cjt = 0
4. Add an arc (t, s) with uts = mumax and cts = mcmax
2 -4
2
2 4 4
5 -4
5 4
t 1 6 s
2
3 5
3
3 -2 cost = - M 25
Finding an artificial feasible solution
2 -4
2
2 4 4
5 -4
5 4
t 1 6 s
2
3 5
3
3 -2
Initial solution.
• If b(j) > 0, then xjt = b(j) (supplies are satisfied)
• If b(j) < 0, then xsj = - b(j) (demands are satisfied)
• xts = ∑b(j)>0 b(j) (flow into t = flow out of t)
• xij = 0 otherwise
3 3 5
0 0
uij - xij 5
cij $10
i j 1 2
xij 3
-cij -$10
Reducing the flow in (i, j) by 1 is equivalent to sending one
unit of flow from j to i. It reduces the cost by cij.
29
Negative cost cycles & augmentations
-4
2 4
7 Note: each arc of G(x) has
-7 a cost and a capacity.
1 2
5 -2
-5 -1 Typically, we will only show
one of them.
6
2
3 5
-2 A negative cost cycle refers
to a directed cycle in G(x)
A residual network G(x) whose total cost is
and its arc costs. negative, e.g., 1-3-2-1 and
3-5-4-3
30
Negative cost cycles & augmentations
10
2 4
5
To augment around a cycle
25 10
1 15 10 C is to send δ units of flow
20
10 around C, where
δ = min {rij : (i, j) ∈ C}
20
20
3 5
5 The cycle 1-3-2-1 had
negative cost. Its capacity
The capacities of the is 15.
residual network G(x).
31
The impact of an augmentation
10
2 4 10
2 4
5
20
25 10
1 10 10
15 10 20 1
10 25 20
10
15
20
20 5
3 5 20
3 5
5
5
32
2.3. Cycle-Canceling Algorithm
¨ The algorithm first establishes a feasible flow x in the network.
¨ Then it iteratively finds negative cost-directed cycles in the
residual network and augments flows on these cycles.
¨ The algorithm terminates when the residual network contains no
negative cost-directed cycle.
A Negative Cycle
¨ A negative cycle is a directed cycle such that the sum of its
edge weights is negative
Example
(i , j) (j , i)
Cost
Residual
capacity
3. The Multicommodity Flow Problem
¨ Network G = (N, A)
¨ K origin-destination pairs of nodes
(s1, t1), (s2, t2), …, (sK, tK)
¨ dk = amount of flow that must be sent from s k to tk.
¨ uij = capacity on (i,j) shared by all commodities
¨ cijk
= cost of sending 1 unit of commodity k in (i,j)
k
x
¨ ij = flow of commodity k in (i,j)
36
A Linear Multicommodity Flow Problem
5 units $5 5 units
good 1 1 4 good 1
$1 $1
$1
2 5
u25 = 5
$1
$1
2 units $6 2 units
good 2 3 6 good 2
37
A Linear Multicommodity Flow Problem
5 units $5 5 units
good 1 1 4 good 1
$1 $1 2 2 2
x32 x25 x56 2
$1
1 1 1
2 5 x12 x25 x54 3
u25 = 5 1
x14 2
$1
$1
2 units $6 2 units
good 2 3 6 good 2
38
The Multicommodity Flow LP
Min ij x ij
c k k
( i , j )A k
d k if i sk Supply/
demand
j ij j ji d k if i t k
x k
x k
constraints
0 otherwise
Bundle
ij uij
x
k
k
for all (i , j ) A
constraints
x ijk 0 (i , j ) A, k K
39
Assumptions
¨ Homogeneous goods. Each unit flow of commodity k
on (i, j) uses up one unit of capacity on (i,j).
highways
Distribution plants trucks,
railway tracks
Networks warehouses,... trains, etc
etc.
41
On Fractional Flows
42
A Fractional Multicommodity Flow
uij = 1 for all arcs 1 unit of flow must be sent
from si to ti for i = 1, 2, 3.
cij = 0 except as listed.
s1 t3
$2 $2
t1 1 s3
2 3
s2 t2
$2 43
A Fractional Multicommodity Flow
uij = 1 for all arcs 1 unit of flow must be sent
from si to ti for i = 1, 2, 3.
cij = 0 except as listed.
s1 t3
$2
$2
t1 1 s3
Optimal solution:
2 3
send ½ unit of flow
in each of these
15 arcs.
s2 t2 Total cost = $3.
$2 44
Decomposition Based Approaches
¨ Price directed decomposition.
¨ Focus on prices or tolls on the arcs. Then solve the problem
while ignoring the capacities on arcs.
¨ Resource directive decomposition.
¨ Allocate flow capacity among commodities and solve
¨ Simplex based approaches
¨ Try to speed up the simplex method by exploiting the structure of
the MCF problem.
45
A Formulation Without OD Pairs
Minimize
1k K
ck x k (1a)
subject to
1k K
x ijk uij for all (i , j ) A (1b)
for all (i , j ) A
0 x u k k
(1d)
ij ij
for k 1, 2, ..., k
46
Optimality Conditions: Partial Dualization
The multicommodity flow x = (xk) is an optimal
multicommodity flow for (1) if there exists non-negative
prices w = (wij) on the arcs so that the following is true
1. If w ij 0, then k ij uij
x k
$1 $1 2 2 2
x32 x25 x56 2
$1
1 1 1
2 5 x12 x25 x54 3
u25 = 5 1
x14 2
$1
$1
2 units $6 2 units
good 2 3 6 good 2