15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. ·...

18
15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 Applications Algorithms Theory Un esempio basato sulle slide della seguente lezione del Corso Network Optimization MITOpenCourseware http ://ocw.mit.edu/courses/sloan-school-of-management/15-082j-network-optimization-fall-2010/ (disponibili su licenza Creative Commons): http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode Ottimizzazione Combinatoria 2 Cammino Minimo Vincolato

Transcript of 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. ·...

Page 1: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

15.082J and 6.855J and ESD.78J

Lagrangian Relaxation 2

• Applications

• Algorithms

• Theory

Un esempio basato sulle slide della seguente lezione del

Corso Network Optimization MITOpenCoursewarehttp://ocw.mit.edu/courses/sloan-school-of-management/15-082j-network-optimization-fall-2010/

(disponibili su licenza Creative Commons):http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode

Ottimizzazione Combinatoria 2

Cammino Minimo Vincolato

Page 2: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

2

The Constrained Shortest Path Problem

(1,10)

(1,1)

(1,7)(2,3)

(10,3)

(12,3)

(2,2)

(1,2) (10,1)(5,7)

1

2 4

53

6

Find the path of minimum cost (black) from node 1

to node 6 with a transit time (red) at most 14.

Page 3: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

3

Constrained Shortest Paths: Path Formulation

Given: a network G = (N,A)

wij cost for arc (i,j)

w(P) cost of path P

tij traversal time for arc (i,j)

T upper bound on transit times.

t(P) traversal time for path P

P set of paths from node 1 to node n

(nodi 1 e 6 nell’esempio)

Min w(P)

s.t. t(P) ≤ T

P ∈ P

L(μ) = Min w(P) + u (t(P) – T)

s.t. P ∈ P

Constrained ProblemLagrangian

Page 4: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

The Lagrangian Multiplier Problem

4

L(u) = Min w(P) + u t(P) - uT

s.t. P ∈ P

L(u) = v* = Max v

s.t v ≤ w(P) + u t(P) – uT

for all P ∈ P

Step 1. Rewrite as

a maximization

problem

Step 0. Formulate

the Lagrangian

Problem.

Step 2. Write the

Lagrangian

multiplier problem

L* = max {L(u): u ≥ 0} =

= Max v

s.t v ≤ w(P) + u t(P) – u T

for all P ∈ P

u ≥ 0

Page 5: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

Per u fissato il problema lagrangiano è un problema di

cammino minimo con pesi (𝒘𝒊𝒋+𝒖𝒕𝒊𝒋)

Rappresentiamo un cammino 𝑷 con il suo vettore di

incidenza 𝒙 (𝒙𝒊𝒋 = 𝟏 ↔ 𝒊𝒋 ∈ 𝑷) e sia 𝑸𝒔𝒕 il poliedro dei

cammini minimi tra I nodi s e t (nell’esempio 1 e 6).

−𝒖𝑻 +𝒎𝒊𝒏

𝒊𝒋∈𝑨

𝒘𝒊𝒋𝒙𝒊𝒋 + 𝒖

𝒊𝒋∈𝑨

𝒕𝒊𝒋𝒙𝒊𝒋 : 𝒙 ∈ 𝑸𝒔𝒕 ∩ 𝟎, 𝟏 𝑨

Il problema corrispondente ad un fissato u si scrive:

Ovvero:

𝑳 𝒖 = −𝒖𝑻 +𝒎𝒊𝒏

𝒊𝒋∈𝑨

(𝒘𝒊𝒋+𝒖𝒕𝒊𝒋)𝒙𝒊𝒋 : 𝒙 ∈ 𝑸𝒔𝒕 ∩ 𝟎, 𝟏 𝑨

Max { v: v ≤ w(P) + u t(P) – uT ∀P ∈ P, u ≥ 0}

Page 6: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

Max { v: v ≤ w(P) + u t(P) – uT ∀P ∈ P, u ≥ 0}

(1,10)

(1,1)

(1,7)(2,3)

(10,3)

(12,3)

(2,2)

(1,2) (10,1)

(5,7)

1

2 4

53

6

(w, t) u = 0 wij

u = M>>0 wij + M tij M tij

Per ogni u una diversa istanza

del cammino minimo

u = 2.1

22

3.1

15.78.3

16.3

18.3

6.2

5.2 12.1

19.7

1

2 4

53

6

Per u fissato Cammino minimo con pesi (𝒘𝒊𝒋+𝒖𝒕𝒊𝒋)

Page 7: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

Discretizzazione del problema lagrangiano

pnxxxQ ,...,,, 2110

)( min )( min)(,...,,...,

uLAxbuxwuL k

pk

kTkT

pk 11

)Axb(uxw)u(L kTkTk

Iperpiano in 1mR

Ogni soluzione 𝒙𝒌 (cammino) definisce un iperpiano (retta)

w(P) + u (t(P) – T)

𝑳𝒌 𝒖 =

𝒊𝒋∈𝑨

𝒘𝒊𝒋𝒙𝒊𝒋𝒌 + 𝒖

𝒊𝒋∈𝑨

𝒕𝒊𝒋𝒙𝒊𝒋𝒌 − 𝑻 :

𝒙𝒌 ∈ 𝑸𝒔𝒕 ∩ 𝟎, 𝟏 𝑨

𝒙𝒌 Vettore di incidenza di un cammino s-t (1-n)

Positivo se il vincolo è violato

Page 8: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

Ogni soluzione (cammino) definisce un iperpiano (retta)

Discretizzazione del problema lagrangiano

Paths

0 1 2 3 4 5C

om

po

sit

e C

ost

Lagrange Multiplier u

0

10

20

30

-10

w(P) + u (t(P) – T)

(1,10)

(1,1)

(1,7)(2,3)

(10,3)

(12,3)

(2,2)

(1,2) (10,1)

(5,7)

1

2 4

53

61-3-4-5-6 t(P)=13

27 + u (13 – 14) [pendenza neg]

1-3-4-6 t(P)=17

(1,10)

(1,1)

(1,7)(2,3)

(10,3)

(12,3)

(2,2)

(1,2) (10,1)

(5,7)

1

2 4

53

6

16 + u (17 – 14) [pendenza pos]

Page 9: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

1-2-5-6

1-3-2-5-6

1-2-4-6

Paths

0 1 2 3 4 5

1-2-4-5-6

1-3-2-4-6

1-3-2-4-5-6

1-3-4-6 t(P)=17

1-3-4-5-6 t(P)=13

1-3-5-6

Co

mp

osit

e C

ost

Lagrange Multiplier u

Figure 16.3 The Lagrangian function for T = 14.

0

10

20

30

-10

9

L* = max (L(u): u ≥ 0)

Max { v: v ≤ w(P) + u t(P) – uT ∀P ∈ P,

and u ≥ 0}

Page 10: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

The Restricted Lagrangian

10

P : the set of paths from node 1 to node n

B ⊆ P : a subset of paths

L* = v* = max v

s.t v ≤ w(P) + u ( t(P) – T )

for all P ∈ P

u ≥ 0

L*B = max v

s.t v ≤ w(P) + u t(P) – u T

for all P ∈ B

u ≥ 0

Lagrangian Multiplier Problem Restricted Lagrangian

Multiplier Problem

L(u) ≤ L* ≤ L*B

If L(u) = L*B then L(u) = L*.

Optimality Conditions

Page 11: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

Constraint Generation for Finding L*

11

Let Path(u) be the path (iperpiano) that optimizes L(u).

Let u(B) be the value of u that optimizes LB(u).

Initialize:

B := {Path(0), Path(M)}

Is L(u(B)) = L*B?

B := B ∪ Path(u(B))

Quit. L(u(B)) = L*Yes

No

M is some large number

Page 12: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

1-2-4-6 3 + (18-14) u

Paths

0 1 2 3 4 5Lagrange Multiplier u

0

10

20

30

-10

Co

mp

os

ite C

ost

12

We start with the paths 1-2-4-6, and 1-3-5-6

which are optimal for L(0) and L(∞).

1-3-5-6 24 + (8-14) u

(2.1, 11.4)

(u(B), v(B))

Page 13: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

13

Set u(B) = 2.1 and solve the CSP problem (L(u(B) )

6.6 < 11.4 Aggiungi il path 𝑷∗ e riottimizza

𝑳 𝒖 𝑩 = −𝒖 𝑩 𝑻 +𝒘 𝑷∗ + 𝒖 𝑩 𝒕 𝑷∗ =

= −𝟐. 𝟏 ∗ 𝟏𝟒 + 𝟑𝟔 = −𝟐𝟗. 𝟒 + 𝟑𝟔 = 𝟔. 𝟔

The optimum path

𝑷∗ is 1-3-2-5-622

3.1

15.78.3

16.3

18.3

6.2

5.2 12.1

19.71

2 4

53

6

Ovvero:

(1,10)

(1,1)

(1,7)(2,3)

(10,3)

(12,3)

(2,2)

(1,2) (10,1)(5,7)

1

2 4

53

6

Costo modificato = 36

Costo = 15

T. Transito = 10

L(u(B)) = 15 + 10 u(B) – 14 u(B)

15 + 21 – 29.4 = 6.6

Page 14: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

1-2-4-6

Paths

0 1 2 3 4 5Lagrange Multiplier u

0

10

20

30

-10

Co

mp

os

ite C

ost

14

1-3-5-6

Path(2.1) = 1-3-2-5-6. Add it to S and reoptimize.

3 + 4 u

24 - 6 u1-3-2-5-6 15 - 4 u

1.5, 9

Page 15: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

15

16

2.5

11.56.5

14.5

16.5

5

4 11.5

15.51

2 4

53

6

The optimum path

𝑷∗ is 1-2-5-6.

L(u(B)) = 5 + 15 u(B) – 14 u(B)

5 + 22.5 – 21 = 6.5

6.5 < 9 Aggiungi il path 𝑷∗ e riottimizza

(1,10)

(1,1)

(1,7)(2,3)

(10,3)

(12,3)

(2,2)

(1,2) (10,1)(5,7)

1

2 4

53

6

Costo modificato = 27.5

Costo = 5

T. Transito = 15

Set u(B) = 1.5 and solve the CSP problem (L(u(B) )

Page 16: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

1-2-4-6

Paths

0 1 2 3 4 5Lagrange Multiplier u

0

10

20

30

-10

Co

mp

os

ite C

ost

16

1-3-5-6

Add Path 1-2-5-6 and reoptimize

3 + 4 u

24 - 6 u1-3-2-5-6 15 - 4 u

1-2-5-6 5 + u

2, 7

Page 17: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

17

21

3

158

16

18

6

5 12

191

2 4

53

6

The optimum paths are

1-2-5-6 and 1-3-2-5-6

L(u(B)) = 5 + 15 u(B) – 14 u(B)

= 5 + 30 – 28 = 7

7 = v(B) = 7Ottimo del Duale

Lagrangiano

Scegliamo 1-2-5-6

(1,10)

(1,1)

(1,7)(2,3)

(10,3)

(12,3)

(2,2)

(1,2) (10,1)(5,7)

1

2 4

53

6

Costo modificato = 35

Costo = 5

T. Transito = 15

Set u(B) = 2 and solve the CSP problem (L(u(B) )

Page 18: 15.082J and 6.855J and ESD - uniroma1.itsassano/Slides/OCO2_2016/OCO2_Open... · 2019. 5. 14. · 15.082J and 6.855J and ESD.78J Lagrangian Relaxation 2 ... 15.082 Spring 1998 Author:

1-2-4-6

Paths

0 1 2 3 4 5Lagrange Multiplier u

0

10

20

30

-10

Co

mp

os

ite C

ost

18

1-3-5-6

There are no new paths to add.

u(B) = u* is optimal for the multiplier problem

3 + 4 u

24 - 6 u1-3-2-5-6 15 - 4 u

1-2-5-6 5 + u

2, 7