Demand——Dynamic User Assignment
浅读一下Demand Dynamic User Assignment的文档,主要是了解sumo中DUE的基本原理,以及输入输出,其他细节自动忽略。下面上原地址:
https://sumo.dlr.de/docs/Demand/Dynamic_User_Assignment.html
1 Introduction
For a given set of vehicles with of origin-destination relations (trips), the simulation must determine routes through the network (list of edges) that are used to reach the destination from the origin edge. The simplest method to find these routes is by computing shortest or fastest routes through the network using a routing algorithm such as Dijkstra or A*. These algorithms require assumptions regarding the travel time for each network edge which is commonly not known before running the simulation due to the fact that travel times depend on the number of vehicles in the network.
sumo在定义车流时生成所有od对。最简单的方法就是计算最短路,比如广度优先的dijkstra和启发式的A*。但这些算法需要很多的关于行程时间的强假设,但这些假设实际上在仿真前是存在很多的不确定因素的。
Caution
A frequent problem with naive user assignment is that all vehicles take the fastest path under the assumption that they are alone in the network and are then jammed at bottlenecks due to the sheer amount of traffic.
The problem of determining suitable routes that take into account travel times in a traffic-loaded network is called user assignment. SUMO provides different tools to solve this problem and they are described below.
在交通仿真中存在一个非常常见的问题:车辆以原先生成的最短路径去形势的情况下,经常会遇到交通瓶颈,然后被堵在路上。
怎么把用户以合理的路径分配到路网上,这个问题叫做用户分配。
sumo中有两种用户分配的方法。
1.1 Iterative Assignment (Dynamic User Equilibrium)
The tool duaIterate.py
can be used to compute the (approximate) dynamic user equilibrium.
Caution
This script will require copious(丰富) amounts of disk space
python tools/assign/duaIterate.py -n <network-file> -t <trip-file> -l <nr-of-iterations>
duaIterate.py
supports many of the same options as sumo. Any options not listed when calling duaIterate.py--help
can be passed to sumo by adding
s
u
m
o
−
−
l
o
n
g
−
o
p
t
i
o
n
−
n
a
m
e
sumo--long-option-name
sumo−−long−option−name arg after the regular options (i.e. sumo–step-length 0.5). The same is true for duarouter options using duarouter--long-option-name
arg. Be aware that those options have to come after the regular options.
```duaIterate.py``提供了许多选项。这些options在常规option (i.e. sumo–step-length 0.5)之后添加。
This script tries to calculate a user equilibrium, that is, it tries to find a route for each vehicle (each trip from the trip-file above) such that each vehicle cannot reduce its travel cost (usually the travel time) by using a different route. 这句话类似UE的定义。
It does so iteratively (hence the name) by calling duarouter to route the vehicles in a network with the last known edge costs (starting with empty-network travel times) calling sumo to simulate “real” travel times result from the calculated routes.
The result edge costs are used in the net routing step.
The number of iterations may be set to a fixed number of determined dynamically depending on the used options. In order to ensure convergence there are different methods employed to calculate the route choice probability from the route cost (so the vehicle does not always choose the “cheapest” route). In general, new routes will be added by the router to the route set of each vehicle in each iteration (at least if none of the present routes is the “cheapest”) and may be chosen according to the route choice mechanisms described below.
一开始,计算空路网上的路径的cost,然后每次将上一次的结果作为这一次分配的依据,因此,这个方法很iteratively。
Between successive calls of duarouter, the .rou.alt.xml
format is used to record not only the current best route but also previously computed alternative routes. These routes are collected within a route distribution and used when deciding the actual route to drive in the next simulation step. This isn’t always the one with the currently lowest cost but is rather sampled from the distribution of alternative routes by a configurable algorithm described below.
.rou.alt.xml
不仅记录了当前的最优路径,还将每次迭代的最有路径计算并记录。这些记录可以为下一次路径决策提供参考。这是一种基于采样的路径选择方法。算法的描述如下:
2 Route-Choice algorithm
The two methods which are implemented are called Gawron and Logit in the following. The input for each of the methods is a weight or cost function (
w
w
w) on the edges of the net, coming from the simulation or default costs (in the first step or for edges which have not been traveled yet), and a set of routes where each route has an old cost and an old probability (from the last iteration) and needs a new cost and a new probability .
Gawron & Logit 具体怎么算的不看了,意义不大,反正生成的都是固定的行人流。
Inputs
w——权重矩阵
上一次的cost和prob
Outputs
新的cost和prob
2.1 Gawron (default)
The Gawron algorithm computes probabilities for choosing from a set of alternative routes for each driver. The following values are considered to compute these probabilities:
- the travel time along the used route in the previous simulation step;
- the sum of edge travel times for a set of alternative routes;
- the previous probability of choosing a route
Number of Routes in each traveller’s route set;
The maximum number of routes can be defined by users, where 5 is the default value. In each iteration, the route usage probability is calculated for each route. When the number of routes is larger than the defined amount, routes with smallest probabilities are removed.
还可以设定最大的备选路径数量。
Updates of Travel Time
The update rule is explained with the following example. Driver
d
d
d chooses Route
r
r
r in Iteration
i
i
i. The travel time
τ
d
(
r
,
i
+
1
)
\tau_d(r, i+1)
τd(r,i+1) is calculated according to the aggregated and averaged link travel times per defined interval (default: 900 s) in Iteration
i
i
i. The travel time for Driver d’s Route
r
r
r in Iteration
i
+
1
i+1
i+1 equals to
τ
d
(
r
,
i
)
\tau_d(r, i)
τd(r,i) as indicated in Formula (1). The travel times of the other routes in Driver d’s route set are then updated with Formula (2) respectively, where
τ
d
(
s
,
i
)
\tau_d(s, i)
τd(s,i) is the travel time needed to travel on Route s in Iteration i and calculated with the same way used for calculating
T
d
(
r
,
i
)
\Tau_d(r, i)
Td(r,i) and
T
d
(
s
,
i
−
1
)
T_d(s, i-1)
Td(s,i−1).
The parameter beta is to prevent travellers from strongly “remembering” the latest trave time of each route in their route sets. The current default value for beta is 0.3.
T
d
(
r
,
i
+
1
)
=
τ
d
(
r
,
i
)
T_d(r, i+1) = \tau_d(r, i)
Td(r,i+1)=τd(r,i)
T
d
(
s
,
i
+
1
)
=
β
∗
τ
d
(
s
,
i
)
+
(
1
−
β
)
∗
T
d
(
s
,
i
−
1
)
T_d(s, i+1)=\beta*\tau_d(s, i)+(1-\beta)*T_d(s,i-1)
Td(s,i+1)=β∗τd(s,i)+(1−β)∗Td(s,i−1)
where
s
s
s is one of the routes, which are not selected to use in Iteration i, in Driver
d
′
s
d's
d′s route set.
The aforementioned update rules also apply when other travel cost units are used. The way to use simulated link costs for calcuating route costs may result in cost underestimation especially when significant congestion only on one of traffic movenents (e.g. left-turn or right-turn) exists. The existing ticket #2566 deals with this issue. 如果只有1条channel被堵住,这个方法可能低估拥堵。
In Formula (1), it is also possible to use Driver
d
d
d’s actual travel cost in Iteration i as
τ
d
(
r
,
i
)
\tau_d(r, i)
τd(r,i).
2.3 Logit
The Logit mechanism applies a fixed formula to each route to calculate the new probability. It ignores old costs and old probabilities and takes the route cost directly as the sum of the edge costs from the last simulation.
The probabilities are calculated from an exponential function with parameter scaled by the sum over all route values:
Caution
It is recommended to set option --convergence-steps
(i.e. to the same number as -last-step) to ensure convergence. Otherwise Logit route choice may keep oscillating, especially with higher values of –
l
o
g
i
t
θ
logit \theta
logitθ.
3 Termination
DuaIterate convergence is hard to predict and results may continue to vary even after 1000 iterations. There are several strategies in this regard:
3.1 Default
By default, a fixed number of iterations, configured via --first-step and --last-step (default 50) is performed.
3.1 Deviation in Average Travel times
The option--max-convergence-deviation
may be used to detect convergence and abort iterations automatically. In each iteration, the average travel time of all trips is computed. From the sequence of these values (one per iteration), the relative standard deviation is computed. Onece a minimum number of iterations has been computed (--convergence-iterations
, default 10) and this deviation falls below the max-convergence deviation threshold, iterations are aborted
3.1 Forced convergence
Option --convergence-steps
may used to force convergence by iteratively reducing the fraction of vehicles that may alter their route.
If a positive value
x
x
x is used, the fraction of vehicles that keep their old route is set to
m
a
x
(
0
,
m
i
n
(
s
t
e
p
/
x
,
1
)
max(0, min(step / x, 1)
max(0,min(step/x,1) which prevents changes in assignment after step
x
x
x.
If a negative value x is used, the fraction of vehicles that keep their old route is set to
1
−
1.0
/
(
s
t
e
p
−
∣
x
∣
)
1 - 1.0 / (step - |x|)
1−1.0/(step−∣x∣) for steps after
∣
x
∣
|x|
∣x∣ which asymptotically reduces assignment after
∣
x
∣
|x|
∣x∣ steps.
4 Speeding up Iterations
There is currently now way to speed up duaIteraty.py by parallelization. However, the total running time of duaIterate is strongly influenced by the total running time of “jammed” iterations. This is a frequent occurrence in the early iterations where many cars try to take the fastest route while disregarding capacity. There are several options to mitigate this:
by ramping up the traffic scaling so the first iterations have fewer traffic (--inc-start, --inc-base, --inc-max, --incrementation
)
by aborting earlier iterations at an earlier time (--time-inc
)
by giving the initial demand with a sensible starting solution (i.e. computed by marouter) along with option --skip-first-routing
by trying to carry more information between runs (--weight-memory, --pessimism
)
5 Usage Examples
5.1 Loading vehicle types from an additional file
By default, vehicle types are taken from the input trip file and are then propagated through duarouter iterations (always as part of the written route file).
In order to use vehicle type definitions from an additional-file, further options must be set
duaIterate.py -n ... -t ... -l ...
--additional-file <FILE_WITH_VTYPES>
duarouter--aditional-file <FILE_WITH_VTYPES>
duarouter--vtype-output dummy.xml
Options preceded by the string duarouter-- are passed directly to duarouter and the option vtype-output dummy.xml
must be used to prevent duplicate definition of vehicle types in the generated output files.
6 oneShot-assignment
An alternative to the iterative user assignment above is incremental assignment. This happens automatically when using <trip>
input directly in sumo instead of <vehicles>
with pre-defined routes. In this case each vehicle will compute a fastest-path computation at the time of departure which prevents all vehicles from driving blindly into the same jam and works pretty well empirically (for larger scenarios).
The routes for this incremental assignment are computed using the Automatic Routing / Routing Device mechanism. It is also possible to enable periodic rerouting to allow increased reactivity to developing jams.
Since automatic rerouting allows for various configuration options, the script Tools/Assign#one-shot.py may be used to automatically try different parameter settings.
7 marouter
The marouter application computes a classic macroscopic assignment. It employs mathematical functions (resistive functions) that approximate travel time increases when increasing flow. This allows to compute an iterative assignment without the need for time-consuming microscopic simulation.