Random seeds in transport models

January 2023 — Technical note #76

Tessa Hayman

Product Specialist

Tessa Hayman explains the different sources of stochasticity in micro and meso experiments in Aimsun Next and how to control them. 

All dynamic scenarios include some form of stochasticity which is defined by the choice of a random seed. This technical note will explain the different sources of stochasticity within micro and meso experiments in Aimsun Next and how you can control them.  

Uncertainty in transport models is an aspect that needs to be carefully thought about when using their outputs. Whereas the uncertainty of static models is caused by uncertainty of input parameters, dynamic models show additional variability in their outputs due to the stochasticity of the series of random numbers that are used to specify input parameters. These series are generated based on random seeds in order to ensure that every time a replication is run it produces the same results. 

In Aimsun Next by default all random seeds are themselves automatically generated from a single (master) random seed specified in the replication. If each replication has a different (master) random seed, all the stochastic processes occurring in the simulation (vehicle parameters, vehicle departure times, path choice, etc.) lead to differences in results. However, there can be use cases in which you have to control in a finer way what changes between replications; for this there are five different seeds in the replication attributes which can be set independently. 

(Master) random seed 

The random seed contained in the main tab of a replication is used to generate all the seeds that are not set to a specific value (different than 0) in the replication attributes, and therefore can affect all the aspects of the simulation controlled by the specific seeds described below. In addition to this, it always controls the rounding of trips in a decimal matrix and the generation headways (departure times) of the individual vehicles when the arrivals are set to uniform, normal or exponential. 

Vehicle generation seed 

This seed is used to generate each vehicle’s properties from the truncated normal distributions in the vehicle type. This includes, but is not limited to, vehicle length, max. desired speed, look-ahead variability, traffic management compliance, speed acceptance, maximum give-way time. Note that by setting a deviation of 0 for a parameter, it no longer varies with the random seed, but it will also no longer vary between vehicles of the same type in the same simulation. 

Vehicle assignment seed 

This seed is used to select a vehicle’s path from a set of paths calculated by DUE or SRC or given as input as OD routes. Each path type and each path within the path type has a probability of usage, and this seed is used to select one path among the choice set. Therefore, it has an effect every time multiple routes are available for the same OD pair. 

Public transport seed 

This seed is used to set for public transport vehicles the departure time at the beginning of the line (if a deviation has been set in the timetable) and the dwell time at each stop (if a deviation has been set in the timetable). It also affects the sampling of vehicle parameters for public transport vehicles (which, for private vehicles, is controlled by the generation seed). 

Traffic management seed 

This seed is used when there is a random process associated with a traffic management action e.g., the location, size and occurrence of a periodic section incident, or the choice of a subpath associated to a forced turn. Compliance with a traffic management action does not depend on this seed as it uses a random number stored in a vehicle’s properties and is therefore dependent on the vehicle generation seed. 

 

If you wish two replications to be equal just in some of the above aspects, but not all, you can set the same sub-seed in the replication attributes. Since the demand and generation headways always depend on the main seed, if you want to fix them between replications you must keep the same master seed and set different sub-seeds for the processes you want to differ between replications. 

Since random seeds are used to sample a value from a distribution, or to make a choice based on probabilities, another way to remove stochasticity is setting a deviation to zero or having a single option to choose from. However, note that this will also remove variations within the same simulation, not just between different replications. 

Random seed 

How to remove completely stochasticity 

Master 

Use integer matrices and set arrivals to constant 

Public transport seed 

Set the deviation to 0 in timetables for departure times and dwell times and for all parameters in the vehicle types that service transit lines 

Traffic management seed 

Set the deviation to 0 in periodic section incidents, set a single option for forced turn and destination change, force the shortest route for En-route path update 

Vehicle assignment seed 

Have a single path per OD pair and time interval 

Vehicle generation seed 

Set the deviation to 0 for all vehicle type parameters 

 

You can check the effect of these changes by creating multiple replications and changing different sub-seeds or the master seed and then comparing the spread of outputs and assessing the change in flow on each section. For example, the effect of changing the master random seed is given below for various outputs. Two models were assessed, the first had exponential arrivals and decimal demand, the second used constant arrivals and integer demand. 

An interesting thing to notice is that the variation of the flow between replications is significantly lower if all the OD cells in the matrices have an integer number of trips even if the master random seed changes. So, keep in mind that while the random seed(s) determine whether there is a variation, the amplitude of the variation depends on the characteristics of the model. 

A) Random seed (demand from static traversal): 
Figure 2: Differences between replications for the examined KPIs
Figure 3: Flow differences between replications
B) Random seed (rounded demand from static traversal): 
Figure 5: Differences between replications for the examined KPIs
Figure 6: Flow differences between replications

More technical notes

  • Got a question? Get in touch.

    We are here to help!

SHARE