# Traffic Flow Modelling OD Origin Destination

```Traffic Flow Modelling & Control
Origin-Destination Estimation and Traffic Assignment
Dr. Apostolos Kotsialos
School of Engineering
& Computing Sciences
Tel: 0191 334 2399
Fax: 0191 334 2408
E-mail: [email protected]
March 7, 2014
Contents
Objectives:
• to introduce the notion of the Origin-Destination 1 Introduction
(OD) matrix;
2 The OD Estimation Problem
• to describe the problem of OD estimation;
2.1 The OD Structure and Information . .
2.2 Static OD Estimation . . . . . . . . . .
• to introduce the notion of traffic assignment;
2.3 Dynamic OD Estimation in a Roundabout . . . . . . . . . . . . . . . . . . .
• to introduce the notions of user and system optimum.
3 The Traffic Assignement Problem
3.1 The Basic Setting . . . . . . . . . . . .
Learning outcomes:
3.2 User Optimum for the Single-Origin–
Single-Destination Network . . . . . .
• to understand the idea of the OD matrix in the
3.3 System Optimum for the Singletraffic management framework;
Origin–Single-Destination Network .
• be able to estimate a static OD matrix based on
the ideas of minimising its distance from a prior
matrix;
1 Introduction
1
.
.
2
2
3
.
5
.
6
6
.
7
.
7
• be able to estimate a static OD matrix based on
In terms of Figure 1, this lecture is concerned with
the ideas of maximising entropy;
the problem of estimating two of the possible distur• understand the use of Kalman Filter for dynamic bances to the traffic flow process, hence the methods that are discussed here can be placed into the
OD estimation;
“Surveillance” module. These two disturbances are
• to be able to calculate the system and user op- the Origin-Destination (OD) matrix and the traffic
timums for the single-origin–single-destination assignment.
network with known travel times as a function
Since both are considered as disturbances, they
of volume.
cannot be controlled, but they can be estimated and
1
Figure 2: A general road network with origins and destinations.
Table 1: OD matrix structure
Dest. 1 Dest. 2 ...
Dest. M
Origin 1
d1,1
d1,2
. . . d1,M
Origin 2
d2,1
d2,2
. . . d2,M
...
Origin N dN,1
dN,2
. . . dN,M
Figure 1: The traffic control loop.
predicted by use of traffic sensors. The OD estimation/prediction and the traffic assignment problems are coupled, in the sense that that they are
complementary. The OD provides information that
describes the interaction between the road traffic
system and its environment, i.e. it refers to the
boundary between the network and the environment
that generates demand and supply. The traffic assignment problem is concerned with modelling the
drivers’ route choices inside the network. This behaviour is formed from knowledge and past experience, but can also be formed in such a way so
as to serve a certain purpose. In this case, the
traffic assignment problem becomes a traffic control
problem, rather than a disturbance estimation and
prediction problem. Hence, the traffic assignment
can emerge from drivers’ own experience and understanding (disturbance) or can be guided to an optimum one (control).
What is necessary here is to understand the area
of relevance of the OD and traffic assignment problems. ODs describe what happens at the network
boundaries. Traffic assignment describes what happens inside the network. The OD estimation problem
is described in section 2 and the traffic assignment
problem in section 3.
2
2.1
origin to the destination. This means that an origin
can be associated with many destinations, as there
may be many different routes towards a number of
destinations. In order to organise this information
the notion of the OD matrix is used.
Let us assume that the general network of Figure
2 has N origins and M destinations. Traffic volumes di,j originate at an origin i having j as destination. Since there may be many destinations reachable from i, grouped together into the set Ai the total
flow measured by and inductive loop detection station placed at the origin’s entrance, qi is given by
X
di,j .
(1)
qi =
j∈Ai
The OD matrix has the structure of Table 1. Some
of the entries in the OD matrix may be zero due to
two reasons. First if there is no feasible route from a
specific origin to a specific destination and second, if
the location of the origin is very close to the location
of the destination so it makes no sense to do the trip
(except in some special cases).
Furthermore, there are two equivalent ways of filling out the matrix’s entries. In the first one, the entries di,j represent traffic subflows of the total flow
qi originating at i and have flow units, e.g. veh/h or
veh/min. In the second case, the entries are pure
numbers and they represent the percentages ϑi,j of
the total traffic flow qi that is destined to j . Obviously the two representations are equivalent because
The OD Estimation Problem
The OD Structure and Information
Let us consider the general road network shown in
Figure 2. This network consists of links, junctions
and also points, shown as nodes, where the traffic
demand originates (origins) and points where the demand is heading. An origin is associated with a destination if there is at least one feasible route from the
Dr. A. Kotsialos
di,j = ϑi,j qi .
2
(2)
TFMC, 2013–2014
The OD matrix is not necessarily constant and in fact
it changes over time. This is manifested more vividly
when comparing the OD patterns in the morning
peak hours when drivers are commuting towards
their workplace and the evening peak hours when
drivers are returning back home.
The OD information is used for different applications, including:
• Transportation planning (e.g. for designing public transport routes).
• Forecasting/Modelling (e.g. for predicting the
flows the development of a shopping mall will
Figure 3: A network link used by flows from many origins
create (gravitational models)).
to different destinations.
• Control (e.g. for real time route guidance).
It may be measured directly by using
number of subflows di,j (unknown) which have originated at origin i and are heading to destination j
and are using link m. Let pm
ij denote the percentage
of the volume dij that uses link m to reach destination j (alternative routes may be feasible to be used),
hence 0 ≤ pm
ij ≤ 1. Then
X
qm =
pm
(3)
ij dij .
• toll networks;
• route guidance systems;
• license plate surveys (automated or not).
(i,j)
If they are not measured directly, then they need to
be estimated based on traffic volume measurements.
The problem of the OD matrix estimation consists of
estimating and tracking over time, the quantities qi,j
or ϑi,j based on measurements from the origins and
from internal network points. Static or dynamic estimation problem formulations can be used depending
on the user requirements.
pm
ij
The fractions
are considered for every network
link m, they describe the traffic assignment in the
network, i.e. how each route is utilised. If the
fractions they are known, then there are linear constraints in the problem and the OD estimation problem takes the form
q=P·d
2.2
where q is a vector where the measured link flows
are organised, P is a matrix of routing fractions,
which depends on the network topology structure
and knowledge of the pm
i.j s and d is the vector of unknown OD subflows. If pm
i,j are unknown, they they
have to be estimated along with the OD demands,
which results to a nonlinear problem formulation. If
they are known, then (4) is a system of linear equations, which most often than not has more unknowns
than equations.
Let us consider the example network shown in
Figure 4. Nodes 1 and 2 are origins where demand originates towards reachable destinations at
nodes 3 and 4. Link junctions are also indicated as
nodes. In some (not all) links, there are detection stations which provide traffic flow measurements. The
link defined by nodes 1 and 5 has volume q1,5 =
8; the units can represent veh/h or 1000×veh/h or
veh/30min etc. Two more measurements are known,
q5,6 = 15 and q6,3 = 10. The OD matrix for this system has the following form.
d1,3 d1,4
OD =
.
(5)
d2,3 d2,4
Static OD Estimation
The static OD problem is concerned with estimating
an OD matrix that does not change over the considered time horizon. The solutio to this problem is
based on available historical measurements. The basic problem encountered is that in most cases there
are less measurements available than required OD
information. This results to a system of equations
where the number of equations is lower than number of unknowns
The literature offers a wide range of approaches
and methodologies. A basic approach consists of comparing a revised OD matrix to a prior known matrix.
In this case, the objective is the minimisation of the
distance between the updated and the prior matrices, The distance is defined as the sum of the squared
differences between corresponding entries in the two
matrices. The solution possibly can be combined
with traffic assignment considerations (route choice).
Let us consider the network shown in Figure 3,
with N origins and M destinations. Assume that the
traffic volume qm of link m is known, i.e. is measured
(e.g. by loop detectors). This total flow consists of a
Dr. A. Kotsialos
(4)
3
TFMC, 2013–2014
the outcome of an optimisation problem which aims
at minimising the distance between the new OD estimate and the prior one. The optimisation problem
in this case is as follows.
min1,5 J =
di,j ,p1,3
Figure 4: Example network for static OD estimation, [3].
(6)
q5,6 = 15 = p1,5
1,3 d1,3 + d1,4 + d2,3 + d2,4
(7)
q6,3 = 10 =
p1,5
1,3 d1,3
+ d2,3 .
dpi,j − di,j
2
wi,j
(10)
(i,j)
subject to
eqns. (6)–(8)
di,j ≥ 0
(11)
p1,5
1,3
(12)
0≤
≤1
where dpi,j is the prior OD matrix entry for the flow
from i to j and wi,j are weights that assign different
degrees of importance to certain OD pairs. This is a
nonlinear optimisation problem which can be solved
analytically for simple cases and by use of appropriate solvers in more complex situations.
Another possibility for selecting a feasible OD matrix is to select the one that adds as less information
as possible to the existing information given by the
measurements. This means to select an OD matrix
that maximises the system’s entropy W , given by the
following expression.
X
W =−
[di,j ln(di,j ) − di,j ] .
(13)
The problem at hand is to estimate the entris of the
OD matrix di,j of (5) based on the available three
measurements.
In order to formulate the problem, the fraction p1,5
1,3
of the flow that originates in node 1 and is destined
to destination 3 and uses link (1, 5) to reach its destination, needs to be introduced. Then, the principle of
vehicle conservation can be utilised to formulate the
problem’s equations.
q1,5 = 8 = p1,5
1,3 d1,3 + d1,4
X
(i,j)
(8)
Let us consider the example of Figure 4, but with
the following assumptions:
Equation 6 states that the measured flow in link
(1, 5) equals the flow that originates at 1 destined to
whole flow that originates at 1 destined to destination 2. The flow in link (5, 6) (eqn. (7)) consists of
the flows in (1, 5) plus the flow that originates in 2 irrespective of its destination, since both have to pass
through (5, 6). Finally, (8) states the fact that the
flow in (6, 3) consists of the flow originating in 1 destined to 2 and using (6, 3) plus the flow originating in
2 destined to 3.
The system of equations (6)–(8) has three equations and five unknowns (p1,5
1,3 , d1,3 , d1,4 , d2,3 and d2,4 ).
Furthermore, it is nonlinear as two of the unknowns
are multiplied in the equations. The system can be
brought into the matrix form

 1,5

"
#
d1,3
p1,3 1 0 0
8

  d1,4 
15 =  p1,5
(9)
1,3 1 1 1   d2,3 
1,5
10
p1,3 0 1 0
d2,4
Because of the integer values assumption, there are
only six feasible matrices that satisfy eqns. (6)–(8),
namely
8 0
7 1
6 2
1.
2.
3.
2 5 3 4 4 3 5 3
4 4
3 5
4.
5.
6.
5 2
6 1
1 0
Since there are more unknowns than equations,
there is an infinite number of feasible solutions that
satisfy (9). The question is how to choose one of these
possible solutions.
A first idea is to utilise past knowledge about the
OD matrix, in the form of a previously known or estimated OD matrix. Then the new OD could be as
Hence, it is possible to solve the optimisation problem (10)–(12) by exhaustive search over the space of
feasible matrices. For each of the possible solutions,
the objective function value of (10) is calculated using the data provided by the prior OD matrix.
For each of the six possible matrices the distance
is calculated (wi,j = 1).
Dr. A. Kotsialos
• p1,5
1,3 = 1, i.e. link (1, 3) is not used at all;
• only integer values of volume are considered;
• the prior OD matrix is
"
#
(Dest. 3) (Dest. 4)
(Orig. 1)
3
2
;
(Orig. 2)
1
3
• the weights wi,j = 1 for every OD pair.
4
TFMC, 2013–2014
• Matrix 1: (8 − 3)2 + (0 − 2)2 + (2 − 1)2 + (3 − 5)2 =
24 + 4 + 1 + 4 = 34.
• Matrix 2: (7 − 3)2 + (2 − 1)2 + (3 − 1)2 + (4 − 3)2 =
16 + 1 + 4 + 1 = 22.
• Matrix 3: 18. This is the optimum matrix.
• Matrix 4: 25.
• Matrix 5: 34.
• Matrix 6: 54.
Hence, if the chosen criterion is the minimisation of
the distance to the prior matrix, feasible OD matrix
number 3 should be chosen.
If the chosen criterion is the maximisation of the
system’s entropy, then expression (13) needs to be
evaluated for each of the feasible OD matrices and
the one with the largest value be selected. Part of
the relevant calculations are shown below.
Figure 5: A roundabout with four approaches, [2].
• Matrix 1: −11.07.
In a general setting, assume that there are m in• Matrix 2: −[7 ln(7) − 7] − [ln(1) − 1] − [3 ln(3) − 3] − flows and n outflows. Then instead of the estimation
[4 ln(4) − 4] = −7.462.
of the subflows, the splitting portions bi,j (k) ∈ [0, 1],
• Matrix 3: −[6 ln(6) − 6] − [2 ln(2) − 2] − [4 ln(4) − are estimated. A Kalman filter approach can be used
to track slowly varying real-time O-D changes. The
4] − [3 ln(3) − 3] = −5.977.
output equations in this case are
• Matrix 4: −5.78. This is the optimum matrix.
• Matrix 5: −6.84.
yj =
• Matrix 6: −9.96.
m
X
dij (k) =
i=1
T
m
X
qj (k)bij (k) + ζj (k)
i=1
Notice that the entropy value for each candidate so= q(k) bj (k) + ζj (k)
(14)
lution is negative, hence the selected maximum will
be the minimum in absolute value. When the en- where ζj is the measurement error with known cotropy criterion is used, then the solution selected is variance Rj and q and b are vectors where the flow
OD matrix 4.
measurements and splitting portions (or rates) are
organised.
The modelling equation is given by
2.3
Dynamic OD Estimation in a Roundabout
bj (k + 1) = bj (k) + g(k)
The OD estimation problem comes in different
flavours depending on the setting. The example of
Figure 4 referred to a relative large network, an OD
estimation problem rises at a roundabout. Consider
the four approaches roundabout shown in Figure 5.
There are four entrances and four exits from this system. All entrances and all exits are monitored by detection stations which provide entry flows qj (k) and
exit flows yj (k), i = 1, . . . , 4 and k the discrete time
index.
The flow that enter the roundabout from entry
point 1, is split into subflows d1,2 , d1,3 and d1,4 assuming that there is no flow returning and exiting the
roundabout from approach 1. Flow at entry point 2
consists of subflows d2,1 , d2,3 and d2,4 and so forth for
the rest approaches. The problem at hand is to calculate the subflows di,j (k) during time step k based
on the known measurements qj (k) and yj (k).
Dr. A. Kotsialos
(15)
where g is the modelling error with known covariance matrix Q.
The Kalman Filter iterative scheme is then as follows [2]
h
i
b̂j (k + 1) = b̂j (k) + Kj (k) yj (k) − q(k)T b̂j (k)
(16)
−1
Kj (k) = Pj (k)q(k) q(k)T Pj (k)q(k) + Rj
Pj (k + 1) = [I − Kj (k)q(k)] Pj (k) + Q
(17)
(18)
where b̂(k) is the estimate of b at k . Truncation and
normalisation is applied so that the portions are less
than one and the sum up to 1 for each origin, i.e.
bij (k) ≥ 0
5
(19)
TFMC, 2013–2014
flows q1 using route 1 and q2 using route 2. The traffic assignment problem consists of determining the
values of q1 and q2 . These may take some default values based on the average driver behaviour and past
experience. They can also be determined as a desired traffic flow pattern that a traffic control centre
will try to effectuate. This means that the discussion on the traffic assignment problem stands on the
margin between traffic control strategy design and
disturbance estimation/prediction. Indeed, there is a
very strong relationship between traffic assignment
and route guidance.
Two basic notions of traffic assignment exist.
• User Optimum Principle (Wardrop): The
travel times on all routes actually used are equal
between them and equal or less than those which
would be experienced by a single vehicle on any
unused route. In other words, a driver does
not have a motive to diverge from the indicated
route, as this would result to increased delays.
Figure 6: Kalman Filter tracking of OD matrix individual
entries, [2].
• System Optimum Principle (normative control): The total travel time is minimum. In this
case, the total travel time spent in the network,
i.e. the time for queuing and travel time inside
the network, is a measure of “social” or system
efficiency, as opposed to the driver’s travel time,
which is a measure of individual efficiency.
Figure 7: Simple network topology for the traffic assignment problem, from .
System optimum and user optimum are partially
(20) competitive conditions. The former are favoured by
traffic operators, while the latter by drivers. For
j=1
more detailed treatment of the traffic assignment
The results for approach 4 and portions destined to and its extensions, see [1].
1 and 3 are shown in Figure 6
This method faces difficulties for larger networks.Large networks have long sample times and 3.2 User Optimum for the Single-Origin–
Single-Destination Network
thus less information is available. Furthemore, congestion results to even longer sample times and Let us consider the network of Figure 7 and let us
queues at traffic lights result to reduced correlations assume that the travel times τ along route i = 1, 2
i
between inflows and outflows. At any rate, for slowly are given by known functions of
the flows qi , fi (qi ).
changing ODs this KF approach can be used to track Then the problem at hand is to determine the
flows
it.
q and q that will equalise the travel times of these
n
X
bij (k) = 1∀i = 1, . . . , m.
1
3
3.1
The Traffic Assignement Problem
The Basic Setting
As mentioned before, the OD matrix provides information about what happens at the network boundaries. The drivers’ routing behaviour is describe in
terms of the traffic assignment. Let us consider the
simplest road network topology with one origin, one
destination and two alternative routes from the origin to the destination as shown in Figure 7.
There is a traffic volume d that enters into the system from the origin, which subsequently splits into
Dr. A. Kotsialos
2
two alternative routed based on the knowledge of the
total demand d and the expressions of fi .
The structure of the fi s is very important since
they determine each route’s travel times. Figure 8
shows how they are interrelated.
When the flow is zero or very light, route 1 is
faster than route 2, reflecting the fact that route 1 is
shorter (geometrically) from route 2, and hence assuming same free flow speed, the travel times will
be shorter. As flow grows in route 1, there will be a
point θ when its travel time will become equal to the
travel time of an empty route 2. For a total demand
that is lower than θ, it does not make sense for driver
to divert to route 2. When d > θ, however, there is
merit for some of the demand to be diverted to route
2.
6
TFMC, 2013–2014
The total travel time in the system is given by
J = q1 τ1 + q2 τ2 ⇒
J = q1 (20q12 + 20) + q2 (15q22 + 100)
The problem of determining those q1∗ and q2∗ that
will minimise J is as follows.
min J = q1 (20q12 + 20) + q2 (15q22 + 100)
q1 ,q2
subject to
q1 + q2 = d
q1 ≥ 0 and q2 ≥ 0
Formulating the problem’s Lagrangian L using λ
as multiplier gives
Figure 8: Travel times relationship for the simple network
topology of Figure 7.
L = q1 (20q12 + 20) + q2 (15q22 + 100) − λ(q1 + q2 − d)
or
Hence, the user optimum is obtained by
d if d < θ
q1 =
qu if d > θ
L = 20q13 + 20q1 + 15q23 + 100q2 − λ(q1 + q2 − d)
(21) First order optimality conditions yield
∂L
∂q1
∂L
∂q2
∂L
∂λ
where qu is determined by solving the following equation for it.
f1 (qu ) = f2 (d − qu )
(22)
= 60q12 + 20 − λ = 0
= 45q22 + 100 − λ = 0
As an example, consider the case where f1 (q1 ) =
= q1 + q2 − d = 0
20q12 + 20 and f2 (q2 ) = 15q22 + 100. Then f1 (θ) = f2 (0)
⇒ θ = 2; for d = 4 > θ = 2, qu = 2.422. Therefore for
user optimum q1 = 2.422 and q2 = 4 − 4.422 = 1.578. From the first two equations
The travel times are f1 (2.422) = 137.32 ≈ f2 (1.578) =
137.35.
60q12 + 20 = 45q22 + 100 ⇒
3.3
( by substituting q2 = q1 − d)
15q12 + 90dq1 − 45d2 − 80 = 0
System Optimum for the SingleOrigin–Single-Destination Network
The discriminant of the quadratic equation is
The system optimum problem for the network of Figure 7 requires the minimisation of the total time
spent J = q1 τ1 + q2 τ2 . Thus, the following optimisation problem is formulated.
∆ = (90d)2 − 4 × 15(−45d2 − 80) ⇒
∆ = 8, 100d2 + 300(9d2 + 16)
Thus, the two roots of the quadratic expression are
p
min J = q1 f1 (q1 ) + q2 f2 (q2 )
(23)
q1 ,q2
−90d ± 8, 100d2 + 300(9d2 + 16)
q1,1,2 =
subject to
2 × 15
q1 + q2 = d
(24)
q1 , q2 ≥ 0
(25)
p
−45d
+
2, 025d2 + 75(9d2 + 16)
For the simple network topology of Figure 7 and the
q1∗ =
15
static demand assumption, this optimisation probp
2, 025d2 + 75(9d2 + 16)
lem can be solved analytically.
= −3d +
.
Assuming the same data as in the user optimum
15
example, each route i = 1, 2 has travel time τi =
fi (qi ), given by f1 = 20q12 + 20 and f2 = 15q22 + 100. Obviously
The total demand at the origin is d.
q2∗ = d − q1∗ .
Dr. A. Kotsialos
7
TFMC, 2013–2014
For d = 4
q1∗
p
= −3 × 4 +
⇒ q1∗ = 2.048,
2, 025 × 16 + 75(9 × 16 + 16)
15
which means that
q2∗ = 4 − 2.048 = 1.952.
The travel times on the two alternative routes are
f1∗ = f1 (q1∗ ) = 20 × 2.0482 + 20 = 103.89
f2∗ = f2 (q2∗ ) = 15 × 1.9522 + 100 = 157.15.
However, is this solution indeed a minimum? Because there is only one linear equality constraint in
the problem along with non-negativity constraints, it
is sufficient to show that q∗ is a local minimum. To
show this we have to verify that the Hessian matrix
is positive-definite at q∗ or that
"
H=
∂2L
∂q12
∂2L
∂q2 ∂q1
#
∂2L
∂q1 ∂q2
∂2L
∂q22
120q1
0
0
90q2
>0⇔
q=q
∗
>0
q=q∗
which is true. The Hessian is positive-definite since
the deteriminant det H = 10, 800q1 q2 > 0 for every
positive q1 and q2 .
References
[1] G.E. Cantarella and A. Sforza. Traffic Assignment. In M. Papageorgiou, editor, Concise Encyclopedia of Traffic & Transportation Systems,
pages 513–520. Pergamon Press, 1991.
[2] M. Cremer. Origin-Destination Matrix: Dynamic
Estimation. In M. Papageorgiou, editor, Concise
Encyclopedia of Traffic & Transportation Systems, pages 310–315. Pergamon Press, 1991.
[3] L.G. Willumsen. Origin-Destination Matrix: Dynamic Estimation. In M. Papageorgiou, editor,
Concise Encyclopedia of Traffic & Transportation
Systems, pages 315–322. Pergamon Press, 1991.
Dr. A. Kotsialos
8
TFMC, 2013–2014
```