43
1 Outline 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 Outline LP formulation of minimal cost flow problem useful results from shortest path problem optimality condition residual network potentials

Embed Size (px)

Citation preview

1

OutlineOutline 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

2

Minimum Cost Flow ModelsMinimum 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): the amount of flow out of node i b(i) > (resp. <) 0 for out (resp. in) flow

Assume direct arcs.

How to deal with an

undirected arc?

3

Minimum Cost Flow ModelsMinimum Cost Flow Models

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

1

2

3

4

5

6

(3, 8)

(2, 3)

(2, 2)

(2, 3)

(5, 7)

(4, 3)

(5, 4)

(3, 5)

(4, 6)

9 -9

(cij, uij)

4

A Minimum Cost Flow A Minimum Cost Flow LPLP Model Model

( , )

{ :( , ) } { :( , ) }

min z ) = ,

. . ( ), for all ,

0 , for all ( , ) .

ij iji j A

ij ijj i j A j j i A

ij ij

c x

s t x x b i i A

x u i j A

(x

1

2

3

4

5

6

(3, 8)

(2, 3)

(2, 2)(2, 3)

(5, 7)

(4, 3)

(5, 4)

(3, 5)

(4, 6)

9 -9

12 13 23 24 25 35 36 54 56

12 13 23 24 25 12

35 13 23 46 24 54

56 25 35 46 56

12 13

min z ) = 3 2 2 5 2 4 3 5 4 ,

. .

9, 0,

0, 0,

0, 9,

0 8, 0 3,

x x x x x x x x x

s t

x x x x x x

x x x x x x

x x x x x

x x

(x

23

24 25 35

46 54 56

0 3,

0 7, 0 2, 0 3,

0 5, 0 4, 0 6.

x

x x x

x x x

5

Useful Results Useful Results from Shortest-Path Algorithmsfrom Shortest-Path Algorithms

6

Useful Results Useful Results from Shortest-Path Algorithmsfrom Shortest-Path Algorithms

optimality condition for shortest distances

residual network

potentials of nodes

reduced costs of arcs with respect to a given set of potentials

7

Optimality Condition Optimality Condition for Shortest Distancesfor 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.

8

Optimality Condition Optimality Condition for Shortest Distancesfor Shortest Distances

LHS figure: {d(i)} = {0, 2, 3, 7} 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

1

2

3

4

2

7

1

6

4

d(1) = 0

d(2) = 2

d(3) = 3

d(4) = 7

1

2

3

4

2

7

1

6

4

d(1) = 0

d(2) = 2

d(3) = 3

d(4) = 8

(-8,3)

(-2, 3)(6, 4)

(8, 2) (2, 4)

9

Residual NetworkResidual Network

(6,4)

(8,5)

s t

1(2,7)

Figure 1. Costs and Capacities of Arcs

Figure 3. The Residual Network Corresponding to Figure 1

t(6, 4)

(8, 5)

s

1 (2, 7)

333 3

Figure 2. Flows on arcs

0s t

1

Figure 4. The Residual Network Corresponding to Figure 2

s t

1

003 3 3

(6, 1)

(8, 5) (2, 7)

(-6, 3)

actual meaning of sending flow in cycle s-t-1-s (Figure 4)

a different way to send flow from s to t

flow along t-1-s reduction of flow in s-1-t

10

A Cycle in a Residual NetworkA Cycle in a Residual Network

(-8,3)

(-2, 3)(6, 4)

(8, 2) (2, 4)

Figure 4. The Residual Network Corresponding to Figure 2

s t

1

Figure 5. The New Residual Network After Adding a Flow of

3 units in cycle s-t-1-s

s t

1

s t

1

Figure 6. Flows on arcs

11

Potentials of Nodes and the Potentials of Nodes and the

Corresponding Reduced Costs of ArcsCorresponding 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

define the reduced cost with respect to this set of potentials {i} by

interesting properties for this set of reduced costs

ijc

ij ij i jc c

12

Potentials of Nodes and the Potentials of Nodes and the Corresponding Reduced Costs of ArcsCorresponding 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

13

Potentials of Nodes and the Potentials of Nodes and the Corresponding Reduced Costs of ArcsCorresponding 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()

1

2

3

4

5

6

8

3

23

7

3

4

5

6

1 = 3

2 = -5

3 = 2

4 = 6

5 = -3

6 = 5

(1 3 5 6) 14C (1 3 5 6) 12C

1

2

3

4

5

6

0

2

410

18

-2

13

4

14

C(P) C(P)

14

Potentials of Nodes and the Potentials of Nodes and the Corresponding Reduced Costs of ArcsCorresponding 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

if j = -d(j), then for all (i, j) A

arcs with forming a tree

1

2

3

4

5

6

8

3

23

7

3

4

5

6

1 = 3

2 = -5

3 = 2

4 = 6

5 = -3

6 = 5

0ijc

j = -d(j)

0ijc

1

2

3

4

5

6

1 = 0

2 = -8

3 = -3

4 = -10

5 = -6

6 = -120

0

48

5

0

0

3

0

15

Spanning Tree and Spanning Tree and BFSBFS

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

16

The optimality Conditions The optimality Conditions for Networksfor Networks

17

The Optimality Conditions for NetworksThe 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

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 then = 0; if 0 < < uij, then if then = uij.

0ijc

0,ijc *ijx

0;ijc 0,ijc *

ijx

*ijx

18

Ideas for Theorem 1Ideas for Theorem 1

a cycle in a residual network: a different way to send flow across a network

existing of a negative cycle existence of another flow pattern with lower cost

no negative cycle no other flow pattern with lower cost

19

Ideas for Theorem 3Ideas 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

optimality conditions of simplex method for bounded variables

*

*

*

if 0, then 0;

if 0 < , then 0;

if 0, then .

ij ij

ij ij ij

ij ij ij

c x

x u c

c x u

20

Ideas for Theorem 2Ideas 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

21

Ideas for Theorem 2Ideas 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 every arc (i, j) in the residual network G(x*).

Theorem 2 minimum for any potential and cycle: C(P) = C(P)

for every arc in G(x) no negative cycle in G minimal

0ijc

0ijc

22

Ideas for Theorem 2Ideas 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 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 by Theorem 3

no reversed arc in G(x*)

a forward arc (i, j) with = uij, in the original network

no such forward arc in G(x*)

for the reversed arc in G(x*):

a forward arc (i, j) with in the original network

for the forward arc in G(x*):

for the reversed arc in G(x*):

0ijc

*ijx

* 0,ijx

0ijc

( ) 0ji ji j i ij i j ijc c c c

*0 , 0ij ij ijx u c

0ijc

0ijc

0ijc

23

Equivalence Between Equivalence Between Network Simplex Network Simplex

and Negative Cost Cycleand Negative Cost Cycle

24

Equivalence Between Network Simplex Method and Equivalence Between Network Simplex Method and Existence of a Negative Cost CycleExistence of a Negative Cost Cycle

at a certain point, an extended basic feasible solution is shown below, where the dotted lines show arcs at upper bounds.

1

2

3

4

5

6

(3, 8)

(2, 3)

(2, 2)(2, 3)

(5, 7)

(4, 3)

(5, 4)

(3, 5)

(4, 6)

9 -9

(cij, uij)

1

2

3

4

5

6

7

2

20

5

2

5

4

9 -90

Flow

25

An Iteration of the Network SimplexAn Iteration of the Network Simplex

to find the entering variable

x46 entering

reduction of flow from upper bound

1

2

3

4

5

6

7

2

20

5

2

5

4

9 -90

Flow

1

2

3

4

5

6

3

2

5

4 4

dual variables

1 = 0

2 = 1 – c12 = -3 4 =-8

3 =-2 5 =-6

6 =-10

46 3 8 10 1c

beneficial to reduce flow in (4, 6)

How about (2, 3), (2, 5),

(5, 4)?

26

An Iteration of the Network SimplexAn Iteration of the Network Simplex

to find the leaving variable reduction of flow from x46

leaving variable, x13 or x35, for = 1

1

2

3

4

5

6

(3, 8)

(2, 3)

(2, 2)(2, 3)

(5, 7)

(4, 3)

(5, 4)

(3, 5)

(4, 6)

9 -9

(cij, uij)

1

2

3

4

5

60 0

Change of Flow

1

2

3

4

5

6

7

2

20

5

2

5

4

9 -90

Current Flow Pattern

0 2+ 3

0 7 8

0 5 7 0 5

5

0 2+ 3

0 4+ 6

27

An Iteration of the Network SimplexAn Iteration of the Network Simplex

= 1

arbitrarily making x35 leaving1

2

3

4

5

6

(3, 8)

(2, 3)

(2, 2)(2, 3)

(5, 7)

(4, 3)

(5, 4)

(3, 5)

(4, 6)

9 -9

(cij, uij)

1

2

3

4

5

6

0 7 8

0 0

Change of Flow0 5

7 0 5 5

0 2+ 3

0 2+ 3

0 4+ 6

1

2

3

4

5

6

6

3

20

4

3

4

5

9 -90

New Flow Pattern

(cij, xij)

28

An Iteration of An Iteration of the Negative Cycle Algorithmthe Negative Cycle Algorithm

negative cycle 1-3-5-6-4-2-1 cost = -1

maximum allowable flow = 1 unit1

2

3

4

5

6

(3, 8)

(2, 3)

(2, 2)(2, 3)

(5, 7)

(4, 3)

(5, 4)

(3, 5)

(4, 6)

9 -9

(cij, uij)

1

2

3

4

5

6

7

2

20

5

2

5

4

9 -90

Current Flow Pattern

Residual Network

29

An Iteration of An Iteration of the Negative Cycle Algorithmthe Negative Cycle Algorithm

negative cycle 1-3-5-6-4-2-1 cost = -1

maximum allowable flow = 1 unit1

2

3

4

5

6

(3, 8)

(2, 3)

(2, 2)(2, 3)

(5, 7)

(4, 3)

(5, 4)

(3, 5)

(4, 6)

9 -9

(cij, uij)

(cij, xij)(cij, xij)

30

Same Result from Network Simplex Method and Negative Cost Cycle

1

2

3

4

5

6

(3, 8)

(2, 3)

(2, 2)(2, 3)

(5, 7)

(4, 3)

(5, 4)

(3, 5)

(4, 6)

9 -9

(cij, uij)

1

2

3

4

5

6

6

3

20

4

3

4

5

9 -90

New Flow Pattern

residual network (cij, xij)

31

Transportation Simplex MethodTransportation Simplex Method

32

Transportation Simplex MethodTransportation Simplex Method

balanced transportation problem

2 sources, 3 destinations

5 constraints, with one degree of redundancy

4 basic variables in a BFS

33

Transportation Simplex MethodTransportation Simplex Method

four basic variables in a BFS

34

Transportation Simplex MethodTransportation Simplex Methodreduced cost (i, j) = cij – ui – vj

35

Transportation Simplex MethodTransportation Simplex Method

36

Transportation Problem by Transportation Problem by Eliminating Negative CyclesEliminating Negative Cycles

37

Transportation Problem by the Transportation Problem by the Negative Cycle Approach Negative Cycle Approach

38

Transportation Problem by the Transportation Problem by the Negative Cycle Approach Negative Cycle Approach

39

Transportation Problem by the Transportation Problem by the Negative Cycle Approach Negative Cycle Approach

40

Transportation Problem by the Transportation Problem by the Negative Cycle Approach Negative Cycle Approach

no more negative cycle

optimal flow: x13 = 100, x14 = 500, x15 = 200, x23

= 300, x24 = 0, x25= 0,

minimum cost = 7600

41

To Determine To Determine an Initial Feasible Solutionan Initial Feasible Solution

42

To Find an Initial Feasible SolutionTo Find an Initial Feasible Solution

to solve a maximal flow problem

43

To Find an Initial Feasible SolutionTo 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