Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons...

23
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. MEIO/UPC-UB : NETWORK FLOWS Network Flows UPCOPENCOURSEWARE number 34414 Topic 1: Introduction

Transcript of Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons...

Page 1: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

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 1: Introduction

Page 2: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-2

Introduction Introduction • Definitions:

– Minimum shortest path problems. – Maximum flow problems. – Minimum cost flow problems.

• Network flow problems (NF) as a class of linear programming problems (LP): – Standard form of the minimum flow cost problem. – Nodes-arcs incidence matrix. – Formulation of the minimum shortest path problem. – Formulation of the maximum flow problem. – Formulation of the transportation and assignment problem. – Transformation to the standard form.

• Applications.

Page 3: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-3

Shortest Path Problems

1

2 4

3 5

6

10

25

35

20

15

35

40

30

20

s t

Shortest Path Problems

1

2 4

3 5

6

10

25

35

20

15

35

40

30

20

s t

• Applications: – Minimum cost flow problem. – Minimum time flow problem. – Equipment replacement problems.

Shortest Path Problems • To Identify the shortest path between a source node

(“s”) and the sink node (“t”).

1

2 4

3 5

6

10

25

35

20

15

35

40

30

20

s t

Page 4: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-4

Maximum Flow Problems • To seek how to send the maximum possible amount of

flow from a source node (“s”) to sink node (“t”) in a capacitated network.

3 5

3

1

2 4

6

6

4

2

2

5

6

4

s t 5

4 2

2

3

5

4

2

Maximum Flow Problems

• Applications: determining the maximum steady –state flow of: – Petroleum products in a pipeline network. – Cars in a road network. – Messages in a telecommunication network. – Electricity in an electrical network.

Maximum Flow Problems

Page 5: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-5

Minimum Flow Cost Problems • We wish to determie a least shipment cost of a single commodity

through a network in order to satisfy comsuption at demand nodes with the production of the supply nodes.

• Applications: – Logistics(warehouses to retailers). – Automobile routing in an urban traffic network. – Routing of calls through a telephone system.

1

2

3

4

5

6

7 10 10

-10

-15

5

3 6

4

3 1 2

2

4

6

5 0

10

5

0

Page 6: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-6

Standard form of the minimum cost flow problem (MCNFP) (I)

• Let G=(N,A) be the directed graph defined by the set N of n nodes (|N| = n) and the set A of m directed arcs (|A| = m) .

• Demand/supply vector: bj , j=1,2,...,n: b=[5,10,0,-15,0,5,10]’

• Cost vector: cij , (i,j)∈A : c=[5,3,4,...]’ • Flow: xij , (i,j)∈A : amout of commodity to be sent between node i

and node j through arc (i,j).

1

2

3

4

5

6

7 b7 = +10

-10

b4 = -15

5

3 6

4

3 1 c74 = 2

2

4

6

5 0

10

5 (7,4)

n=7 ; m=11 ; N={1,2,3,4,5,6,7} ; A={ (1,2), (1,3), (2,3),...}

Page 7: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-7

Standard form of the minimum cost flow problem(II)

• Mathematic formulation:

Standard form of the minimum cost flow problem(II)

Standard form of the minimum cost flow problem(II)

– We assume the network is balanced: 01

=∑=

n

iib

• Matrix notation:

≥=

(1.2c)0(1.2b):s.a.(1.2a)min

xbxT

xc

Standard form of the minimum cost flow problem (II)

{ } { }

∈∀≥

∈∀=−

=

∑∑

∈∈

(1.1c)

(1.1b):s.a.

(1.1a)

Ajix

Nibxx

xcz

ij

iAijj

jiAjij

ij

A(i,j)ijij

),(0

min

),(:),(:

Balance equations

Page 8: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-8

Node-arc incidence matrix • The associated node-arc

incidence matrix T is:

i (cij ,uij) j

1

2 4

3 5

(15,40)

45,1

0)

(25,20)

(35,

50)

(45,

60)

−−−

−−−−−

=

1110000010110100010110100000110100000011

54321

)4,5()3,5()5,4()3,4()2,3()4,2()3,1()2,1(

T

• Properties: – 2m non-zero elements among nm. – Only 2 elements ≠0 per column. – Every non-zero elements is +1 or -1. – Rank(T)= n-1.

• Consider the following network:

Page 9: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-9

Shortest path problem formulated as a MCNFP

• b1= +1 ; b6= -1 ; bj= 0 ∀j ≠1,6

1

2 4

3 5

6

10

25

35

20

15

35

40

30

20

+1 -1

i cij j

Page 10: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-10

Maximum flow problem formulated as a MCNFP

• Artificial arc xts with cts=-1 and uts= +∞. • cij=0 ∀(i,j)≠(t,s)

3 5

(0,3)

1

2 4

6

(0,5)

s t

i (cij ,uij) j

(-1,+∞)

Page 11: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-11

Transportation problem formulated as a MCNFP

• Properties: – N = N1∪ N2:

N1: production nodes; N2: demand nodes. – ∀(i,j)∈A : i ∈ N1 ; j ∈ N2

1

2

3

4

5

6

7

Page 12: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-12

Assigment problem formulation

• Properties: – N = N1∪ N2 ; |N1 |= |N2| – A⊆ N1× N2.

– bj=+1 ∀j ∈N1 ; bj=-1 ∀j ∈N2

1

2

3

4

5

6

+1

+1

+1

-1

-1

-1

Page 13: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-13

Transformation to the standard form (I)

• Undirected arcs:

– Contribution to the objective function: cij xij +cij xji

– cij ≥ 0 ⇒ at the optimal solution xij > 0 or xji > 0

i j xji

xij

i j xji

xij

– Transformation: each directed arc {i,j} is replaced by two directed arcs (i,j) and (j,i) with cost cij :

Page 14: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-14

Transformation to the standard form (II)

• Arcs with non-zero lower bounds: – xij ≥ lij

– xij is replaced by x’ij+lij in the problem’s formulation:

Bounds: xij ≥ lij ⇒ x’ij+lij ≥ lij ; x’ij ≥ 0

Balance equations: bi → bi - lij ; bj → bj + lij

Objective function: cij xij → cij (x’ij + lij ) = cij x’ij + cij lij

cte.

Page 15: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-15

Transformation to the standard form (III) • Arcs with negative costs:

– Let be xij with cij<0. – Let uij a trivial upper bound of the arc (i,j). – xij is replaced by x’ij = uij – xij.

0 ≤ x’ij ≤ uij

Objective function: z = ...+ cij xij +...→ z’= ...+ cijuij – cij x’ij +...

cst >0

i j x’ij

-cij ,uij

bi - uij bj + uij

i j xij

cij ,uij

bi bj

Balance equations:

Page 16: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-16

Transformation to the standard form (IV)

• Arcs with capacity: – Let 0 ≤ xij ≤ uij. – Network transformation:

i j xij

cij ,uij

bi bj i k

xik cik ,∞

bi - uij

j bj + uij xjk

0 ,∞

The network is equivalent to the original: xij ≡ xik ; xik + xjk = uij ⇒ xik = xij ≤ uij

The objective function id not modified: cik ≡ cij

Page 17: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-17

Transformation to the standard form (V)

• Unbalanced network:

01

>∑=

n

jjb

– Excess of production ( ) :

2

3

4 +8

-8

-7

1 +10

2

3

4 +8

-12

-10

1 +10

01

<∑=

n

jjb

– Excess of demand ( ) :

5 -3

A dummy demand node n+1 is added linking all production nodes through uncapacitated - null cost arcs.

5 +4

A dummy supply node n+1 is added, linking all demand nodes through uncapacitated – null cost arcs.

Page 18: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-18

Transformation to the standard form (VI)

• Example 1: (Solution)

1

2 4

3 5

(-2,10,0)

(-1,

20,0

)

(10, ∞,5)

(2, ∞

,0)

-10

0 10

i (cij ,uij ,lij ) j

bi bj

-15

20

Page 19: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-19

Applications

• Solve the applications examples from book

chapter 1.3 of AMO (1 week):

– Problem description.

– Network formulation and objective function

associated to the problem.

– Problem classification.

• Problems assigment:

Page 20: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-20

Transformation to the standard form Example (1/4)

1. Negative cost elimination

1

2 4

3 5

(2,10,0) (1

,20,

0)

(10, ∞,5) (2

, ∞,0

)

-10+10 = 0

0 10+20 = +30

i (cij ,uij ,lij ) j

bi bj

-15-10-20= -45

20 z=z’+20+20=z’+40

Page 21: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-21

Transformation to the standard form Example (2/4)

2. Lower bounds elimination ≠0

1

2 4

3 5

(2,10,0) (1

,20,

0)

(10, ∞,0) (2

, ∞,0

)

0

0+5 = 5 30-5 = -25

i (cij ,uij ,lij ) j

bi bj

-45+5 = -40

20-5 = 15 z=z’+40+25+50=z’+115

Page 22: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-22

Transformation to the standard form Example (3/4)

3. Capacity elimination

1

2 4

3 5

(0, ∞,0)

(10, ∞,0) (2

, ∞,0

)

0

5 -25

i (cij ,uij ,lij ) j

bi bj

-40+20+10 = 30

15

z=z’+115

6 -20

7

-10

(2, ∞,0)

Page 23: Topic 1: Introduction · F.-Javier Heredia This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this

F.-Javier Heredia http://gnom.upc.edu/heredia

MEI

O/U

PC-U

B :

NET

WO

RK

FLO

WS

intr

oduc

tion

Introduction-23

Transformation to the standard form Example (4/4)

4. Unbalance network

1

2 4

3 5

(0, ∞,0)

(10, ∞,0)

(2, ∞

,0)

0

5

-25

i (cij ,uij ,lij ) j

bi bj

30

15

z=z’+115

6 -20

7

-10

(2, ∞,0)

7 -25