Minimum Cost flow Problems

Outline


LP formulation of minimal cost flow problem
useful results from shortest path problem









optimality condition
residual network
potentials of nodes
reduced costs of arcs (with respect to a given set of potentials)
the optimality conditions for networks
network simplex and existence of negative cycle
transportation simplex method
transportation by eliminating negative cycles
determining an initial feasible solution for a minimal flow problem
1
Minimum Cost Flow Models
 G:
(connected) network, i.e., G = (N, A)
 N:
the collection of nodes in G, i.e., N = {j}
 A:
the collection of arcs in G, i.e., A = {(i, j)}
 cij:
the cost of arc (i, j)
 uij:
the capacity of arc (i, j)
 b(i):
How to deal
with an
undirected arc?
the amount of flow out of node i
 b(i)
> (resp. <) 0 for out (resp. in) flow
Assume
direct arcs.
2
Minimum Cost Flow Models
2
(5, 7)
(cij, uij)
4
(3, 5)
(3, 8)
(2, 3)
9 1
(2, 3)
3
(2, 2)
6
(5, 4)
(4, 3)
5
-9
(4, 6)
N
= {1, 2, 3, 4, 5, 6}
A
= {(1, 2), (1, 3), (2, 3), (2, 4), (2, 5), (3, 5),
(4, 6), (5, 4), (5, 6)}
 b(1)
= 9, b(6) = -9, and b(i) = 0 for i = 2 to 5
3
A Minimum Cost Flow LP Model
min z(x) =
s.t.

 cij xij ,
(i , j )A
{ j:(i , j )A}
xij 

{ j:( j ,i )A}
0  xij  uij ,
xij  b(i ), for all i  A,
for all (i, j )  A.
min z(x) = 3x12  2 x13  2 x23  5 x24  2 x25  4 x35  3x36  5 x54  4 x56 ,
s.t.
x12  x13  9,
x23  x24  x25  x12  0,
x35  x13  x23  0,
x46  x24  x54  0,
x56  x25  x35  0,
 x46  x56  9,
0  x12  8, 0  x13  3, 0  x23  3,
0  x24  7, 0  x25  2, 0  x35  3,
0  x46  5, 0  x54  4, 0  x56  6.
2
(5, 7)
4
(3, 5)
(3, 8)
9
(2, 2)
(2, 3)
1
6
(5, 4)
(2, 3)
3
(4, 3)
(4, 6)
5
4
-9
Useful Results
from Shortest-Path Algorithms
5
Useful Results
from Shortest-Path Algorithms
 optimality
 residual
condition for shortest distances
network
 potentials
of nodes
 reduced
costs of arcs with respect to a given
set of potentials
6
Optimality Condition
for Shortest Distances
 Theorem.
Let G = (N, A) be a directed graph;
d() be a function defined on N. Then d() is
the shortest distance of node () from node 1 iff
 d(1)
= 0;
 d(i)
is the length of a path from node 1 to node i;
and
 d(j)
 d(i) + cij for all (i, j)  A.
7
Optimality Condition
for Shortest Distances
d(1) = 0
2
2
6
d(4) = 7
1
7
4
3
d(1) = 0
d(4) = 8
1
1
4
d(3) = 3
6
2
7
4
4
3
d(3) = 3
LHS figure: {d(i)} = {0, 2, 3, 7}



d(2) = 2
2
1

d(2) = 2
for all i, d(i) being shortest distance of node i from node 1
satisfying the three conditions
RHS figure: {d(i)} = {0, 2, 3, 8}

d(4) = the distance of a path from node 1 to node 4

d(3) + c34 < d(4), i.e., this set cannot be the collection of shortest distances
from nodes
8
Residual Network
1
(8, 5)
(2,7)
(8,5)
Figure 1. Costs and Capacities
of Arcs
3
s
1
0
t
(6, 4)
Figure 3. The Residual Network
Corresponding to Figure 1
(6,4)
3
(8, 2)
3
t
Figure 2. Flows on arcs
(2, 7)
s
t
s
1
3
s
(-8,3)
1 (2, 4)
(-2, 3)
(6, 4)
t
Figure 4. The Residual Network
Corresponding to Figure 2
9
A Cycle in a Residual Network

(8, 2)
actual meaning of sending
flow in cycle s-t-1-s (Figure 4)


s
a different way to send flow
from s to t
s
1
(-6, 3)
(-8,3)
(-2, 3)
(6, 4)
t
Figure 4. The Residual Network
Corresponding to Figure 2
flow along t-1-s  reduction of
flow in s-1-t
(8, 5)
1 (2, 4)
(2, 7)
t
(6, 1)
Figure 5. The New Residual
Network After Adding a Flow of
3 units in cycle s-t-1-s
0
3
s
1
3
0
t 3
Figure 6. Flows on arcs
10
Potentials of Nodes and the
Corresponding Reduced Costs of Arcs
 first
the idea
 call
any arbitrary set of numbers {i}, one for a
each node, a set of potentials of nodes
the reduced cost cij with respect to this set of
potentials {i} by cij  cij  i   j
 define
 interesting
properties for this set of reduced costs
11
Potentials of Nodes and the
Corresponding Reduced Costs of Arcs
 C(P)
be the total cost of path P
 C(P)
be the total reduced cost of path P
 i
= potential of node i
P
= a path from node s to node t
 then
C(P) = C(P)  s + t
12
Potentials of Nodes and the
Corresponding Reduced Costs of Arcs

C(P) be the total cost of path P

C(P) be the total reduced cost of path P

i = potential of node i

P = a path from node s to node t, then

C(P) = C(P)  s + t

a shortest path from s to t for C() is also a shortest path from s to t for C()
2 = -5
C(P)
1 = 3
2
4 = 6
7
5
8
2
3
1
C(P)
4
3
3
3 = 2
3
4
6
5
5 = -3
C (1  3  5  6)  12
18
4
4
0
6 = 5
6
2
4
10
1
2
3
-2
13
6
14
5
C  (1  3  5  6)  14
13
Potentials of Nodes and the
Corresponding Reduced Costs of Arcs

C(P) be the total cost of path P

C(P) be the total reduced cost of path P

i = potential of node i

P = a path from node s to node t, then


j = -d(j)
if j = -d(j), then cij  0 for all (i, j)  A
arcs with cij  0 forming a tree
2 = -8
2
1 = 0
2
1 = 3
4 = 6
7
5
8
2
3
1
3
3
3 = 2
3
4
6 = 5
4
3
8
0
4
4 = -10
0
1
2 = -5
5
3
3 = -3
4
0
0
5
5 = -6
6 = -12
6
0
6
6
5
5 = -3
14
Spanning Tree and BFS
 in
a minimal cost flow network problem, a
BFS  a spanning tree of the network

# of constraints = # of nodes
#
of basic variables = # of nodes - 1
15
The optimality Conditions
for Networks
16
The Optimality Conditions for Networks



Theorem 1. (Theorem 9.1, Negative Cycle Optimality Conditions) A feasible
solution x* is optimal iff there is no negative cost (direct) cycle
in the corresponding residual network G(x*).
Theorem 2. (Theorem 9.3, Reduced Cost Optimality Conditions) A feasible
solution x* is optimal iff there exists dual variable  such that
cij  0 for every arc (i, j) in the residual network G(x*).
Theorem 3. (Theorem 9.4, Complementary Slackness Optimality Conditions) A
feasible solution x* is optimal iff there exists dual variables 
such that



if cij  0, then xij* = 0;
if 0 < xij* < uij, then cij  0;
if cij  0, then xij* = uij.
17
Ideas for Theorem 1
a
cycle in a residual network: a different
way to send flow across a network
of a negative cycle  existence of
another flow pattern with lower cost
 existing
negative cycle  no other flow pattern
with lower cost
 no
18
Ideas for Theorem 3

Theorem 3. (Theorem 9.4, Complementary Slackness
Optimality Conditions) A feasible solution x* is optimal iff
there exists dual variables  such that
if cij  0, then xij*  0;
if 0 < xij*  uij , then cij  0;
if cij  0, then xij*  uij .

optimality conditions of simplex method for bounded variables
19
Ideas for Theorem 2

contradictory statements of Theorem 2 & Theorem 3?

Theorem 2: all reduced costs non-negative (for minimization)

Theorem 3: some reduced costs positive, some negative
 Theorem
2: on reduced costs for (variables
representing) arcs of a residual network
 Theorem
3: on reduced costs of all variables
20
Ideas for Theorem 2

Theorem 2. (Theorem 9.3, Reduced Cost Optimality Conditions) A feasible
solution x* is optimal iff there exists dual variable  such that
for cij  0 every arc (i, j) in the residual network G(x*).

Theorem 2  minimum

for any potential  and cycle: C(P) = C(P)

cij  0 for every arc in G(x)  no negative cycle in G  minimal
21
Ideas for Theorem 2

Theorem 2. (Theorem 9.3, Reduced Cost Optimality Conditions) A feasible solution x* is
optimal iff there exists dual variable  such that for cij  0 every arc (i, j) in the
residual network G(x*).

minimum  Theorem 2

conditions of Theorem 3 satisfied by a minimum solution

a forward arc (i, j) with xij*  0, cij  0 by Theorem 3



no reversed arc in G(x*)
a forward arc (i, j) with xij* = uij, cij  0 in the original network

no such forward arc in G(x*)

for the reversed arc in G(x*):
cji  c ji   j  i  (cij  i   j )  cij  0
a forward arc (i, j) with 0  xij*  uij , cij  0 in the original network

for the forward arc in G(x*):

for the reversed arc in G(x*):
cij  0
cij  0
22
Equivalence Between
Network Simplex
and Negative Cost Cycle
23
Equivalence Between Network Simplex Method and
Existence of a Negative Cost Cycle
(cij, uij)
2
(5, 7)
4
(3, 5)
(3, 8)
9
(2, 2)
(2, 3)
1
(2, 3)
3

6
(5, 4)
(4, 3)
-9
(4, 6)
5
at a certain point, an extended basic feasible solution is
shown below, where the dotted lines show arcs at upper
bounds.
Flow
2
5
4
5
7
9
2
0
1
2
3
2
0
6
-9
4
5
24
An Iteration of the Network Simplex
Flow

to find the entering variable
5
2
0
1
x46 entering

2
2 = 1 – c12 = -3
2
1 = 0
2
3
reduction of flow  from upper bound
dual
variables
5
3
3 =-2
6
4
5
4

c46
 3  8  10  1
2
0
4 =-8
3
1
4
7
9

5
2
4
6
4
6 =-10
How about
(2, 3), (2, 5),
(5, 4)?
5
5 =-6
beneficial to reduce flow in (4, 6)
25
-9
An Iteration of the Network Simplex
(cij, uij)

to find the leaving variable


9
reduction of flow  from x46
2
(5, 7)
4
(3, 5)
(3, 8)
(2, 2)
(2, 3)
1
(2, 3)
3
leaving variable, x13 or x35, for  = 1
Change of Flow
2
(4, 3)
0  5  7
5
4
0  2+  3
Current Flow
Pattern
2
5
0  4+  6
0  2+  3
3
6
5
5
2
0
1
0
4
7
9
0
(4,
6)
0  5  5
0  7  8
1
6
(5, 4)
2
3
2
0
6
-9
4
5
26
-9
An Iteration of the Network Simplex

(cij, uij)
=1
9

2
4
(3, 5)
(3, 8)
(2, 2)
(2, 3)
1
arbitrarily making x35 leaving
(5, 7)
(2, 3)
3
Change of Flow
2
(4, 6)
(4, 3)
0  5  7
5
4
0  5  5
0  7  8
1
0  2+  3
New Flow
Pattern
2
4
6
0  4+  6
0  2+  3
5
4
2
0
1
0
4
6
9
0
3
6
(5, 4)
3
3
3
0
6
-9
5
5
27
-9
An Iteration of
the Negative Cycle Algorithm

negative cycle 1-3-5-6-4-2-1

cost = -1

maximum allowable flow = 1 unit
Current Flow
Pattern
2
9
5
4
(5, 7)
4
(3, 5)
(3, 8)
(2, 2)
(2, 3)
1
(2, 3)
6
(5, 4)
3
(4, 3)
(4, 6)
5
(cij, xij)
5
2
0
1
2
Residual
Network
7
9
(cij, uij)
2
3
2
0
6
-9
4
5
28
-9
An Iteration of
the Negative Cycle Algorithm

negative cycle 1-3-5-6-4-2-1

cost = -1

maximum allowable flow = 1 unit
(cij, uij)
9
(cij, xij)
2
(5, 7)
4
(3, 5)
(3, 8)
(2, 2)
(2, 3)
1
(2, 3)
6
(5, 4)
3
(4, 3)
(4, 6)
5
(cij, xij)
29
-9
Same Result from Network Simplex Method
and Negative Cost Cycle
(cij, uij)
(5, 7)
2
4
(3, 5)
(3, 8)
1
9
(2, 2)
(2, 3)
(2, 3)
(4, 3)
3
(4, 6)
5
(cij, xij)
New Flow
Pattern
2
4
9
residual network
4
4
6
2
0
1
-9
6
(5, 4)
3
3
3
0
6
-9
5
5
30
Transportation Simplex Method
31
Transportation Simplex Method

balanced transportation problem

2 sources, 3 destinations

5 constraints, with one degree of redundancy

4 basic variables in a BFS
32
Transportation Simplex Method
 four
basic variables in a BFS
33
Transportation Simplex Method
reduced cost (i, j) = cij – ui – vj
34
Transportation Simplex Method
35
Transportation Problem by
Eliminating Negative Cycles
36
Transportation Problem by the
Negative Cycle Approach
37
Transportation Problem by the
Negative Cycle Approach
38
Transportation Problem by the
Negative Cycle Approach
39
Transportation Problem by the
Negative Cycle Approach
 no
more negative cycle
 optimal
flow: x13 = 100, x14 = 500, x15 = 200,
x23 = 300, x24 = 0, x25= 0,
 minimum
cost = 7600
40
To Determine
an Initial Feasible Solution
41
To Find an Initial Feasible Solution
 to
solve a maximal flow problem
42
To Find an Initial Feasible Solution

to solve a minimum cost flow problem

with x1t = 800, x2t = 300, xts = 1100, xs3 = 400, xs4 = 500, xs5
= 200 as the initial solution of the minimal cost flow
problem
43