Post on 06-Feb-2018
F.-Javier Heredia
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Network Flows UPCOPENCOURSEWARE number 34414
Topic 6: Minimum Cost Network Flow
Problems
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 2
6.- Minimum Cost Network Flow Problems (Chap. 9,10 & 11 Ahuja,Magnanti,Orlin)
• Pseudo-polynomial algorithms (AMO, Chap. 9) • Polynomial algorithms (AMO, Chap. 10) • Simplex algorithm (AMO, Chap. 11)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 3
MCNF: Basic algorithms (Chap. 9 AMO)
• Definitions and assumptions. • Applications. • Optimality Conditions:
– Negative Cycle Optimality Conditions. – Reduced Cost Optimality Conditions. – Complementary Slackness Optimality Conditions.
• Minimum Cost Flow Duality. • Algorithms: (assignments)
– Cycle-canceling and negative cycle O.C. – Successive shortest-path and Reduced cost O.C. – Out-of-kilter algorithm and Complementary Slackness O.C.
• The dual-primal network flow algorithm (assignment). • Relaxation methods. • Summary.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 4
Minimum Cost Network Flow Problem (MCNFP)
• Given the network G=(N,A) with costs c, capacities u and supplies/demands b, the Minimum Cost Network Flow Problem (MCNFP) is defined as:
{ } { }:( , ) :( , )
min
( )
0 ( , )
(1a)
s.a.:(1b)
(1c)
ij ij(i, j) A
ij jij i j A j j i A
ij ij
z c x
x x b i i N
x u i j A
∈
∈ ∈
= − = ∀ ∈
≤ ≤ ∀ ∈
∑
∑ ∑
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 5
MCNFP: Assumptions
1. All data (cost, supply, demand and capacity) are integral (needed for some proofs, and some running time analysis).
2. The network is directed.
3. The supplies/demands at the nodes satisfy the condition
Σi∈N b(i) = 0
and the minimum cost flow problem has a feasible solution.
4. The network G contains an uncapacitated directed path between every pair of nodes • If necessary artificial uncapacitated arcs (1,j) and (j,1) ∀j∈N will be added
with infinity costs.
5. All arc costs cij are nonnegative.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 6
Artificial Solutions
• Add an arc to d from each supply node, each with a large cost M, and a large capacity.
1
2
3
4
5
6 1
3 -4
3
-5 2
• To create a feasible solution, add a dummy node d.
• Add an arc from d to each demand node, each with a large cost M, and large capacity. d
• In an optimal solution, arcs with large cost will have a flow of 0.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 7
Residual network
• Residual network G(x) : nodes N and arcs (i,j) replaced with arcs (i,j) and (j,i) with positive residual capacity rij
• Residual capacity rij :
j
cij , uij
i xij
cij , rij = uij - xij
-cij , rij = xji
j xji
i xij
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 8
Augmenting Cycle Theorem • Def: Augmenting Cycle W in G w.r.t. x : any cycle W (not
necessarily oriented) s.t. “x+f(W)” feasible. – Prop.: W augmenting cycle in G w.r.t. x ⇔ W directed cycle in G(x)
i
j
rij
i
j
( cij , uij )
bj
bi
xij
5
1
2
3
4 (2,3
)
5 -6
-4
4
1 3 3
3 3
2
3 4
2
x0 x
1 1
2
3
4 3
G(x0)
Interpretation:
c(x0) + c( f(W) ) = 35 – 6 = c(x)
• Def: Augmenting Cycle W in G w.r.t. x : any cycle W (not necessarily oriented) s.t. “x+f(W)” feasible. – Prop.: W augmenting cycle in G w.r.t. x ⇔ W directed cycle in G(x)
• Th. (Augmenting Cycle Theorem.): Let x and x0 be any two feasible solutions of a network flow problem. Then x equals x0 plus the flow of at most m directed cycles in G(x0). Furthermore, the cost of x equals the cost of x0 plus the cost of flow on these augmenting cycles.
Proof: AMO, page. 83
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 9
Negative cycle optimality conditions • Ta (Negative Cycle Optimality Cond.): A feasible solution x* is
an optimal solution of the minimum cost flow problem if and only if satisfies the negative cycle optimality conditions: namely, the residual network G(x*) contains no negative cost (directed) cycle.
Proof:
⇒ : a pos. flow along any neg.cycle of G(x) always improve the o.f.: if x*
optimal, G(x*) cannot contain a neg. cycle.
⇐ : Assume x* feasible and G(x*) without neg. cycle. Then, by the
Augmenting Cycle Th., for any feasible flow x≠x* holds
c(x) =c( x* ) + c( f(W) ) ≥ c( x* )
and thus, x* is optimal
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 10
Reduced cost optimality conditions (1/2)
• Potentials nodes: ( )i i Nπ ∀ ∈
• Properties: a) For any directed path P from node k to node l,
b) For any directed cycle W,
( , ) ( , )( ) ( )ij iji j P i j P
c c k lπ π π∈ ∈
= − +∑ ∑
( , ) ( , )ij iji j W i j Wc cπ
∈ ∈=∑ ∑
• Consequences of properties (a) and (b): i. (a) ⇒ P is the shortest path w.r.t. c ⇔ P is the shortest path w.r.t. cπ
ii. (b) ⇒ W is a neg. cycle w.r.t. c ⇔ W is a neg. cycle w.r.t. cπ
• Reduced costs:
– Red. cost in the red. Net. G(x):
( ) ( ) ( , )ij ijc c i j i j Aπ π π= − + ∀ ∈
( , ) ( )ji ijc c i j G xπ π= − ∀ ∈
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 11
Reduced cost optimality conditions (2/2)
• Th. (Reduced Cost Optimality Cond.): A feasible solution x* is an optimal solution of the minimum cost flow problem if and only if some set of node potencials π satisfy the following reduced cost optimality conditions:
0 ( , ) ( *) (1)ijc i j G xπ ≥ ∀ ∈Proof:
– We will see the equivalence with the Neg. Cycle. Opt. Cond (NCOC).
– RCOC ⇒ NCOC:
x* optimal w.r.t. The RCOC ⇒
Prop. (b) ⇒ ⇒ G(x*) contains no negative cycle. ( , )
0 ( *)directed cycle iji j Wc W G xπ
∈≥ ∀ ∈∑
( , ) ( , )0ij iji j W i j W
c cπ∈ ∈
= ≥∑ ∑– RCOC ⇐ NCOC:
x* NCOC ⇒ G(x*) contains no negative cycles. Let d(·) be the shortest path labels of the label correcting algorithm from node 1 over
G(x*) and let π = -d. Then, by the convergence theorem of the label-correcting alg. (1) holds true.
Remark: relation between the RCOC over G(x*) and the simplex optimality
conditions for saturated arcs xij = uij
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 12
Complementary Slackness Opt. Cond.
• Th. (Complementary Slackness Optimality Conditions): A feasible solution x* is an optimal solution of the minimum cost flow
problems if and only if for some set of node potentials π, the reduced costs and flow values satisfy the following complementary
slackness optimality conditions for every arc ( i , j ) ∈ A:
Proof: AMO, pag. 310 (quite technical!!)
• Relation with the optimality condition of the simplex algorithm
*
*
0 00 0
0
ij ij
ij ij ij
ij ij ij
c xx u c
c x u
π
π
π
> =< < =< =
If , then If , then If , then
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 13
CSOC & Kilter Diagram
Kilter Diagram for arc (i, j)
Complementary Slackness optimality conditions (CSOC)
Francesc López Ramos y Fernándo Saráchaga Gutierrez
*
*
0 00 0
0
ij ij
ij ij ij
ij ij ij
c xx u c
c x u
π
π
π
> =< < =< =
If , then If , then If , then
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 14
In-Kilter / Out-kilter
kilterofoutjikilterinjicxji
CA
EDBijij
−−→−→
≡
−
−−
),(),(
),(),( π
In-Kilter and Out-kilter arc Diagram
Complementary Slackness optimality conditions (CSOC)
Francesc López Ramos y Fernándo Saráchaga Gutierrez
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 15
Kilter Number (k(i, j))
• Definition, – The k(i, j) is a magnitude of the change in x(i, j) required to
make the arc (i, j) an in-kilter arc while keeping C(i, j, π) fixed.
• Consequently, – If (i, j) is in-kilter then k(i, j) = 0. – We can measure how far we are from the optimal solution
as follows:
– The smaller the value of K, the closer we are from the
optimal solution.
∑∈
=Aji
jikK),(
),(
Francesc López Ramos y Fernándo Saráchaga Gutierrez
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 16
Computation of k(i, j)’s
)(),(000
xGjicifrcif
kijij
ijij ∈∀
<≥
= π
π
k(i, j) has a close relation with CSOC as follows:
ijijijij
ijijijijijij
ijijijij
ijijij
xkthenxcif
uxkthenuxcifxukthencif
xkthencif
−=<=
−=>=−=<
=>
0&0)2.3
&0)1.3)30)20)1
π
π
π
π
In order to use k(i, j) in the OFKA and thus, in the G(x), it is redefined as follows:
Francesc López Ramos y Fernándo Saráchaga Gutierrez
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 17
Cases
uij = 4
cij
xij
1
2
3.1 3.2
x(i, j) = 3 , c(i, j, π) > 0 → k(i , j) = |3| = 3
x(i, j) = 2 , c(i, j, π) < 0 → k(i , j) = |4 - 2| = 2
x(i, j) = 6 , c(i, j, π) = 0 → k(i , j) = 6 - 4 = 2 x(i, j) = -2 , c(i, j, π) = 0 →
k(i , j) = -(-2) = 2
1
2
x(i, j) = -2 , c(i, j, π) < 0 → k(i , j) = |4 - (-2)| = 6
x(i, j) = -2 , c(i, j, π) > 0 → k(i , j) = |-2| = 2
Francesc López Ramos y Fernándo Saráchaga Gutierrez
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 18 18
Relation with G(x)
i j rij
cij(π) ≥ 0
(x factible)
i j rij = uij
cij(π) ≥ 0
i j rji = uji
cji(π) ≥ 0
xij = 0
0 < xij < uij
xij = uij
i j
rij = uij - xij
rji = xij
xij = 0, cij(π) ≥ 0
xij = uij, cij(π) = - cji(π) ≤ 0
G G(x) G
0 < xij < uij, cij(π)= - cji(π) ≥0 ⇒ cij(π) = 0
Francesc López Ramos y Fernándo Saráchaga Gutierrez
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 19
Out-of-kilter algorithm algorithm out-of-kilter; begin π: = 0; establish a feasible flow x in the network; define the residual network G(x) and compute the kilter numbers of arcs; while the network contains an out-of-kilter arc do begin select an out-of-kilter arc (p, q) in G(x); define the length of each arc (i, j) in G(x) as max {0, C(i, j, π)}; let d(·) denote the shortest path distances from node q to all other nodes in G(x) – {(q, p)} and let P denote a shortest path from node q to node p; update π´(i) : = π(i) – d(i) for all i є N; if C(p, q, π´) < 0 then begin W : = P U {(p, q)}; delta : = min { r(i, j) : (i, j) є W }; augment delta units of flow along W; update x, G(x) and the reduced costs; end; end; end;
Francesc López Ramos y Fernándo Saráchaga Gutierrez
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 20
Minimum Cost Flow Duality
• Def. (Dual Minimum Cost Flow Problem) :
( , )
max ( , ) ( ) ( )
( ) ( ) ( , )0 ( , )
( )
(1a)
s.t.:(1b)(1c)
unrestricted (1d)
ij iji N i j A
ij ij
ij
w b i i u
i j c i j Ai j A
j j N
π α π α
π π αα
π
∈ ∈
= − − − ≤ ∀ ∈
≥ ∀ ∈ ∀ ∈
∑ ∑
– It is easy to verify that this is the dual of the standard form of the MCNFP (exercise).
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 21
Minimum Cost Flow Duality
• Th. (Weak Duality Theorem): Let z(x) denote the objective function of some feasible solution x of the minimum cost flow problem and let w(π,α) denote the objective function value of some feasible solution (π,α) of its dual. Then w(π,α) ≤ z(x).
• Th. (Strong Duality Theorem): Any minimum cost flow problem with optimal solution x* has a dual minimum cost flow problem with optimal solution π satisfying the property that z(x*)=w(π).
• Th. (Rel. Duality - Comp. Slack. O.C.): If x* is an optimal solution of the minimum cost flow problem, and π is an optimal solution of the dual minimum cost flow problem, the pair (x*, π) satisfies the complementary slackness optimality conditions.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 22
Relaxation Algorithm (1)
{ } { }( , ) :( , ) :( , )( ) min ( ) ( ) 0 ( , )ij ij ij ji ij ij
i j A i N j i j A j j i Aw c x i b i x x x u i j A
xπ π
∈ ∈ ∈ ∈
= + − + ≤ ≤ ∀ ∈
∑ ∑ ∑ ∑
• Def. Lagrangian relaxed problem LR(π):
• Alternative expressions of LR(π):
( , )( ) min ( ) ( ) 0 ( , ) (1)ij ij ij ij
i j A i Nw c x i e i x u i j A
xπ π
∈ ∈
= + ≤ ≤ ∀ ∈
∑ ∑
( , )( ) min ( ) ( ) 0 ( , ) (2)ij ij ij ij
i j A i Nw c x i b i x u i j A
xππ π
∈ ∈
= + ≤ ≤ ∀ ∈
∑ ∑
• Solution of problem LR(π): trivial, from formulation (2).
*
0 00
0, 0
if if
any if
ij
ij ij ij
ij ij
cx u c
x u c
π
π
π
>= < ∈ =
Property 1: If a pseudoflow x of the minimum cost flow problem satisfies the reduced cost optimality conditions for some π, then x is an optimal solution of LR(π)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 23
Relaxation Algorithm (2)
• Lemma: a) For any node potentials π, w(π) ≤ z* b) For some choice of node potentials π*, w(π*) = z* Proof: a) If x* opt. sol. of the MCNFP ⇒ ∀π, x* feasible for LR(π) and w(π) ≤ z*. b) Let π*, x* satisfy the RCOC ⇒ By Prop. 1 : x* is the opt. solution of
LR(π*) ⇒ w(π*) = z*.
• Rationale of the Relaxation algorithm: – Maintains a pair (π, x), x a pseudoflow, s.t. satisfy the RCOC
– It modifies π to π’ and x to x’ so that x’ is an optimal solution of LR(π’) and w(π’) > w(π).
– Keeping π unchanged, it modifies x to x’ so that x’ is also an optimal solution of LR(π) and the excess of at least one node decreases
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 24
Relaxation Algorithm (3) At some stage of the algorithm: • S: nodes of a tree T rooted at node s s.t.
– Every node s∈S : e(s) ≥0. – Every arc (i,j)∈T : cπ
ij =0
1
2
3
4
5
6
7
8
S S 8
3
0
5
-1
4
-2
0
0
i j e(i) e(j) (cπ
ij , rij )
(0,2 )
(0,3 )
(2,4 )
(3,2 )
s
( , ) ( , )0
( ) ( ) ; ( , )
ij
iji S i j S S
c
e S e i r S rπ
π∈ ∈
=
= =∑ ∑
• S=N-S ; (S,S) onward arcs of cut [S, S] in G(x) ; (S,S) backward arcs of cut [S, S] in G(x).
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 25
Relaxation Algorithm (4)
• Case 1: if e(S) > r(π,S) then increase w(π) – Modify x saturating all (i,j) ∈ (S,S) s.t. cπ
ij =0 (w(π) invariant, due to (2)) – The change in x reduces e(S) : e(S) ← e(S)- r(π,S) ≥ 0.
1
2
3
4
5
6
7
8
S S 8
3
5
-1
4
-2
0
0
i j e(i) e(j) (cπ
ij , rij )
(0,2 )
(0,3 )
(2,4 )
(3,2 )
s
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 26
Relaxation Algorithm (5)
• Case 1: if e(S) > r(π,S) then increase w(π) – Modify x saturating all (i,j) ∈ (S,S) s.t. cπ
ij =0 (w(π) invariant, due to (2)) – The change in x reduces e(S) : e(S) ← e(S)- r(π,S) ≥ 0. – At this point cπ
ij > 0 ∀(i,j)∈(S,S): α:=min{ cπij | (i,j) ∈ (S,S) } > 0 (*)
– Increase π(i) : π’(i) := π(i) + α ∀i∈S w(π) exp. (1) : w(π’) := w(π) + [e(S)-r(π,S)] α > w(π)
1
2
3
4
5
6
7
8
S S 8
1
5
1
7
-2
0
-3
i j e(i) e(j) (cπ
ij , rij )
(0,2 )
(0,3 )
(2,4 )
(3,2 )
s
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 27
Relaxation Algorithm (6)
• Case 1: if e(S) > r(π,S) then increase w(π) – Modify x saturating all (i,j) ∈ (S,S) s.t. cπ
ij =0 (w(π) invariant, due to (2)) – The change in x reduces e(S) : e(S) ← e(S)- r(π,S) ≥ 0. – At this point cπ
ij > 0 ∀(i,j)∈(S,S): α:=min{ cπij | (i,j) ∈ (S,S) } > 0 (*)
– Increase π(i) : π’(i) := π(i) + α ∀i∈S w(π) exp. (1) : w(π’) := w(π) + [e(S)-r(π,S)] α > w(π)
– The RCOC is conserved: cπij := cπ
ij - α ≥ 0 ∀(i,j) ∈(S,S) due to (*) (and the rest of cπ
ij cannot be < 0)
1
2
3
4
5
6
7
8
S S 8
1
5
1
7
-2
0
-3
i j e(i) e(j) (cπ
ij , rij )
(2,2 )
(2,3 )
(0,4 )
(1,2 )
s
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 28
Relaxation Algorithm (7)
• Case 2: if e(S) ≤ r(π,S): – r(π,S) ≥ e(S) > 0 ⇒ ∃(i,j)∈(S,S) s.t. cπ
ij = 0 – If e(j) ≥ 0 then: S:=S+{ j } – If e(j) < 0 then : augmenting flow δ trough P(s→j)
e(S) decreases. w(π) invariant (cπ
ij =0 ∀(i,j) ∈P(s →j)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 29
Relaxation algorithm: given a MCNFP in standard form. begin
x:= 0 and π:= 0; while the network contains a node s with e(s)>0 do begin S := {s}; if e(S) > r(π,S) then adjust-potencial else repeat select an arc (i,j)∈(S,S) in the residual network with cπ
ij =0; if e(j) ≥ 0 then set pred(j):= i and add node j to S; until e(j) < 0 or e(S) > r(π,S); if e(S) > r(π,S) then adjust-potential else adjust-flow; endif end;
end;
( , ) ( , )0
( ) ( ) ; ( , )
ij
iji S i j S S
c
e S e i r S rπ
π∈ ∈
=
= =∑ ∑where:
Relaxation algorithm (8)
procedure adjust-potential; begin for every arc (i,j)∈(S,S) with cπ
ij =0 do send rij units of flow on the arc (i,j);
compute α := min{cπij : (i,j)∈(S,S) and rij > 0};
for every node j∈S do π(j) := π(j) + α; end;
procedure adjust-flow; begin identify directed P(s→j) from pred(); δ:=min[ e(s) , -e(j) , min{rij : (i,j) ∈P}]; augment δ along P; update imbalances and residual capac.; end;
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 30
Relaxation algorithm - convergence
• Convergence: The relaxation algorithm terminates with an optimal flow x*. Proof: i. The rel. Alg. terminates with e(s)=0 ∀s∈N ⇒ x* is a feasible flow.
ii. The pair (π*,x*) satisfies the RCOC.
• Finite convergence: the relaxation algorithm terminates in a finite number of iterations (for problems with integral data).
• Worst case analysis: O(m2nCU2) (worst than cycle-cancelling, succ. shortest path and primal-dual)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 31
Relaxation algorithm – example
1
2
3 5
4
(2,25)
(4,10)
(5,2
5) (1,20) 25
i j (cij ,uij )
b(j) b(i)
0 0
-25
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 32
Relaxation algorithm – example (cont.)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 33
Summary of pseudopolynomial-time MCNF algorithms
Algorithm Worst-case complexity Cycle cancelling O( nm2CU )
Succ. shortest path O(n3U ) ← O( nU·S(n,m,nC)) Primal-dual O(mn3·min{U,C}) ← O( min{nU, nC}·{S(n,m,nC)+M(n,m,U)} ) Out-of-kilter O(mn2U ) ← O( mU·S(n,m,nC)) Relaxation O(m2nCU2)
S(n,m,nC): running time of the shortest path alg. with cij ≥ 0 (O(n2) for Dijkstra). M(n,m,U): running time of a max-flow alg. (O(mn2) for the SAPA)
The algorithms studied so far are pseudopolynomial-time algorithms, that is, its worst-case complexity is bounded by a polynomial of n, m, C and U.
Instead, polynomial-time algorithms have a worst-case complexity that is bounded by a polynomial of n, m, logC and logU.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 34
Polynomial MCNFP algorithms
• Capacity Scaling algorithm. • Cost Scaling Algorithm (assignment) • Double Scaling Algorithm (assignment)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 35
The Capacity Scaling Algorithm • This algorithm is an enhancement of the successive shortest path
algorithm.
• It ensures that in each augmentation, sufficiently large flow (at least Δ) is sent from an excess node to a deficit node.
• Δ-residual network G(x, Δ): subgraf of G(x) consisting on those arcs whose residual capacity is at least Δ.
• The algorithm selects a node k with excess at least Δ, selects a node l with deficit at least Δ, identifies a shortest path in G(x) from node k to node l with residual capacity at least Δ, and augments flow along this path.
• The algorithm terminates when there is no imbalanced node. • Source: J. Orlin “Network Optimization” http://ocw.mit.edu/courses/sloan-school-
of-management/15-082j-network-optimization-fall-2010/
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 36
The Capacity Scaling Algorithm (contd.) algorithm capacity scaling; begin x: = 0 and π : = 0; Δ: = 2 log U; while Δ ≥ 1do
begin {Δ-scaling phases} for every arc (i, j) in the residual network G(x) do;
if rij ≥ Δ and cijπ < 0 then
send rij units of flow along (i, j), update x and the imbalances e(i) and e(j); end for;
S(Δ) : = {i ∈ N : e(i) ≥ Δ}; T(Δ) : = {i ∈ N : e(i) ≤ -Δ}; while S(Δ) ≠ Ф and T(Δ) ≠ Ф (and a path P from k to l over G(x,Δ)⇐ Ass.4) do
Select a node k ∈ S(Δ) and a node l ∈ T(Δ); Determine a shortest path distance d(.) from node k to all other nodes in the
Δ-residual network G(x,Δ) with respect to the reduced costs cijπ;
Let P denote a shortest path from node k to node l in G(x, Δ); Update π := π – d and cij
π := cijπ + d(i) - d(j);
Augment Δ units of flow along the path P; Update x, S(Δ), T(Δ), and G(x, Δ);
end while; Δ : = Δ/2;
end {Δ-scaling phases}; end while; end;
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 37
The Original Costs and Node Potentials
1
2
3 5
4 4
1 2
2
5
6
7
0
0 0
0 0
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 38
The Original Capacities and Supplies/Demands
1
2
3 5
4 10
20 20
25
25
20
30
23
5 -2
-7 -19
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 39
Set ∆ = 16. This begins the ∆-scaling phase.
1
2
3 5
4 10
20 20
25
25
20
30
23
5 -2
-7 -19
We send flow from nodes with excess ≥ ∆ to nodes with deficit ≥ ∆.
We ignore arcs with capacity ≤ ∆.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 40
Select a supply node and find the shortest paths
1
2
3 5
4 4
1 2
2
5
6
7
7
0
6 8
8 shortest path distance
The shortest path tree is marked in bold and blue.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 41
Update the Node Potentials and the Reduced Costs
1
2
3 5
4 4
1 2
2
5
6
7
0
-7 -8
-8 -6
0
0
0
0 6
3
1
To update a node potential, substract the shortest path distance.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 42
Send Flow Along a Shortest Path in G(x, 16)
1
2
3 5
4
1
Send flow from node 1 to node 5.
20 20
25
25
20
30
23
5 -2
-7 -19
How much flow should be sent?
10
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 43
Update the Residual Network
1
2
3 5
4
1
19 units of flow were sent from node 1 to node 5.
20 20
6
25
1
30 23
5 -2
-7 0
10
-19
4
19
19
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 44
This ends the 16-scaling phase.
1
2
3 5
4
1
The ∆-scaling phase continues when e(i) ≥ ∆ for some i.
e(j) ≤ -∆ for some j.
There is a path from i to j.
20 20
6
25
1
30
5 -2
-7 0
10
4
19
19
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 45
This begins and ends the 8-scaling phase.
1
2
3 5
4
1
The ∆-scaling phase continues when e(i) ≥ ∆ for some i.
e(j) ≤ -∆ for some j.
There is a path from i to j.
20 20
6
25
1
30
5 -2
-7 0
10
4
19
19
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 46
This begins 4-scaling phase.
1
2
3 5
4
1 20 20
6
25
1
30
5 -2
-7 0
10
4
19
19
What would we do if there were arcs with capacity at least 4 and negative reduced cost?
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 47
Select a “large excess” node and find shortest paths.
1
2
3 5
4
1 1 0
-7 -8
-8 -6
0
0
0
6
3
0
0 The shortest path tree is marked in bold and blue. 0
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 48
Update the Node Potentials and the Reduced Costs
1
2
3 5
4
1 0 0
-7 -8
-8 -6
0
4
0
2
0
0
1
-11
-12 -10
-4
To update a node potential, subtract the shortest path distance.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 49
Send Flow Along a Shortest Path in G(x, 4).
1
2
3 5
4
1 20 20
6
25
1
30
5 -2
-7 0
10
4
19
19
Send flow from node 1 to node 7
How much flow should be sent?
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 50
Update the Residual Network
1
2
3 5
4
1 16 20
10
25
1
26
5 -2
-3 0
6
4
19
15
4 units of flow were sent from node 1 to node 3
0
-7
4
4
4
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 51
This ends the 4-scaling phase.
1
2
3 5
4
1 16 20
10
25
1
26
5 -2
-3 0
6
19
15
There is no node j with e(j) ≤ -4.
0
4
4
4
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 52
Begin the 2-scaling phase
1
2
3 5
4
1 16 20
10
25
1
26
5 -2
-3 0
6
19
15
There is no node j with e(j) ≤ -4.
0
4
4
4 What would we do if there were arcs with capacity at least 4 and negative reduced cost?
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 53
Send flow along a shortest path
1
2
3 5
4
1 16 20
10
25
1
26
5 -2
-3 0
6
19
15
0
4
4
4
Send flow from node 2 to node 4
How much flow should be sent?
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 54
Update the Residual Network
1
2
3 5
4
1 16 20
10
25
1
26
5 -2
-3 0
4
19
15
0
4
6
4
2 units of flow were sent from node 2 to node 4
3 0
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 55
Send Flow Along a Shortest Path
1
2
3 5
4
1 16 20
10
25
1
26
-3 0
4
19
15
0
4
6
4
Send flow from node 2 to node 3
3 0
How much flow should be sent?
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 56
Update the Residual Network
1
2
3 5
4
1 13 20
13
25
1
26
-3 0
1
19
12
0
7
9
4
3 units of flow were sent from node 2 to node 3
3 0
0
0
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 57
This ends the 2-scaling phase.
1
2
3 5
4
1 13 20
13
25
1
26
0
1
19
12
0
7
9
4
Are we optimal?
0
0
0
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 58
Begin the 1-scaling phase.
1
2
3 5
4
1 13 20
13
25
1
26
0
1
19
12
0
7
9
4
Saturate any arc whose capacity is at least 1 and with negative reduced cost.
0
0
0
reduced cost is negative
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 59
Update the Residual Network
1
2
3 5
4
1 13 20
13
25 26
0
1
20
12
-1
7
9
4
Send flow from node 3 to node 1.
0
1
0
Note: Node 1 is now a node with deficit
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 60
Update the Residual Network
1
2
3 5
4
1 14 20
12
25 27
0
2
20
13
0
6
8
3
1 unit of flow was sent from node 3 to node 1.
∆:= ∆/2 = ½ →END
0
0
0
Is this flow optimal?
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 61
The Final Optimal Flow
1
2
3 5
4 10,8
20,6 20
25,13
25
20,20
30,3
23
5 -2
-7 -19
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 62
The Final Optimal Node Potentials and the Reduced Costs
1
2
3 5
4
0 0
-7 -11
-12 -10
0
-4
0
1 2
0
Flow is at upper bound
Flow is at lower bound.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 63
The Capacity Scaling Algorithm (contd.) • Convergence: as in the successive shortest-path algorithm. • Running time:
– A Δ-scaling phase performs at most 2(n+m)=O(m) augmentations: In the Δ-scaling phase the sum of excesses is bounded by 2(n+m)Δ (see text). Each augmentation reduces the excess by at least Δ units.
– Each augmentation solves a shortest path problem, S(n,m,nC) – At most log U Δ-scaling phases. – In the overall: O(m log U S(n,m,nC))
• Theorem: the capacity scaling algorithm solves the minimum cost flow problems in O( m log U S(n,m,nC) ).
– Successive shortest-path alg.: O( n U S(n,m,nC) ) (pseudo-polynomial) .
n m U m*logU n*U n*U/m*logU
1000 2000 1,0E+01 6,64E+03 1,00E+04 1,51E+00
1000 2000 1,0E+02 1,33E+04 1,00E+05 7,53E+00
1000 2000 1,0E+03 1,99E+04 1,00E+06 5,02E+01
1000 2000 1,0E+04 2,66E+04 1,00E+07 3,76E+02
1000 2000 1,0E+05 3,32E+04 1,00E+08 3,01E+03
1000 2000 1,0E+06 3,99E+04 1,00E+09 2,51E+04
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 64
MCNF: Network Simplex Algorithm. (Cap. 11 AMO)
• Standard form. • Spanning Tree Structure. • Simplex specialization:
– Computing the basic feasible solution. – Reduced cost calculation. – Leaving variable selection. – Base change . – Simplex Algorithm for Network Flows. – Example. – Exercises.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 65
Standard form of the Minimum Cost Flow Problem
• Mathematic formulation:
– Assuming that the network is balanced: 01
=∑=
n
iib
• Matrix notation:
≥=
′
(1.2c)(1.2b):s.a.(1.2a)
0
min
xbx
xcN
{ } { }
∈∀≥
∈∀=−
=
∑∑
∑
∈∈
∈
(1.1c)
(1.1b):s.a.
(1.1a)
Ajix
Nibxx
xcz
ij
iAijj
jiAjij
ij
A(i,j)ijij
),(0
min
),(:),(:
Balance equations
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 66
Spanning tree and bases. • Ta : “Each spanning tree T of G define a base of the minimum cost
flow problem. Conversely, each base of the minimum cost flow problem define a spanning tree of G.”
01001000011010010011
54321
)4,2()5,3()1,3()2,1(
−−
−−
=B
1
3 2
5 4
Procedure: – Nodes are arranged in crossbar order : 3-5-2-4-1 – The arcs are arranged visiting the nodes according to the crossbar
order. Each node is associated with the only arc that relates it with its predecessor: (3,1), (3,5), (1,2), (2,4)
01011000110000100011
14253
)4,2()2,1()5,3()1,3(
+−−+−
−++
=B
• Ta: “The rows and columns of the B matrix linked to a spanning tree T it can be rearranged so that B is triangular”
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 67
Feasible basic solution calculation.
1
2 3
5 4 7 6
15
0 -20
5 5 10 -15
i
j
bi
bj
xij
• Procedure: 1. Select a leaf node. 2. Assign flow to its associated
arc. 3. Modify the predecessor
contribution. 4. Eliminate the node and the
arc treated.
1
2 3
5 4 7 6
15
0 -20
5 5 10 -15
5 10
5 5 10 15 xB
T = [10,5,5,5,10,15] (second crossbar order)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 68
Reduce cost computation (I)
• Reduced cost: rij = cij - πT Nij = cij - πi + πj , ∀(i,j)∈A
– Any constant k it can be summed to the Lagrange multipliers πi without change the value of rij :
rij = cij - πi + πj = cij – (πi+k) + (πj+k) – This implies that we can fix arbitrarily the value of the
Lagrange multiplier in a node: π1 = 0
– The rest of the Lagrange multipliers can be calculated using the reduced cost expression of the basic arcs:
rij = cij - πi + πj = 0 , ∀(i,j)∈T
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 69
Langrange multipliers computation (II)
i
j
πi
πj
cij
1
2
3 5
4 7 6
0
5
2
4 1
3
1
• Procedure: 1. Assign the value π1 = 0 to the
source node. 2. Visit the following node according
to the cross bar order. 3. Compute the Lagrange multiplier
based on: cij - πi + πj = 0
4. Go to step 2.
-5
-3
-7 -2 -1
-2
πT = [ -5, -3, -7, -2, -2, -1] (Cross bar order)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 70
Leaving variable selection • No bàsic arc (k,l) introduction to base with flow θ :
xB(θ ) = B-1b - B-1 Nklθ = xB - yklθ = xB + ∆xB(θ )
• The vector ykl is defined by the fundamental cycle associated to (k,l): – If (k,l) = (7,4) i θ =+1:
∆xB(+1 ) = - ykl = [0,-1,0,-1,+1,+1]T
• θ is increase until the flow of a basic arc is cancelled. – In the example, the arc (5,2) would
leave and (7,4) would enter to the base with a value of 2
i
j (xBij , –yij )
1
2
3 5
4 7 6
θ =+1
(0,+1)
(1,+1) (2,-1)
(3,-1)
(3,0)
(4,0)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 71
Base change • Pivotation between the outgoing arc (5,2) and the entering arc (7,4):
1
2
3 5
4 7 6
1
2
3
5
4
7
6
• The values of xB are updated, π and r from the new spanning tree
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 72
Simplex algorithm for network flows
Begin A initial feasible tree T is defined; While there are no basic arcs (i,j)∉ T with rij < 0 Do
The Lagrange multipliers π are defined and the flow x associated to T;
An entering arc (k,l) is selected with rkl < 0; The arc (k,l) is added to the tree and the outgoing arc (p,q); The tree T is updated;
End while End
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 73
Example
• Solve the problem of network flows associated to the following network. 1
2
3 5
4
6
4
5
2 5 -5 9
0 -2
0 -2
i j cij
bi bj
(Solution)
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 74
Exercise 1. Formulate a network flow feasible problem of minimum cost with 6
nodes and 9 arcs. 2. Find a initial spanning tree feasible. 3. Solve the problem from the spanning tree found in the last section
with the simplex algorithm for network flows. 4. Find the optimal solution with the Giden support.
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 75
Example (I)
• Solve the network flows problem associated to the network. 1
2
3 5
4
6
4
5
2 5 -5 9
0 -2
0 -2
i j cij
bi bj
• Begin: – Initial feasible tree:
T={(1,2),(2,3),(2,5),(2,4),(4,6)} – xB=[9,0,2,7,5]T
– π = [0,-3,-5,-5,-8,-11]T • 1st iteration:
– A\ T={(1,3),(3,5),(5,4),(5,6)} r = [ -3, 4, 2, -2]T⇒ (1,3) entering arc
– (2,3) outgoing arc
1
2
3 5 4
6 4
7
9 -3
0 2
2
-2 -11
-3
-8 -5 -5
i
j
xij πi
πj
rij
0
F.-Javier Heredia http://gnom.upc.edu/heredia
MEI
O/U
PC-U
B :
NET
WO
RK
FLO
WS
Min
imum
Cos
t Net
wor
k Fl
ow P
robl
ems
MCNFP- 76
Example (II) • 2nd iteration:
– Feasible tree: T={(1,3),(1,2),(2,5),(2,4),(4,6)}
– xB=[0,9,2,7,5]T
(invariant for all arcs ∉ fundamental cycles)
– π = [0,-2,-3,-5,-8,-11]T(invariant from node 2)
– A\ T={(2,3),(3,5),(5,4),(5,6)} r = [ 3, 1, 2, -2]T⇒ (5,6) entering arc
(4,6) outgoing arc.
1
2 3
5 4
6
1
7
9
2
2 -2 -11
-3
-8
-2
-5
i
j
xij πi
πj
rij
3
0 0
1
2 3
5 4
6
1
2
9
7
2
-9
-3
-8
-2
-5
3
0 0
2 5
• 3rd iteration: – Feasible tree:
T={(1,3),(1,2),(2,5),(5,6),(2,4)} – xB=[0,9,7,5,2]T
– π = [0,-2,-3,-5,-9,-8]T
– A\ T={(2,3),(3,5),(5,4),(4,6)} r = [ 3, 1, 2, 2]T>0 ⇒ optimum