Sei sulla pagina 1di 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

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

Consider
the following problem:

s.t.

Solve this problem using MSA and the Frank Wolfe


algorithm.
Hints and Help
The outline of the MSA algorithm is as follows:
1. Choose an initial solution, x0
2. For iteration i, evaluate the gradient of the
objective function at xi-1, which will be
3. Find the new vector that minimizes the
product subject to the original constraints.
4. Set
5. Repeat 2-4 until convergence.

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

Consider
the following problem:

s.t.

Solve this problem using MSA and the Frank Wolfe


algorithm.
Hints and Help
The outline of the FW algorithm is as follows:
1. Choose an initial solution, x0
2. For iteration i, evaluate the gradient of the
objective function at xi-1, which will be
3. Find the new vector that minimizes the
product subject to the original constraints.
4. Find the value of that minimizes the
expression using bisection method or
golden section method.
5. Repeat 2-4 until convergence.

Frank Wolfe Iteration 1


1: Choose starting place x0 = 0
Step

Step 2: Evaluate gradient at x0

Step 3: Minimize product

Step 4: Find that minimizes expression


below, to determine x1

Frank Wolfe Iteration 1


Step 4:

and

Optimal!

UE Mathematical Programming
Formulation and Optimality Conditions

subject to

means for
each

This is the
objective
function

ta is the cost function on link a


f is the flow on path k for OD p
rs
q is the demand for OD pair rs
x is the flow on link a

These are the


constraints

**This entire formulation (objective function + constraints) is a program (can be called


other things as well!)

Question 2 Using MSA


2

2+x24

3+x12

1+2x23

2+3x54

1+2x13
3

1+3x35

Assume that there


are 10 units
traveling from 1-4,
and 10 units
traveling from 1-5
Determine
equilibrium flows
using MSA
MSA determination of
next iterations flow
vector:

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 Iteration 1
Substituting zero flows into the cost functions and look for
shortest paths

Short
est
Path
for 1
to 4
Short
est
Path
for 1
to 5

MSA Iteration 1
2

3
1

Short
est
Path
for 1
to 5

Short
est
Path
for 1
to 4

1
3

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn

X*

Xn+1

MSA Iteration 1
2

3
1

Short
est
Path
for 1
to 5

Short
est
Path
for 1
to 4

1
3

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn

X*

Xn+1

MSA Iteration 1
2

3
1

Short
est
Path
for 1
to 5

Short
est
Path
for 1
to 4

1
3

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn

X*

Xn+1

0
0
0
0

7
4
2
5

0
10
10
0

0
10
10
0

MSA Iteration 2
2

2+x24

Recalculate link costs and


path costs

3+x12

1+2x23

2+3x54

1+2x13
1+3x35
3

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn
0
0

10
10
0

X*

Xn+1

MSA Iteration 2
Shortest
Path for
1 to 4

1
Shortest
Path for
1 to 5

32

41
3

61

5
Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn

X*

97

10

134

10

102

65

Xn+1

MSA Iteration 2
Shortest
Path for
1 to 4

Assign flow to SP

1
Shortest
Path for
1 to 5

32

41
3

61

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn

X*

Xn+1

10

97

10

134

10

102

MSA Iteration 2
Shortest
Path for
1 to 4

Adjust flow

1
Shortest
Path for
1 to 5

32

41
3

61

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn

X*

Xn+1

10

0
10
10
0

97
134
102
65

0
0
0
10

0
5
5
5

MSA Iteration 3
2

2+x24

Recalculate link costs and


path costs

3+x12

1+2x23

2+3x54

1+2x13
1+3x35
3

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn
5
0
5
5

X*

Xn+1

MSA Iteration 3
Shortest
Path for
1 to 4

13
1
Short
est
Path
for 1
to 5

11

17

21
3

46

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn
5

20

87

84

67

X*

Xn+1

MSA Iteration 3
Shortest
Path for
1 to 4

13

Assign flow to SP

1
Short
est
Path
for 1
to 5

11

17

21
3

46

Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5

Xn

Cn

X*

Xn+1

20

10

87

84

67

10

MSA Iteration 3
Shortest
Path for
1 to 4

13

Adjust flow

1
Short
est
Path
for 1
to 5

11

17

21
3

46

Path
1-2-4
1-2-35-4
1-3-5-4

Xn

Cn

X*

Xn+1

20

10

87

84

67

10

1-3-5

6.666666
67
0
3.333333
33
6.666666
67

MSA Iteration 4
2

2+x24

Recalculate link costs and


path costs

3+x12

1+2x23

2+3x54

1+2x13
1+3x35
3

Path
1-2-4
1-2-3-5-4
1-3-5-4
1-3-5

Xn
6.666666
67
0
3.333333
33
6.666666
67

Cn

X*

Xn+1

MSA Iteration 4

Assign flow to SP

Path
1-2-4
1-2-3-5-4
1-3-5-4
1-3-5

Xn

Cn

6.666666
21.66667
67
0 73.66667
3.333333
74
33
6.666666
62
67

X*

Xn+1

MSA Iteration 4
Shortest
Path for
1 to 4

Assign flow to SP

Shortest
Path for
1 to 5

Path
1-2-4
1-2-3-5-4
1-3-5-4
1-3-5

Xn

Cn

6.666666
21.66667 10
67
0 73.66667 0
3.333333
74
0
33
6.666666
62
0
67

X*

Xn+1

MSA Iteration 4
Shortest
Path for
1 to 4

Recalculate xi

Shortest
Path for
1 to 5

Path
1-2-4
1-2-3-5-4
1-3-5-4
1-3-5
1-2-3-5

Xn
6.666666
67
0
3.333333
33
6.666666
67
3.333333

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
Cn
X*
Xn+1
enough.

21.66667 10

7.5

73.66667 0

74

2.5

62

Frank Wolfe
2

2+x24

3+x12
1

1+2x23

2+3x54

1+2x13
1+3x35
Approach to using Frank Wolfe:
3
5
1
Begin. Set X = 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
Path

Costs
Cn

Fbar

1-2-4

1-2-35-4
1-3-5-4
Link
1-3-5
1-2
1-2-3-5
1-3
2-3
2-4
3-5
5-4

Xn

Cn

X*

Xn+1

Beginning Frank Wolfe


Set flows equal to 0 so X1 = F1 = 0
Set iteration counter n = 1

Path

Costs
Cn

Fbar

1-2-4

1-2-35-4
1-3-5-4
Link
1-3-5
1-2
1-2-3-5
1-3
2-3
2-4
3-5
5-4

Xn

Cn

X*

Xn+1
3

Frank Wolfe iteration 1


n =1
Update costs and assign auxiliary
flow vector
Find
Update flow vector
Path

Costs
Cn

1-2-4

Fbar

1-3-5-4

1+2x23

Link
1-3-5
1-2
1-2-3-5

C
3

1-3

X 2
0 5
0

2-3

2-4

3-5

5-4

X*

n+1

2+x24

3+x12

1+2x13

1-2-35-4
n

1+3x35

2+3x54

for n=1 will be 1! Think about


it

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!

Increment counter so
n=2

Frank Wolfe iteration 1


n =1
Update costs and assign auxiliary
flow vector
Find (here will be 1!)
Update flow vector
Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5
Link
1-2
1-3
2-3
2-4
3-5
5-4

Costs
Cn
5

Fbar
0

7
4
2
Xn 5
0
0
0
0
0
0

Cn
3
1
1
2
1
2

1+2x23

Xn+1
0
20
0
0
20
10

2+x24

3+x12

1+2x13

0
10
10
0 X*
0
20
0
0
20
10

1+3x35

2+3x54

Increment counter so
n=2

Frank Wolfe iteration 2


n =2
Update costs and assign auxiliary
flow vector

Path

Costs
Cn

1-2-4

1+2x23

1+2x13

1-2-35-4

1-3-5-4
Link
1-3-5
1-2
1-2-3-5

Xn
0

1-3

20

2-3

2-4

3-5

20

5-4

10

Cn

X*

Xn+1

3+x12

Fbar

2+x24

1+3x35

2+3x54

Frank Wolfe iteration 2


n =2
Update costs and assign auxiliary
flow vector
Find
Update flow vector
Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5
Link
1-2

Costs
Cn
5

Fbar
10

97

1+2x23

134
102
Xn65
0

0
0
Cn 10 X*
3
20

1-3

20

41

2-3

10

2-4

10

3-5

20

61

10

5-4

10

32

3+x12

1+2x13

2+x24

Xn+1

Now find

1+3x35

2+3x54

Frank Wolfe Iteration 2

Solving
the
subprobl
em

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

Frank Wolfe Iteration 2


Solving
the
subprobl
em

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
Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5
Link

Costs
Cn
5

Fbar

1+2x23

1+2x13

134
102
65
Xn

0
0
10
Cn

X*

1-2

20

1-3

20

41

2-3

10

2-4

10

3+x12

10

97

2+x24

1+3x35

2+3x54

Xn+1
15.8095
2
4.19047
6
7.90476
2
7.90476
2
12.0952

= 0.79048

Increment counter so
n=3

Frank Wolfe iteration 3


n =3
Update costs and assign auxiliary
flow vector
Find
Update flow vector
Path

Costs
Cn

Fbar

1-2-35-4

1-3-5-4
1-2
1-2-3-5
1-3
2-3
2-4

1+2x23

1+2x13

Xn
15.8095
2
4.19047
6
7.90476
2
7.90476
2
12.0952

Cn

X*

3+x12

1-2-4

Link
1-3-5

2+x24

Xn+1

1+3x35

2+3x54

Frank Wolfe iteration 3


n =3
Update costs and assign auxiliary
flow vector
Find
Update flow vector
Path
1-2-4
1-2-35-4
1-3-5-4
Link
1-3-5
1-2
1-2-3-5
1-3
2-3
2-4

Costs
Cn

28.7142
9
81.1904
8
54.9523
8n
X
46.6666
15.8095
7
2
72.9047
4.19047
6
6
7.90476
2
7.90476
2
12.0952

Fbar

1+2x23

18.8095
2
9.38095
2
16.8095
2
9.90476
2
37.2857

X*

3+x12

1+2x13

Cn

2+x24

Xn+1

1+3x35

2+3x54

Frank Wolfe iteration 3


n =3
Update costs and assign auxiliary
flow vector
Find
Update flow vector
Path
1-2-4
1-2-35-4
1-3-5-4
Link
1-3-5
1-2
1-2-3-5
1-3
2-3
2-4

Costs
Cn

28.7142
9
81.1904
8
54.9523
8n
X
46.6666
15.8095
7
2
72.9047
4.19047
6
6
7.90476
2
7.90476
2
12.0952

Fbar

2
9.38095
0
2
16.8095
2
9.90476
2
37.2857

1+2x23

1+2x13

X*

10
10
0
10

3+x12

10

0
Cn
18.8095
10

2+x24

Xn+1

1+3x35

2+3x54

Frank Wolfe Iteration 3


Solving the subproblem

You can minimise the above by using golden section method


or bisection method with the following structure on a
spreadsheet if you want
2

Link
1-2
1-3
2 -3
2-4
3-5
5-4

X*

lamda

1-lamda

lamda

(1-lamda)2 2*X*X**B

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

Frank Wolfe iteration 3


n =3
Update costs and assign auxiliary
flow vector
Find
Update flow vector
Path
1-2-4
1-2-35-4
1-3-5-4
Link
1-3-5
1-2
1-2-3-5
1-3
2-3
2-4

Costs
Cn

28.7142
9
81.1904
8
54.9523
8n
X
46.6666
15.8095
7
2
72.9047
4.19047
6
6
7.90476
2
7.90476
2
12.0952

1+2x23

1+2x13

10

2
9.38095
0
2
16.8095
2
9.90476
2
37.2857

3+x12

Fbar

0
Cn
18.8095
10

2+x24

X*

Xn+1

10

10

10

10

10

10
10

1+3x35

2+3x54

=1

Increment counter so
n=4

Frank Wolfe iteration 4


n =4
Update costs and assign auxiliary
flow vector
Find
Update flow vector
Path

Costs
Cn

Fbar

1+2x23

1+2x13

1-2-35-4

1-3-5-4
Xn

1-3

10

2-3

2-4

10

3-5

10

5-4

10

Cn

X*

3+x12

1-2-4

Link
1-3-5
1-2
1-2-3-5

2+x24

Xn+1

1+3x35

2+3x54

Frank Wolfe iteration 4


n =4
Update costs and assign auxiliary
flow vector
Find
Update flow vector
Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5
Link
1-2

Costs
Cn
25

Fbar

1+2x23

1+2x13

54
52
45
Xn

0
0
10
Cn

X*

10

13

20

1-3

10

21

2-3

10

2-4

10

12

10

3-5

10

31

10

5-4

3+x12

10

47

2+x24

Xn+1

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
Path
1-2-4
1-2-35-4
1-3-5-4
1-3-5
1-2-3-5
Link
1-2

Costs
Cn
25

10
0

54
52
45
Xn

0
0
10
Cn

10

13

1-3

10

21

2-3

2-4

10

12

3-5

10

31

5-4

1+2x23

1+2x13
3

X*

20
0
10
10
10
0

3+x12

Fbar

47

2+x24

Xn+1
11.4
8.6

1+3x35

2+3x54

=0.1
4

1.4
10
10
0

Increment counter so
n=5
How do we prove
equilibrium conditions?

Knowing when we are at


equilibrium
Path

Cost

Flow

1-2-4

26.4

10

1-2-3-5-4

51.2

1-3-5-4

51.2

1-3-5

49.2

1.4

1-2-3-5

49.2

8.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)