CVEN 4402 - Workshop - Week 7

50
CVEN 4402/9414 – Network Analysis Workshop – Week 7 User Equilibrium Solution Methods: Method of Successive Averages (MSA) and The Franke-Wolfe Method Milad Ghasri Sisi Jian Neeraj Saxeena Kasun Wijayaratna

description

444

Transcript of CVEN 4402 - Workshop - Week 7

Slide 1

CVEN 4402/9414 Network AnalysisWorkshop Week 7

User Equilibrium Solution Methods: Method of Successive Averages (MSA) and The Franke-Wolfe Method

Milad Ghasri

Sisi Jian

Neeraj Saxeena

Kasun Wijayaratna

Method of Successive Averages (MSA)

A gradient decent optimisation method used to solve problems given a set of constraints

Based on the principle of calculating the gradient at a specific point, and then finding the solution which most decreases the objective function along that direction

Easier to apply, but (very) slow to converge

Question 1 - MSA

Hints and Help

The outline of the MSA algorithm is as follows:

Choose an initial solution, x0

For iteration i, evaluate the gradient of the objective function at xi-1, which will be

Find the new vector that minimizes the product subject to the original constraints.

Set

Repeat 2-4 until convergence.

Consider the following problem:

s.t.

Solve this problem using MSA and the Frank Wolfe algorithm.

MSA Iteration 1

Step 1: Choose starting place x0 = 0

Step 2: Evaluate gradient at x0

Step 3: Minimize product subject to constraints

Step 4: Set x1 according to average rule

MSA Iteration 2

Step 1: Evaluate gradient at x1

Step 2: Minimize product

Step 3: Set x2

MSA Iteration 3

Step 1: Evaluate gradient at x2

Step 2: Minimize product

Step 3: Set x3

MSA Iteration 4

Step 1: Evaluate gradient at x3

Step 2: Minimize product

Step 3: Set x4

MSA

And so on and so forth...

SLOW TO CONVERGE

We know optimal solution is -2, but even after 1100 iterations, this algorithm is still varying- (see iterations 1130-1140)

Good for difficult objective functions but simple derivative/gradients

2.0062

1.9912

1.9982

2.0053

1.9901

1.9974

2.0044

1.9894

1.9965

2.0035

1.9886

Question 1 Frank Wolfe

Hints and Help

The outline of the FW algorithm is as follows:

Choose an initial solution, x0

For iteration i, evaluate the gradient of the objective function at xi-1, which will be

Find the new vector that minimizes the product subject to the original constraints.

Find the value of that minimizes the expression using bisection method or golden section method.

Repeat 2-4 until convergence.

Consider the following problem:

s.t.

Solve this problem using MSA and the Frank Wolfe algorithm.

Frank Wolfe Iteration 1

Step 1: Choose starting place x0 = 0

Step 2: Evaluate gradient at x0

Step 3: Minimize product

Step 4: Find that minimizes expression below, to determine x1

Step 4:

Optimal!

Frank Wolfe Iteration 1

and

UE Mathematical Programming Formulation and Optimality Conditions

This is the objective function

subject to

These are the constraints

**This entire formulation (objective function + constraints) is a program (can be called other things as well!)

A

means for each

ta is the cost function on link a

f is the flow on path k for OD pair rs

q is the demand for OD pair rs

x is the flow on link a

Question 2 Using MSA

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Assume that there are 10 units traveling from 1-4, and 10 units traveling from 1-5

Determine equilibrium flows using MSA

Approach to using MSA:

Begin. Set X1 = 0 , n = 1

While (error > convergence)

Update link costs Cn using link flows Xn

Find shortest path for each OD pair and assign auxiliary flow vector X*

Update link flows Xn+1 according to the rule and increment iteration counter n

(Check convergence criterion)

MSA determination of next iterations flow vector:

MSA Iteration 1

Substituting zero flows into the cost functions and look for shortest paths

Shortest Path for 1 to 5

Shortest Path for 1 to 4

MSA Iteration 1

1

2

3

4

5

3

1

1

2

1

2

PathXnCnX*Xn+11-2-41-2-3-5-41-3-5-41-3-51-2-3-5

Shortest Path for 1 to 5

Shortest Path for 1 to 4

MSA Iteration 1

1

2

3

4

5

3

1

1

2

1

2

Shortest Path for 1 to 5

Shortest Path for 1 to 4

PathXnCnX*Xn+11-2-4051-2-3-5-4071-3-5-4041-3-5021-2-3-505

MSA Iteration 1

1

2

3

4

5

3

1

1

2

1

2

Shortest Path for 1 to 5

Shortest Path for 1 to 4

PathXnCnX*Xn+11-2-405001-2-3-5-407001-3-5-40410101-3-50210101-2-3-50500

MSA Iteration 2

Recalculate link costs and path costs

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

PathXnCnX*Xn+11-2-401-2-3-5-401-3-5-4101-3-5101-2-3-50

MSA Iteration 2

1

2

3

4

5

3

41

1

2

61

32

Shortest Path for 1 to 4

Shortest Path for 1 to 5

PathXnCnX*Xn+11-2-4051-2-3-5-40971-3-5-4101341-3-5101021-2-3-5065

MSA Iteration 2

1

2

3

4

5

3

41

1

2

61

32

Shortest Path for 1 to 4

Shortest Path for 1 to 5

Assign flow to SP

PathXnCnX*Xn+11-2-405101-2-3-5-409701-3-5-41013401-3-51010201-2-3-506510

MSA Iteration 2

1

2

3

4

5

3

41

1

2

61

32

Shortest Path for 1 to 4

Shortest Path for 1 to 5

Adjust flow

PathXnCnX*Xn+11-2-4051051-2-3-5-4097001-3-5-410134051-3-510102051-2-3-5065105

MSA Iteration 3

Recalculate link costs and path costs

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

PathXnCnX*Xn+11-2-451-2-3-5-401-3-5-451-3-551-2-3-55

MSA Iteration 3

1

2

3

4

5

13

21

11

7

46

17

Shortest Path for 1 to 5

Shortest Path for 1 to 4

PathXnCnX*Xn+11-2-45201-2-3-5-40871-3-5-45841-3-55671-2-3-5570

MSA Iteration 3

1

2

3

4

5

13

21

11

7

46

17

Assign flow to SP

Shortest Path for 1 to 5

Shortest Path for 1 to 4

PathXnCnX*Xn+11-2-4520101-2-3-5-408701-3-5-458401-3-5567101-2-3-55700

MSA Iteration 3

1

2

3

4

5

13

21

11

7

46

17

Adjust flow

Shortest Path for 1 to 5

Shortest Path for 1 to 4

PathXnCnX*Xn+11-2-4520106.666666671-2-3-5-4087001-3-5-458403.333333331-3-5567106.666666671-2-3-557003.33333333

MSA Iteration 4

Recalculate link costs and path costs

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

PathXnCnX*Xn+11-2-46.666666671-2-3-5-401-3-5-43.333333331-3-56.666666671-2-3-53.33333333

MSA Iteration 4

Assign flow to SP

PathXnCnX*Xn+11-2-46.6666666721.666671-2-3-5-4073.666671-3-5-43.33333333741-3-56.66666667621-2-3-53.3333333361.66667

MSA Iteration 4

Assign flow to SP

Shortest Path for 1 to 4

Shortest Path for 1 to 5

PathXnCnX*Xn+11-2-46.6666666721.66667101-2-3-5-4073.6666701-3-5-43.333333337401-3-56.666666676201-2-3-53.3333333361.6666710

MSA Iteration 4

Recalculate xi

Shortest Path for 1 to 4

Shortest Path for 1 to 5

And we continue to do this procedure until convergence. The convergence of the algorithm will be seen when the change between solution "n" and solution "n+1" is small enough.

PathXnCnX*Xn+11-2-46.6666666721.66667107.51-2-3-5-4073.66667001-3-5-43.333333337402.51-3-56.6666666762051-2-3-53.3333333361.66667105

Frank Wolfe

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Approach to using Frank Wolfe:

Begin. Set X1 = 0 , n = 1

While (error > convergence)

Update link costs Cn using link flows Xn

Find shortest path for each OD pair and assign auxiliary flow vector X*

Determine optimal by solving sub problem

Update link flows Xn+1 according to the rule and increment iteration counter n

(Check convergence criterion)

**Question to consider: what is the difference between link flows and path flows?

Beginning Frank Wolfe

One suggestion for how to keep track of values:

Use two tables, one for path values and one for link values

1

2

3

4

5

LinkXnCnX*Xn+11-21-32-32-43-55-4PathCosts CnFbar1-2-41-2-3-5-41-3-5-41-3-51-2-3-5

Beginning Frank Wolfe

Set flows equal to 0 so X1 = F1 = 0

Set iteration counter n = 1

1

2

3

4

5

3

1

1

2

1

2

LinkXnCnX*Xn+11-21-32-32-43-55-4PathCosts CnFbar1-2-41-2-3-5-41-3-5-41-3-51-2-3-5

Need to go over this problem on a piece of paper next slide just has all the solutions!

32

Frank Wolfe iteration 1

n =1

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-2031-3012-3012-4023-5015-402PathCosts CnFbar1-2-451-2-3-5-471-3-5-441-3-521-2-3-55

for n=1 will be 1! Think about it

Increment counter so n=2

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Initially we start off with no flow so to ensure demand conservation we need to assign all the demand to the first shortest paths this will serve as the starting point for iteration 2, i.e. for n = 2, Xn+1 = X* meaning lambda must be 1!

Frank Wolfe iteration 1

n =1

Update costs and assign auxiliary flow vector

Find (here will be 1!)

Update flow vector

LinkXnCnX*Xn+11-203001-30120202-301002-402003-50120205-4021010PathCosts CnFbar1-2-4501-2-3-5-4701-3-5-44101-3-52101-2-3-550

Increment counter so n=2

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe iteration 2

n =2

Update costs and assign auxiliary flow vector

LinkXnCnX*Xn+11-201-3202-302-403-5205-410PathCosts CnFbar1-2-41-2-3-5-41-3-5-41-3-51-2-3-5

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe iteration 2

n =2

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-203201-3204102-301102-402103-52061105-410320PathCosts CnFbar1-2-45101-2-3-5-49701-3-5-413401-3-510201-2-3-56510

Now find

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe Iteration 2

Remember we are considering the sum of the integrations of all the cost functions for example considering the link from 1 to 2:

Solving the subproblem

Frank Wolfe Iteration 2

Solving the subproblem

To minimise our objective function

Alternatively we could use the pre-computed derivative formulae where no integration is required.

where

Frank Wolfe iteration 2

n =2

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-2032015.809521-3204104.1904762-301107.9047622-402107.9047623-520611012.095245-4103202.095238PathCosts CnFbar1-2-45101-2-3-5-49701-3-5-413401-3-510201-2-3-56510

= 0.79048

Increment counter so n=3

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe iteration 3

n =3

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-215.809521-34.1904762-37.9047622-47.9047623-512.095245-42.095238PathCosts CnFbar1-2-41-2-3-5-41-3-5-41-3-51-2-3-5

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe iteration 3

n =3

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-215.8095218.809521-34.1904769.3809522-37.90476216.809522-47.9047629.9047623-512.0952437.285715-42.0952388.285714PathCosts CnFbar1-2-428.714291-2-3-5-481.190481-3-5-454.952381-3-546.666671-2-3-572.90476

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe iteration 3

n =3

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-215.8095218.80952101-34.1904769.380952102-37.90476216.8095202-47.9047629.904762103-512.0952437.28571105-42.0952388.2857140PathCosts CnFbar1-2-428.71429101-2-3-5-481.1904801-3-5-454.9523801-3-546.66667101-2-3-572.904760

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe Iteration 3

Solving the subproblem

LinkXX*ABlamda1-lamdalamda2(1-lamda)22*X*X**B1-21-32 -32-43-55-4SUM =

You can minimise the above by using golden section method or bisection method with the following structure on a spreadsheet if you want

Frank Wolfe Iteration 3

Solving the subproblem

> 1, so set = 1 as this indicates Xn solution was no where near equilibrium so just use the new all or nothing assignment of flows

Frank Wolfe iteration 3

n =3

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-215.8095218.8095210101-34.1904769.38095210102-37.90476216.80952002-47.9047629.90476210103-512.0952437.2857110105-42.0952388.28571400PathCosts CnFbar1-2-428.71429101-2-3-5-481.1904801-3-5-454.9523801-3-546.66667101-2-3-572.904760

Increment counter so n=4

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

=1

Frank Wolfe iteration 4

n =4

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-2101-3102-302-4103-5105-40PathCosts CnFbar1-2-41-2-3-5-41-3-5-41-3-51-2-3-5

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe iteration 4

n =4

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-21013201-3102102-301102-41012103-51031105-4020PathCosts CnFbar1-2-425101-2-3-5-44701-3-5-45401-3-55201-2-3-54510

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

Frank Wolfe Iteration 4

Solving the subproblem

Frank Wolfe iteration 4

n =4

Update costs and assign auxiliary flow vector

Find

Update flow vector

LinkXnCnX*Xn+11-210132011.41-3102108.62-301101.42-4101210103-5103110105-40200PathCosts CnFbar1-2-425101-2-3-5-44701-3-5-45401-3-55201-2-3-54510

Increment counter so n=5

How do we prove equilibrium conditions?

1

2

3

4

5

3+x12

1+2x13

1+2x23

2+x24

1+3x35

2+3x54

=0.14

Knowing when we are at equilibrium

PathCostFlow1-2-426.4101-2-3-5-451.201-3-5-451.201-3-549.21.41-2-3-549.28.6

Paths to Node 4

Paths to Node 5

We can show that these paths are an equilibrium solution in a couple of different ways:

Definition of equilibrium: Only paths with minimum cost for each OD are being used.

Optimality conditions are satisfied

Continuing the Frank Wolfe Algorithm: If we continue to the next iteration of the algorithm, we will find that the optimal value of the subproblem will be = 0, which means that no flow will switch to the new solution meaning that the solution is optimal (i.e. equilibrium flow conditions)

FF!

!

.

0

0

!

s.t.

.

!

!

=-

',&

.

!

0 .,',&

,

!

=.

!

-

!

!

.

s.t.

12345

.

13217.6666678.666674112

1

2

3

4

5

.

13

21

7.666667

8.66667

41

12

1

2

3

4

5

.

13

21

7.666667

8.66667

41

12

1

2

3

4

5

.

13

21

7.666667

8.66667

41

12