1. minimum cost flow problems in networks 2. modelling and ...for network flow problems the...

36
Lecture: Optimization of network flows 1. Minimum cost flow problems in networks 2. Modelling and graph theory. 3. The Simplex method. Lecture Optimization on Networks 1 Optimization on networks

Upload: others

Post on 05-Jul-2020

3 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Lecture: Optimization of network flows

1. Minimum cost flow problems in networks

2. Modelling and graph theory.

3. The Simplex method.

Lecture Optimization on Networks 1 Optimization on networks

Page 2: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The minimum cost flow problem in networks

1

2

3

4

5

40

35

30

20

25

x12/c12

x13/c13

x23/c23

x24/c24

x34/c34

x35/c35

x45/c45

Data is sent from servers in nodes 1 and 2 to terminals in nodes 3, 4, 5.

The cost for traffic in the link between node i and j is cij SEK/Kbyte.

We want to minimize the total cost for the data traffic

Lecture Optimization on Networks 2 Optimization on networks

Page 3: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The optimization problem formulation

minimize∑

all arcs

cijxij

s.t. x12 + x13 = 40

−x12 + x23 + x24 = 35

−x13 − x23 + x34 + x35 = −30

−x24 − x34 + x45 = −25

−x35 − x45 = −20

xij ≥ 0, all flows in the links

Lecture Optimization on Networks 3 Optimization on networks

Page 4: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

We will address the following questions� Modelling of the network flow problem

– Graphs, trees, cycles, spanning trees.� How can the particular structure of the graph be used in the

Simplex method.

Lecture Optimization on Networks 4 Optimization on networks

Page 5: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Modelling and graph theory

1

2

3

4

5

A directed graph G = (N ,B) consists of a set of nodes N = {1, . . . ,m}

and a set of arcs B� The arc from node i to node j is denoted (i, j).� We differentiate from the arc (i, j) and the arc (j, i).

In the graph above

N = {1, . . . , 5}

B = {(1, 2), (1, 3), (2, 3), (2, 4), (3, 4), (3, 5), (4, 5)}

Lecture Optimization on Networks 5 Optimization on networks

Page 6: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

If we arrange the arcs in B in some order, e.g.

B = {(1, 2), (1, 3), (2, 3), (2, 4), (3, 4), (3, 5), (4, 5)} (1)

ρ1 ρ2 ρ3 ρ4 ρ5 ρ6 ρ7

then the incidence matrix A ∈ Rm×n of the graph is defined as

aij =

1, arc ρj starting in node i

−1, arc ρj ending in node i

0, otherwise

(2)

It is easy to see that eTA = 0, where eT =[

1 1 . . . 1]

. The rows

are thus linearly dependent and it is possible to eliminate the last row to

obtain the reduced incidence matrix A.

Lecture Optimization on Networks 6 Optimization on networks

Page 7: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

In our example we have

A =

1 1 0 0 0 0 0

−1 0 1 1 0 0 0

0 −1 −1 0 1 1 0

0 0 0 −1 −1 0 1

0 0 0 0 0 −1 −1

A =

1 1 0 0 0 0 0

−1 0 1 1 0 0 0

0 −1 −1 0 1 1 0

0 0 0 −1 −1 0 1

Lecture Optimization on Networks 7 Optimization on networks

Page 8: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Path and cycle� A path from node s to node t in a directed graph is a connected

sequence of arcs ρ1, . . . , ρN where

ρk = (ik−1, ik), or ρk = (ik, ik−1), and i0 = s, iN = t

� A directed path from node s to node t in a directed graph is a

connected sequence of arcs ρ1, . . . , ρN where

ρk = (ik−1, ik), and i0 = s, iN = t

� A (directed) cycle is a (directed) path from a node to itself.

Lecture Optimization on Networks 8 Optimization on networks

Page 9: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

� A graph is called connected if there exists a path between each pair

of nodes.� A graph is called acyclic if it contains no cycles.� A tree is formed by a connected subset of the graph that contains

no cycles (i.e., it is acyclic).� In a graph with n nodes a tree with n− 1 arcs form a spanning tree.

Connected graphNOT acyclic

Acyclic graphNOT connected

Tree Spanning Tree

Lecture Optimization on Networks 9 Optimization on networks

Page 10: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

� If an arc is added to a spanning tree, then a unique cycle is created.� If an arc is removed from a spanning tree, then the tree is

decomposed into two new trees.

a unique cycle is created

If an arc is removedit is decomposedinto two new trees

If an arc is added

Lecture Optimization on Networks 10 Optimization on networks

Page 11: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Balance of flow

1

2

3

4

5x12

x13

x23

x24

x34

x35

x45

b1

b2

b3

b4

b5

� xij denotes the flow (data traffic, oil, e.t.c.) in arc (i, j)

– If the flow xij goes in the direction i → j, then xij ≥ 0.

Otherwise xij ≤ 0.� bi denotes external flow in/out to node i.

Flow in if bi ≥ 0, and flow out if bi ≤ 0.

Lecture Optimization on Networks 11 Optimization on networks

Page 12: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Flow balance in node i (flow out = flow in):

n∑

j=1

aijxij = bi, i = 1, . . . , n ⇔ Ax = b

In the above balance equation, A is the incidence matrix of the graph

defined in equation (2) and x is a column vector with the flows xij

sorted in the same order as the arcs in equation (1).

Finally, b =[

b1 . . . bn

]T

.

The balance equation has solutions iff eTb =∑n

i=1 bi = 0. With this

assumption we can reduce the flow balance equation by eliminating the

last row (i.e., the n:th balance equation is redundant). We arrive at the

equation system Ax = b, where b =[

b1 . . . bn−1

]T

.

Lecture Optimization on Networks 12 Optimization on networks

Page 13: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Optimal solution

Initial BFS

Yes

No

Unbounded problemSolution does not exist

No

Yes

β = (β1, . . . , βm)

ν = (ν1, . . . , νl)

Calculate (y, rν , b)AT

βy = cβ

rν = cν − ATνy

Aβ b = b

rν ≥ 0

Take νq so that rνq < 0

Solve Aβ ak = ak ; k := νq

ak ≤ 0

tmax = min

(

bi

aik

|aik > 0

)

=bp

apk

νold := νq , νq := βp, βp := νold

xβ = b, xν = 0

z = cTβ b = yTb

xp exits the basis

xνq enters the basis

Lecture Optimization on Networks 13 Optimization on networks

Page 14: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

For network flow problems the simplex algorithm is simplified in the

following way:

1. Arcs corresponding to a basic index vector (β) corresponds to a

spanning tree

2. The values of the basic variables (determined by Aβxβ = b) follows

simply by balancing the flows in the spanning tree.

3. The Simplex multiplicators given by ATβy = cβ are easily determined

by the spanning tree.

4. The quotient test is performed by studying the flow in a cycle.

5. The pivot step, (change of basis) is done by exchanging an arc in

the spanning tree.

We illustrate this on the example studied earlier.

Lecture Optimization on Networks 14 Optimization on networks

Page 15: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Basic matrices corresponds to spanning trees

Theorem m − 1 columns from the (m − 1) × n matrix A in a

minimum cost flow problem are linearly independent iff the

corresponding m − 1 arcs form a spanning tree.

The figure shows two basic matrices and the corresponding spanning

trees:

1

2

3

4

5

1

2

3

4

5x12 x12x23 x23

x24 x24

x35

x45

β = {(1, 2), (2, 3), (2, 4), (4, 5)} β = {(1, 2), (2, 3), (2, 4), (3, 5)}

Aβ =

2

6

6

6

6

4

1 0 0 0

−1 1 1 0

0 −1 0 0

0 0 −1 1

3

7

7

7

7

5

Aβ =

2

6

6

6

6

4

1 0 0 0

−1 1 1 0

0 −1 0 1

0 0 −1 0

3

7

7

7

7

5

Lecture Optimization on Networks 15 Optimization on networks

Page 16: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Determining the basic solution Bx = b

1

2

3

4

5x12 x23

x24x45

b1

b2

b3

b4

b5

The basic variables can be determined from the flow balance equations in

the spanning tree (recall (b1, b2, b3, b4) = (40, 35,−30,−25), b5 = 20.)

x12 = b1 = 40

x23 = −b3 = 30

x24 = b2 + x12 − x23 = 45

x45 = x24 + b4 = 20

1 0 0 0

−1 1 1 0

0 −1 0 0

0 0 −1 1

x =

b1

b2

b3

b4

Note that x45 + x35 = 20, i.e., flow balance in node 5, follows automatically

Lecture Optimization on Networks 16 Optimization on networks

Page 17: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The basic flow can also be determined through the balance equations

“downstreams”: x45 = b5 = 20

x24 = x45 − b4 = 45

x23 = −b3 = 30

x12 = x23 + x24 − b2 = b1 = 40

Do you see why ?

Note that xβ = b =

b12

b23

b24

b45

=

40

30

45

20

≥ 0 so we have a feasible basic solution.

Lecture Optimization on Networks 17 Optimization on networks

Page 18: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Determining the simplex multiplicators yTAβ = cTβ

The Simplex multiplicators are determined by the equation yTAβ = cTβ .

To node 1, . . . ,m − 1 corresponds the simplex multiplicator yk,

k = 1, . . . ,m − 1. If we let ym = 0 then

yi − yj = cij, for all (i, j) ∈ β (all basic arcs)

Hence, the simplex multiplicators can be determined from the network

1

2

3

4

5c12 c23

c24c45

y1

y2

y3

y4

y5 = 0

Lecture Optimization on Networks 18 Optimization on networks

Page 19: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

1

2

3

4

5c12 c23

c24c45

y1

y2

y3

y4

y5 = 0

With cT = (c12, c13, c23, c24, c34, c35, c45) = (2, 5, 2, 2, 1, 1, 2) we obtain

(in this order since y5 = 0)

y4 − y5 = c45 ⇒ y4 = c45 = 2

y2 − y4 = c24 ⇒ y2 = y4 + c24 = 2 + 2 = 4

y2 − y3 = c23 ⇒ y3 = y2 − c23 = 4 − 2 = 2

y1 − y2 = c12 ⇒ y1 = y2 + c12 = 4 + 2 = 6

Lecture Optimization on Networks 19 Optimization on networks

Page 20: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Determining the reduced costs rν = cTν − yTAν

The formula for the reduced costs rν = cTν − yTAν results in the

equations (ym = 0)

rij = cij − yi + yj for all (i, j) ∈ ν (i.e., for all non-basic arcs)

In our example, we have

ν = {(1, 3), (3, 4), (4, 5)}, Aν =

1 0 0

0 0 0

−1 1 1

0 −1 0

Lecture Optimization on Networks 20 Optimization on networks

Page 21: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

We can perform the calculations with help of the network

1

2

3

4

5 y5=0

r13/c13

r35/c35

r34/c34

y1

y2

y3

y4

r13 = c13 − y1 + y3 = 5 − 6 + 2 = 1

r34 = c34 − y3 + y4 = 1 − 2 + 2 = 1

r35 = c35 − y3 + y5 = 1 − 2 + 0 = −1

Note that r35 < 0 and the current basic feasible solution is not optimal.

Lecture Optimization on Networks 21 Optimization on networks

Page 22: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The Quotient test

Since r35 < 0 we let x35 = t, i.e., the arc (3, 5) enters the basis.

The question is now which arc should be removed in order to obtain a

new spanning tree corresponding to a new basic matrix.

1

2

3

4

5x12 x23

x24 x45

x35 = tb1

b2

b3

b4

b5

The test in the usual simplex method tmax = min

{

bi

aik

|aik > 0

}

=bp

apk

is simplified by just looking at the flow balance in the cycle that has

been formed.

Lecture Optimization on Networks 22 Optimization on networks

Page 23: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

1

2

3

4

5x12 = b12

x23 = b23 + t

x24 = b24 − t x45 = b45 − t

x35 = t

40

35

−30

−25

−20

x23 = b23 + t = 30 + t

x24 = b24 − t = 45 − t

x45 = b45 − t = 20 − t

Note that t can be increased until tmax = 20 when x45 = 0.

Then x45 exits the basis.

Lecture Optimization on Networks 23 Optimization on networks

Page 24: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The Pivot step (change of basis)

1

2

3

4

5x12 = 40x23 = 50

x24 = 25

x35 = 2040

35

−30

−25

−20

We have β = {(1, 2), (2, 3), (2, 4), (3, 5)} and

xβ = b =

40

50

25

20

≥ 0

which is a new basic feasible solution.

Lecture Optimization on Networks 24 Optimization on networks

Page 25: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Next iteration

If we repeat the above steps, we get

y =

y1

y2

y3

y4

=

5

3

1

1

, rν =

r13

r34

r45

=

1

1

1

≥ 0

Since all the reduced costs are positive, the current basic feasible

solution is optimal.

Lecture Optimization on Networks 25 Optimization on networks

Page 26: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Resume of the network flow simplex method

For network optimization, most steps in the simplex method are

simplified:

(i) A basic index vector β corresponds to the arcs in a spanning tree.

(ii) The basic solution corresponding to β can be determined from the

flow balance equations in a spanning tree. The basic solution is

feasible if the flow in all basic arcs are non-negative.

(iii) The Simplex multiplicators are determined by (ym = 0)

yi − yj = cij, for all (i, j) ∈ β (all basic arcs)

(iv) The reduced costs are determined from

rij = cij − yi + yj for all (i, j) ∈ ν (i.e. for all non-basic arcs)

(v) If all rij ≥ 0 an optimal basic solution has been found.

Lecture Optimization on Networks 26 Optimization on networks

Page 27: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

(vi) If some reduced cost rij is negative (use the most negative), add the

arc (i, j) to the spanning tree corresponding to the basis β. A cycle

is formed and we apply a flow xij = t ≥ 0. By studying the balance

of flow in the cycle, it is easy to see how much t can be increased

until one flow in the cycle is zero.

If t can be increased arbitrarily, the optimization problem has no

bounded solution.

(vii) Update the spanning tree by adding the arc (i, j) to β and removing

the arc with zero flow. A new basis is obtained (i.e., a new spanning

tree) and a new basic feasible solution.

(viii) Repeat from (iii).

Lecture Optimization on Networks 27 Optimization on networks

Page 28: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The four fundamental subspaces for the incidence matrix

This part is for illustration only

We demonstrate how the four fundamental subspaces for the incidence

matrix A can be interpreted (with an electric analogue) with the help of

the associated graph G = (N ,B). Returning to our example:

1

2

3

4

5x12

x13

x23

x24

x34

x35

x45

y1

y2

y3

y4

y5

To every node j we associate a potential yj, j = 1, . . . ,m.

To every arc (i, j) we associate a flow (current) xij.

Lecture Optimization on Networks 28 Optimization on networks

Page 29: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

We note that the network corresponds to the electric circuit below:

x12

x13

x23

x24

x34

x35

x45

u12

u13

u23

u24

u34

u35

u45

y1

y2

y3

y4

y5

� yj, j = 1, . . . , 5 denotes the potential in node j.� xij denotes the current in arc (i, j).� uij denotes the voltage over the resistor in arc (i, j).

Lecture Optimization on Networks 29 Optimization on networks

Page 30: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Left nullspace

Interpretation: The equation yTA = u corresponds to the physical laws

over the arcs (resistors)

yi − yj = uij voltage = difference in potential

There is no unique solution since we can add an arbitrary constant to all

node potentials without changing the voltages over the arcs.

The equation yTA = u correspond to the potential y5 is fixed at zero.

(earth)

N (AT) = span

e =

1

1

1

1

1

If y ∈ N (AT), then u = 0.

i.e., if all potentials are equal,

then all voltages are zero.

Lecture Optimization on Networks 30 Optimization on networks

Page 31: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The (right) Null space

N (A) ={

x ∈ R7 : Ax = 0

}

= span

1

−1

1

0

0

0

0

,

0

0

1

−1

1

0

0

,

0

0

0

0

1

−1

1

= N (A)

Interpretation: The Nullspace corresponds to three cycles in the network

1

2

3

5

4

1

2 3

Lecture Optimization on Networks 31 Optimization on networks

Page 32: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Other cycles in the graph are given by linear combinations of the three

“basis cycles” in the previous figure.

31

2

5

4

31

2

5

4

Cycle 2 − cycle 3

31

2

5

4

(basis)cycle 1 − cycle 2 Cycle 1 − cycle 2 + cycle 3

The flow in/out of the circuit is not affected by the current x in a cycle

since Ax = 0.

Lecture Optimization on Networks 32 Optimization on networks

Page 33: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The Rowspace

R(AT) ={

u = ATy}

(={

u = ATy}

)

= N (A)⊥ (= N (A)⊥)

={

u ∈ R7 : u13 = u12 + u23; u24 = u23 + u34; u35 = u24 + u45

}

Interpretation: The sum of the voltages over a cycle is equal to zero.

This is also called Kirchoff’s voltage law.

Note that there are more possible cycles, e.g., we have the constraint

u12 + u24 = u13 + u34, but these constraints follows from linear

combinations of the three others (see previous slide).

Lecture Optimization on Networks 33 Optimization on networks

Page 34: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

The Rangespace

R(A) = N (AT)⊥ = {b ∈ Rm : eTb = 0}

= {b ∈ Rm :

m∑

k=1

bk = 0}

If bj is interpreted as an external current that is fed in to node j, then

the result says that the sum of these currents must be zero.

Lecture Optimization on Networks 34 Optimization on networks

Page 35: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Kirchoff’s laws

x12

x13

x23

x24

x34

x35

x45

u12

u13

u23

u24

u34

u35

u45

b1

b2

b3

b4

b5

� Kirchoff’s Current Law: The sum of the currents in to a node is

zero. For the circuit in the figure, this can be written Ax = b.

A necessary assumption is of course that∑m

j=1 bj = 0.� Kirchoff’s Voltage Law: The sum of all voltages over a cycle is equal

to zero.

Lecture Optimization on Networks 35 Optimization on networks

Page 36: 1. Minimum cost flow problems in networks 2. Modelling and ...For network flow problems the simplex algorithm is simplified in the following way: 1. Arcs corresponding to a basic

Reading instructions

Chapter 7.2 in the book.

Lecture Optimization on Networks 36 Optimization on networks