# Demand/Dynamic User Assignment

The tool <SUMO_HOME>/tools/assign/duaIterate.py can be used to compute the (approximate) dynamic user equilibrium.

Caution:
This script will require copious amounts of disk space
python duaIterate.py -n <network-file> -t <trip-file> -l <nr-of-iterations>


# General behavior

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. It does so iteratively (hence the name) by first routing the vehicles in a network with default edge costs (usually the travel time if driving with maximum speed) then simulating the calculated routes resulting in "real" edge costs which are fed back into the router for calculating new routes and so forth. The number of iterations is fixed by a parameter see above. 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.

The two methods which are implemented are called Gawron and Logit (reference needed!!!) in the following. The input for each of the methods is a weight or cost function ${\displaystyle 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 ${\displaystyle R}$ where each route ${\displaystyle r}$ has an old cost ${\displaystyle c_{r}}$ and an old probability ${\displaystyle p_{r}}$ (from the last iteration) and needs a new cost ${\displaystyle c_{r}'}$ and a new probability ${\displaystyle p_{r}'}$.

# 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.

${\displaystyle c_{r}'=\sum _{e\in r}w(e)}$

The probabilities are calculated from an exponential function with parameter ${\displaystyle \theta }$ scaled by the sum over all route values:

${\displaystyle p_{r}'={\frac {\exp(\theta c_{r}')}{\sum _{s\in R}\exp(\theta c_{s}')}}}$