43
EMIS 8374 Network Flow Models updated 29 January 2008

EMIS 8374 Network Flow Models updated 29 January 2008

Embed Size (px)

Citation preview

Page 1: EMIS 8374 Network Flow Models updated 29 January 2008

EMIS 8374

Network Flow Modelsupdated 29 January 2008

Page 2: EMIS 8374 Network Flow Models updated 29 January 2008

The Minimum Cost Network Flow Problem (MCNFP)

• Extremely useful model in OR & EM• Important Special Cases of the MCNFP

– Transportation and Assignment Problems– Maximum Flow Problem– Minimum Cut Problem– Shortest Path Problem

• Network Structure– BFS’s for MCNFP LP’s have integer values !!!– Problems can be formulated graphically

slide 2

Page 3: EMIS 8374 Network Flow Models updated 29 January 2008

Elements of the MCNFP

• Defined on a network G = (N,A)

• N is a set of n nodes: {1, 2, …, n}– Each node i has an associated value b(i)

• b(i) < 0 => node i is a demand node with a demand for –b(i) units of some commodity

• b(i) = 0 => node i is a transshipment node

• b(i) > 0 => node i is a supply node with a supply of b(i) units

slide 3

Page 4: EMIS 8374 Network Flow Models updated 29 January 2008

Elements of the MNCFP

• A is a set of arcs that carry flow– Decision variable xij determines the units of

flow on arc (i,j)

– The arc (i,j) from node i to node j has• cost cij per unit of flow on arc (i,j)

• upper bound on flow of uij (capacity)

• lower bound on flow of lij (usually 0)

slide 4

Page 5: EMIS 8374 Network Flow Models updated 29 January 2008

Example MCNFP

• N = {1, 2, 3, 4}b(1) =5, b(2) = -2, b(3) = 0, b(4) = -3

• A ={(1,2), (1,3), (2,3), (2,4), (3,4)}c12 = 3, c13 = 2, c23 =1, c24 = 4, c34 = 4

l12 = 2, l13 = 0, l23 = 0, l24 = 1, l34 = 0

u12 = 5, u13 = 2, u23 = 2, u24 = 3, u34 = 3

slide 5

Page 6: EMIS 8374 Network Flow Models updated 29 January 2008

Graphical Network Flow Formulation

b(j)b(i)

i j(cij, lij, uij)

arc (i,j)

slide 6

Page 7: EMIS 8374 Network Flow Models updated 29 January 2008

Example MCNFP

5 1 4(1, 0, 2)

3

2

0

-3

-2

(2, 0,2)

(4, 1,3)

(4, 0, 3)

(3, 2, 5)

slide 7

Page 8: EMIS 8374 Network Flow Models updated 29 January 2008

Requirements for a Feasible Flow

• Flow on all arcs is within the allowable bounds: lij xij uij for all arcs (i,j)

• Flow is balanced at all nodes:flow out of node i - flow into node i = b(i)

• MCNFP: find a minimum-cost feasible flow

slide 8

Page 9: EMIS 8374 Network Flow Models updated 29 January 2008

LP Formulation of MCNFP

Ajiux

Nibxx

xc

ijijij

ijiij

ijij

Ajij Aijj

Aji

),(

s.t.

min

),( : ),( :

),(

slide 9

Page 10: EMIS 8374 Network Flow Models updated 29 January 2008

LP for Example MCNFP

Min 3X12 + 2X13 + X23 + 4X24 + 4X34 s.t. X12 + X13 = 5 {Node 1} X23 + X24 - X12 = -2 {Node 2}

X34 - X13 - X23 = 0 {Node 3} - X24 - X34 = -3 {Node 4}

2 X12 5, 0 X13 2, 0 X23 2, 1 X24 3,

0 X34 3

slide 10

Page 11: EMIS 8374 Network Flow Models updated 29 January 2008

Example Feasible Solution

5 1 4(1, 0,2)

3

2

0

-3

-2

(2, 0,2)

(4, 1,3)

(4, 0,3)

(3, 2,5)

5 3

000

Cost = 15 + 12 = 27Arc flows shown in blue.

slide 11

Page 12: EMIS 8374 Network Flow Models updated 29 January 2008

Optimal Solution for Example MCNFP

5 1 4(1, 0,2)

3

2

0

-3

-2

(2, 0,2)

(4, 1,3)

(4, 0,3)

(3, 2,5)

3 1

022

Cost = 25Arc flows shown in blue. slide 12

Page 13: EMIS 8374 Network Flow Models updated 29 January 2008

Balanced Transportation Problems

Page 14: EMIS 8374 Network Flow Models updated 29 January 2008

Graphical Network Flow Formulation

b(j)b(i)

i j(cij, uij)

arc (i,j)

lij = 0 for all arcs.

slide 14

Page 15: EMIS 8374 Network Flow Models updated 29 January 2008

DDummy Node -3

C

W

+4

+1

+2

Supply Nodes

I

S

G

Demand Nodes

-1

-1

-1

-1

A

F

slide 15

Page 16: EMIS 8374 Network Flow Models updated 29 January 2008

C

W

+4

+1

+2

Supply Nodes

I

S

G

Demand Nodes

-1

-1

-1

-1

A

F

(13, 1)

(35, 1)

(9, 1)

(42, 1)

Dummy Node-3

(0,4)

(0,2)

(0,1)

D

slide 16

Page 17: EMIS 8374 Network Flow Models updated 29 January 2008

Shortest Path Problems

• Defined on a network with two special nodes: s and t

• A path from s to t is an alternating sequence of nodes and arcs starting at s and ending at t:

s,(s,v1),v1,(v1,v2),…,(vi,vj),vj,(vj,t),t

• Find a minimum-cost path from s to t

slide 17

Page 18: EMIS 8374 Network Flow Models updated 29 January 2008

Shortest Path Example 1

1 2 3

4

5 10

7 71

s t

1,(1,2),2,(2,3),3 Length = 151,(1,2),2,(2,4),4,(4,3) Length = 131,(1,4),4,(4,3),3 Length = 14

slide 18

Page 19: EMIS 8374 Network Flow Models updated 29 January 2008

MCNFP Formulation of Shortest Path Problems

• Source node s has a supply of 1

• Sink node t has a demand of 1

• All other nodes are transshipment nodes

• Each arc has capacity 1

• Tracing the unit of flow from s to t gives a path from s to t

slide 19

Page 20: EMIS 8374 Network Flow Models updated 29 January 2008

Shortest Path as MCNFP: Graphical Formulation

21 -11 3

4

(5,0,1) (10,0,1)

0

0

(7,0,1)(7,0,1)(1,0,1)

slide 20

Page 21: EMIS 8374 Network Flow Models updated 29 January 2008

Shortest Path as MCNFP: Graphical Solution

21 -11 3

4

(5,0,1) (10,0,1)

0

0

(7,0,1)(7,0,1)

Arc flows shown in blue.

0

01

1

1

(1,0,1)

slide 21

Page 22: EMIS 8374 Network Flow Models updated 29 January 2008

Shortest Path Example 2• In a rural area of Texas, there are six farms connected my

small roads. The distances in miles between the farms are given in the following table.

• What is the minimum distance to get from Farm 1 to Farm 6?

From Farm To Farm Distance 1 2 81 3 102 3 42 4 92 5 53 4 63 5 24 5 34 6 65 6 5

slide 22

Page 23: EMIS 8374 Network Flow Models updated 29 January 2008

Graphical Network Flow Formulation

b(j)b(i)

i j

lij = 0, uij=1

arc (i,j)

(cij)

slide 23

Page 24: EMIS 8374 Network Flow Models updated 29 January 2008

Formulation as Shortest Path

s t

1

2 4

3

9

10

56

6

8 45

5

4

2

3

1 -1

0 0

00

slide 24

Page 25: EMIS 8374 Network Flow Models updated 29 January 2008

LP Formulation of Shortest Path Problem

10

1

0

0

0

0

1st

min

5646

45352556

34244546

23133534

12252423

1312

5646453534

2524231312

54326594108

xxx

xxxxxxxxxxxxxxxx

xxxxxxxxxxxx

ij

slide 25

Page 26: EMIS 8374 Network Flow Models updated 29 January 2008

“Greedy” Solution

s t

1

2 4

3

9

10

56

6

8 45

5

4

2

3

1 -1

0 0

00

x13 = x23 = x35 = x35 = 1, xij = 0 for all other arcs.Objective function value = 19. slide 26

Page 27: EMIS 8374 Network Flow Models updated 29 January 2008

Shortest Path: Optimal Solution

s t

1

2 4

3

9

10

56

6

8 45

5

4

2

3

1 -1

0 0

00

x13 = x35 = x56 = 1, xij = 0 for all other arcs.Objective function value = 17. slide 27

Page 28: EMIS 8374 Network Flow Models updated 29 January 2008

Maximum Flow Problems

• Defined on a network– Source node s– Sink node t– All other nodes are transshipment Nodes– Arcs have capacities, but no costs

• Maximize the total flow from s to t

slide 28

Page 29: EMIS 8374 Network Flow Models updated 29 January 2008

Example: Rerouting Airline Passengers

Due to a mechanical problem, Fly-By-Night Airlines had to cancel flight 162 which is its only non-stop flight from San Francisco to New York.

Formulate a maximum flow problem to reroute as many passengers as possible from San Francisco to New York.

slide 29

Page 30: EMIS 8374 Network Flow Models updated 29 January 2008

Data for Fly-by-Night Example

Flight From To Number of seats 160 San Francisco Denver 5 115 San Francisco Houston 6 153 Denver Atlanta 4 102 Denver Chicago 2 170 Houston Atlanta 5 150 Atlanta New York 7 180 Chicago New York 4

slide 30

Page 31: EMIS 8374 Network Flow Models updated 29 January 2008

Graphical Network Flow Formulation

b(j)b(i)

i j

lij = 0

arc (i,j)

(uij)

slide 31

Page 32: EMIS 8374 Network Flow Models updated 29 January 2008

Network Representation

s t

SF

D C

H

2

6

A5

NY

5 4

4

7

slide 32

Page 33: EMIS 8374 Network Flow Models updated 29 January 2008

LP Formulation

40

70,50,40

20,60,50

0

0

0

0

stmax

,

,,,

,,,

,,

,,,

,,

,,,

,,

,,

xxxxxxx

xxxxx

xxxxx

xxxx

NYC

NYAAHAD

CDHSFDSF

NYANYC

ADAHNYA

CDNYC

DSFADCD

HSFAH

HSFDSF

v

vv

slide 33

Page 34: EMIS 8374 Network Flow Models updated 29 January 2008

Max Flow: Optimal Solution

v

vv

xxxxx

xxxxx

xxxx

NYANYC

ADAHNYA

CDNYC

DSFADCD

HSFAH

HSFDSF

,,

,,,

,,

,,,

,,

,,

0

0

0

0

stmax

9,2,7,2,2

,5,5,4

NYC,

NYA,D,CAD,

AH,HSF,DSF,

vxxxxxxx

slide 34

Page 35: EMIS 8374 Network Flow Models updated 29 January 2008

MCNF Formulation of Maximum Flow Problems

1. Let arc cost = 0 for all arcs

2. Add an arc from t to s– Give this arc a cost of –1 and infinite

capacity

3. All nodes are transshipment nodes

4. Circulation Problem

slide 35

Page 36: EMIS 8374 Network Flow Models updated 29 January 2008

Max Flow Formulation as MCNFP

SF

D C

H

(0,0,2)

(0,0,6)

A(0,0,5)

NY

(0,0,5) (0,0,4)

(0,0,4)

(0,0,7)

(-1,0,)

slide 36

Page 37: EMIS 8374 Network Flow Models updated 29 January 2008

LP Formulation of MCNFP Representation

0

0

0

0

0

0st

min

,, ,

,,,

,,

,,,

,,

,,,

,

xxxxxx

xxxxx

xxxxx

x

NYASFNY NYC

ADAHNYA

CDNYC

DSFADCD

HSFAH

SFNYHSFDSF

SFNY

SFNY,NYC,

NYA,AH,AD,

D,CHSF,DSF,

0,40,70,50,40

,20,60,50

xxxxxxxx

slide 37

Page 38: EMIS 8374 Network Flow Models updated 29 January 2008

MCNFP Solution

SF

D C

H

(0,0,2)

(0,0,6)

A(0,0,5)

NY

(0,0,5) (0,0,4)

(0,0,4)

(0,0,7)

9

4

22

5 75

2

(-1,0,)

slide 38

Page 39: EMIS 8374 Network Flow Models updated 29 January 2008

LP Formulation of MCNFP Representation: Optimal Solution

0

0

0

0

0

0st

min

,, ,

,,,

,,

,,,

,,

,,,

,

xxxxxx

xxxxx

xxxxx

x

NYASFNY NYC

ADAHNYA

CDNYC

DSFADCD

HSFAH

SFNYHSFDSF

SFNY

9,2,7,2,2

,5,5,4

SFNY,NYC,

NYA,D,CAD,

AH,HSF,DSF,

xxxxxxxx

slide 39

Page 40: EMIS 8374 Network Flow Models updated 29 January 2008

NSC Example

Month Demand Production Cost1 2,400 $7,4002 2,200 $7,5003 2,700 $7,6004 2,500 $7,800

• Max production per month = 4,000 tons• Inventory holding cost = $120/ton/month• Initial inventory = 1,000 tons• Final inventory = 1,500 tons

slide 40

Page 41: EMIS 8374 Network Flow Models updated 29 January 2008

Network Flow Formulation

D1

D2

D3

D4

P1

P2

P3

P4

4000

4000

4000

4000

-2400

-2200

-2700

-2500

I4 -1500

I0 1000

D0 -5700

I1

I2

I3

slide 41

Page 42: EMIS 8374 Network Flow Models updated 29 January 2008

Network Flow Formulation: Arc Costs

D1

D2

D3

D4

P1

P2

P3

P4

I4

I0

D0

I1

I2

I3

slide 42

7400

7500

7600

7800

7520

7620

7720

7920

120

120

120

120

All other arc costs are 0

Page 43: EMIS 8374 Network Flow Models updated 29 January 2008

Network Flow Solution

D1

D2

D3

D4

P1

P2

P3

P4

4000

4000

4000

4000

-2400

-2200

-2700

-2500

I4 -1500

I0 100

d0 -5700

I1

I2

I3

900

1800

25001500

1700

2300 900

2200

13002700

4000slide 43

lij = 0 and uij = for all arcs

2700