Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Minimum Cost Flow: Basic Algorithms
Assumptions
Assumption 9.1 : All data are integral.
Assumption 9.2 : The network is directed.
Assumption 9.3 : The minimum cost flow problem has a feasible solution and so
Assumption 9.4 : We assume that the network contains an incapacitated directed path between every pair of nodes.
Assumption 9.5 : All arc cost are nonnegative.
0)( Ni
ib
Residual Networks
Network Original
j i (xij, cij,uij)
j i
Network Residual
(cij,uij- xij)
(-cij,xij)
Optimality Conditions
• Negative Cycle Optimality Condition
• Reduced Cost Optimality Condition
• Complementary Slackness Optimality Condition
Negative Cycle Optimality Condition
Theorem 9.1 (Negative Cycle Optimality Condition) A feasible
solution x* is an optimal solution of the minimum cost flow
problem iff x* , G(x*) contains no negative cycle.
Cycle Canceling Algorithm
. update and along flow of units Augment 2.3
} in arcan is j)(i, :{rmin 2.2
),(in cycle negative aidentify 1.2
do cycle negative a contains )( while2
network in the flow feasible aestablish 1
ij
G(x)W
W
xGW
xG
x
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5) (-3,4)
(2,2)
(5,3) 3
4
j i (cij,uij)
-5
-2
(6,4)
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5) (-3,4)
(2,2)
(5,3)
j i (cij,uij)
(0,2)
s t (6,4)
(0,5)
(0,3)
(0,4)
Establishing a feasible flow
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5) (-3,4)
(2,2)
(5,3)
j i (cij,uij)
(0,2)
s t (6,4)
(0,5)
(0,3)
(0,4)
3
3 5
4
4
2
2
Establishing a feasible flow
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5) (-3,4)
(2,2)
(5,3)
4
j i (cij,uij)
(6,4)
3 3
4
2
-5
-2
Establishing a feasible flow
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5) (-3,4)
(2,2)
(-5,3)
j i (cij,uij)
(6,4)
4
2
Constructing the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(4,4)
(2,5) (-3,4)
(2,2)
(-5,3)
j i (cij,uij)
(6,4) 2
Constructing the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(4,4)
(2,5) (-3,4)
(2,2)
(-5,3)
j i (cij,uij)
(6,2) (-6,2)
Establishing a negative cycle in the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(4,4)
(2,5) (-3,4)
(2,2)
(-5,3)
j i (cij,uij)
(6,2) (-6,2)
Establishing a negative cycle in the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(4,4)
(2,5) (-3,4)
(2,2)
(-5,3)
j i (cij,uij)
(6,2) (-6,2)
Augmenting along the negative cycle in the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(4,4)
(2,5) (-3,4)
(-2,2)
(-5,3)
j i (cij,uij)
(6,2) (-6,2)
Updating the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(4,4)
(2,5) (-3,4)
(-2,2)
(-5,3)
4
j i (cij,uij)
(6,4)
3 -5
-2
Updating the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,4)
(4,4)
(2,5) (-3,4)
(-2,2)
(-5,3)
4
j i (cij,uij)
(6,4)
3 -5
-2
Updating the residual Network
(0,2)
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,4)
(4,4)
(2,5) (-3,4)
(-2,2)
(-5,3)
4
j i (cij,uij)
(6,4)
3 -5
-2
(0,2)
Establishing a negative cycle in the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,2)
(0,1)
(0,4)
(4,4)
(2,5) (-3,4)
(-2,2)
(-5,3)
j i (cij,uij)
(6,4)
(0,2)
Augmenting flow along the negative cycle in the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
j i (cij,uij)
(6,4)
(0,2) (2,1)
(3,1)
Updating the residual Network
Cycle Canceling Algorithm
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
j i (cij,uij)
(6,4)
(0,2) (2,1)
(3,1)
There is no negative cycle in the residual network
Establishing an Optimal flow in the original network
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
(6,4)
(0,2) (2,1)
(3,1)
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5)
(2,2)
(5,3) 3
4
-5
-2
(6,4) (-3,4)
Establishing an Optimal flow in the original network
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
(6,4)
(0,2) (2,1)
(3,1)
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5)
(2,2)
(5,3) 3
4
-5
-2
(6,4) (-3,4)
1
Establishing an Optimal flow in the original network
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
(6,4)
(0,2) (2,1)
(3,1)
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5)
(2,2)
(5,3) 3
4
-5
-2
(6,4) (-3,4)
1 1
Establishing an Optimal flow in the original network
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
(6,4)
(0,2) (2,1)
(3,1)
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5)
(2,2)
(5,3) 3
4
-5
-2
(6,4) (-3,4)
1 1
1
Establishing an Optimal flow in the original network
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
(6,4)
(0,2) (2,1)
(3,1)
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5)
(2,2)
(5,3) 3
4
-5
-2
(6,4) (-3,4)
1 1
1
3
Establishing an Optimal flow in the original network
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
(6,4)
(0,2) (2,1)
(3,1)
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5)
(2,2)
(5,3) 3
4
-5
-2
(6,4) (-3,4)
1 1
1
3
4
Establishing an Optimal flow in the original network
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
(6,4)
(0,2) (2,1)
(3,1)
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5)
(2,2)
(5,3) 3
4
-5
-2
(6,4) (-3,4)
1 1
1
3
4
2
Establishing an Optimal flow in the original network
2
3 4
5 6
1
(-2,1)
(0,1)
(0,4)
(4,4)
(2,5) (-3,3)
(-2,2)
(-5,3)
(6,4)
(0,2) (2,1)
(3,1)
2
3 4
5 6
1
(-2,2)
(0,1)
(0,6)
(-4,4)
(2,5)
(2,2)
(5,3) 3
4
-5
-2
(6,4) (-3,4)
1 1
1
3
4
2
2
Complexity of Cycle Canceling
Algorithm
. update and along flow of units Augment 2.3
} in arcan is j)(i, :{rmin 2.2
),(in cycle negative aidentify 1.2
do cycle negative a contains )( while2
network in the flow feasible aestablish 1
ij
G(x)W
W
xGW
xG
x
),,( UnmM
)(mnO
)(nO
)(nO
)2( mCUO
)( 2nCUmO
Result of Cycle Canceling Algorithm
flow.cost minimuminteger an has
problem flowcost mimimum theinteger, are emandssupplies/d
and capacities arc all If :Property)rality 9.10(Integ Theorem
Reduced Cost
• Let π be a potential function then the reduced cost of
arc (i,j) is defined as flowing:
• Property 9.2 : For any directed path p from node k to
node l , and For any
directed cycle w , .
)()( jicc ijij
)()()()( lkpCpC
)()( wCwC
Reduced Cost Optimality Conditions
• Theorem 9.3 (Reduced Cost Optimality Conditions): A
feasible solution x* is an optimal solution of the minimum cost
flow problem iff for some set of node potentials π satisfy the
following reduced cost optimality conditions:
0c )(),( ij
* xGji
• We say a set of node potentials π is optimal node potential if π satisfies the reduced cost optimality conditions
Complementary Slackness Optimality Conditions
• Theorem 9.4 (Complementary Slackness Optimality Conditions):
A feasible solution x* is an optimal solution of the minimum cost
flow problem iff for some set of node potentials π , the reduced
costs and flow values satisfy the following Complementary Slackness Optimality Conditions :
ijij
ij
ij
ux
x
x
*
ij
ij ij ,
*
*
ij
then ,0c If
0cthen u0 If
0 then ,0c If
The relationship of optimal node potential and optimal Flow
• Given an optimal flow how might we obtain
optimal node potential?
• Given optimal node potentials, how might we
obtain an optimal flow?
Obtaining optimal node potential from
an optimal flow x*
1- Let d(i) be the length of the shortest path from
node 1 to node i.
2- π(i)=d(i)
So, for each arc (i,j) in G(x*),
0)()()()( jdidcjicc ijijij
Obtaining an optimal flow from
optimal node potential π
To obtain an optimal flow it is sufficient to find a
feasible flow x* such that :
For each are (i,j)
ijij
ij
ux
x
*
ij
*
ij
then ,0c If
0 then ,0c If
Obtaining an optimal flow from
optimal node potential π
1- obtain Network G’ from G as following:
For each arc (i,j)
2- Using application 6.1, find a feasible solution x in G’.
3- For each are (i,j)
A}i)|(j ,0{c
ji
A}j)|(i,0{c
ij
ij
jiij
uub(i)(i)b' N,i
j)(i, arc moveRe ,0c If
ijij
ijij
ij
xx
ux
x
*
*
ij
*
ij
Otherwise
then ,0c If
0 then ,0c If
Pseudoflow
A pseudoflow is a function x:A→R satisfying the
capacity and nonnegativity constraints; it need not
satisfy the mass balance constraints.
2
3 4
5 6
1
(2,2)
(0,1)
(0,6)
(6,6)
(1,5) (0,4)
(1,2)
(3,3) 3
4
-5
-2
(2,4)
j i (xij,uij)
Pseudoflow
The imbalance of a node is defined as follows:
2
3 4
5 6
1
(2,2)
(0,1)
(0,6)
(6,6)
(1,5) (0,4)
(1,2)
(3,3) 3
4
-5
-2
(2,4)
j i (xij,uij)
}),(:{}),(:{
)()(Ajij
ij
Aijj
ji xxibie
0
-4
1 0
1
2
Pseudoflow
We say node i is an excess node if e(i)>0.
We say node i is a deficit node if e(i)<0.
We say node i is a balanced node if e(i)=0.
E: the set of all excess nodes
D: the set of all deficit nodes
DiEi
ieie )()(
NiNi
ibie 0)()(
Pseudoflow
Lemma 9.11. Suppose that a pseudoflow x satisfies the
reduced cost optimality conditions with respect to some node
potentials π. Let the vector d represent the shortest path
distances from some node s to all other nodes in the residual
network G(x) with as the length of an arc (i,j). Then the
following properties are valid:
(a) The pseudoflow x also satisfies the reduced cost optimality
conditions with respect to node potentials π’=π-d.
(b) The reduced costs are zero for all arcs (i,j) in a shortest
path from node s to every other node.
ijc
'ijc
Pseudoflow
Lemma 9.12. Suppose that a pseudoflow x satisfies the
reduced cost optimality conditions. Obtain x’ from x by
sending flow along a shortest path from node s to some other
node k: then x’ also satisfies the reduced cost optimality
conditions.
Successive Shortest path Algorithm
costs reduced theand EG(x), x,update 4.6
} }in arcan is j)(i, :min{r),{e(k),-e(lmin 4.5
d- 4.4
l node k to node frompath shortest a denote pLet 4.3
c costs reduced therespect to
with G(x)in nodesother all k to node
from d(j) distancespath shortest determine4.2
Dl node a and Ek node aselect 1.4
do E while4
}0)(:{},0)(:{E sets theintialize3
allfor 2
0,0 1
ij
ij
p
ieiDiei
Nib(i)e(i)
x
Successive Shortest path Algorithm
j i ),( ijij uc
2
3 4
5 6
1
(2,2)
(0,1)
(0,6)
(4,4)
(2,5) (3,4)
(2,2)
(5,3) 3
4
-5
-2
(6,4)
b(i)
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(0,1)
(0,6)
(4,4)
(2,5) (3,4)
(2,2)
(5,3) 3 0
4 0
-5 0
-2 0
(6,4)
e(i) π(i)
E={2,5} D={1,6}
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(0,1)
(0,6)
(4,4)
(2,5) (3,4)
(2,2)
(5,3) 3 0
4 0
-5 0
-2 0
(6,4)
e(i) π(i) E={2,5}
D={1,6} k=2, l=1
d(i) i
5 1
0 2
7 3
5 4
3 5
7 6
Finding shortest paths from l to every other node
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(0,1)
(0,6)
(4,4)
(2,5) (3,4)
(2,2)
(-5,3) 3 0
4 -3
-5 -5
-2 -7
(6,4)
e(i) π(i) E={2,5}
D={1,6} k=2, l=1
d(i) i
5 1
0 2
7 3
5 4
3 5
7 6
Updating π
0 -5
0 -7
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(5,1)
(0,6)
(0,4)
(0,5) (0,4)
(4,2)
(0,3) 0 0
4 -3
-2 -5
-2 -7
(8,4)
e(i) π(i) E={5}
D={1,6} k=2, l=1
d(i) i
5 1
0 2
7 3
5 4
3 5
7 6
Updating x,G(x), E,D
0 -5
0 -7
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(5,1)
(0,6)
(0,4)
(0,5) (0,4)
(4,2)
(0,3) 0 0
4 -3
-2 -5
-2 -7
(8,4)
e(i) π(i) E={5}
D={1,6} k=5, l=1
d(i) i
6 1
6 2
2 3
2 4
0 5
0 6
0 -5
0 -7
Finding shortest paths from l to every other node
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(5,1)
(0,6)
(0,4)
(0,5) (0,4)
(4,2)
(0,3) 0 -6
4 -3
-2 -11
-2 -7
(8,4)
e(i) π(i) E={5}
D={1,6} k=5, l=1
d(i) i
6 1
6 2
2 3
2 4
0 5
0 6
0 -7
0 -9
Updating π
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(1,1)
(0,6)
(0,4)
(0,3) (7,4)
(0,2)
(0,3) 0 -6
2 -3
0 -11
-2 -7
(6,4)
e(i) π(i) E={5}
D={6} k=5, l=1
d(i) i
6 1
6 2
2 3
2 4
0 5
0 6
0 -7
0 -9
Updating x,G(x), E,D
(0,2)
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(1,1)
(0,6)
(0,4)
(0,3) (7,4)
(0,2)
(0,3) 0 -6
2 -3
0 -11
-2 -9
(6,4)
e(i) π(i) E={5}
D={6} k=5, l=6
d(i) i
6 1
1 2
0 3
0 4
0 5
0 6
0 -7
0 -9
(0,2)
Finding shortest paths from l to every other node
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(1,1)
(0,6)
(0,4)
(0,3) (7,4)
(0,2)
(0,3) 0 -7
2 -3
0 -17
-2 -9
(6,4)
e(i) π(i) E={5}
D={6} k=5, l=6
d(i) i
6 1
1 2
0 3
0 4
0 5
0 6
0 -7
0 -9
(0,2)
Updating π
Successive Shortest path Algorithm
j i ),( ijij rc
2
3 4
5 6
1
(2,2)
(0,1)
(0,6)
(0,2)
(0,3) (8,4)
(6,2)
(5,3) 0 -7
0 -3
0 -17
0 -9
(0,4)
e(i) π(i) E={}
D={} k=5, l=6
d(i) i
6 1
1 2
0 3
0 4
0 5
0 6
0 -7
0 -9
(0,2)
Updating x,G(x), E,D
(0,2)
Successive Shortest path Algorithm
j i ),( ijij uc
2
3 4
5 6
1
(2,2)
(0,1)
(0,6)
(4,4)
(2,5) (3,4)
(2,2)
(5,3) 3
4
-5
-2
(6,4)
b(i)
3
2
2
2
2
Successive Shortest path Algorithm
costs reduced theand EG(x), x,update 4.6
} }in arcan is j)(i, :{r),{e(k),-e(lmin 4.5
d- 4.4
l node k to node frompath shortest a denote pLet 4.3
c costs reduced therespect to
with G(x)in nodesother all k to node
from d(j) distancespath shortest determine4.2
Dl node a and Ek node aselect 1.4
do E while4
}0)(:{},0)(:{E sets theintialize3
allfor 2
0,0 1
ij
ij
p
ieiDiei
Nib(i)e(i)
x
)),,(( nCnmnUSO