Validation#

How do we know openmobisim computes what it says? It is checked in three ways:

  • automated tests, which must pass before any change is accepted;

  • validation cases, small networks whose answer is known independently of the simulator, run before each release;

  • reference results of the starter cases, which guard against unintended change.

Automated tests#

Every change runs the full test suite on Linux, macOS and Windows. Among the tests that compare with an answer known in advance:

What

Compared with

Where

The loading against a reference: a bottleneck whose queue spills back over two links, a saturated merge, a diverge with a blocked branch

The macroscopic link transmission model, written in the test from the papers [1]; every link must count the same traffic leaving it every second, to within whole vehicles

python/tests/test_ltm_reference.py

Free flow

A trip’s time equals the sum of its links’ free-flow times

crates/core-loading/tests/level0.rs

Capacity changes

A closed link holds its cars until it opens, then discharges at capacity; a narrowed link at its share

crates/core-loading/tests/capacity_changes.rs

Buses on the roads

A bus leaves after its dwell, waits for its scheduled time when early, and does not hold up the car behind

crates/core-loading/tests/chains.rs

Transit journeys

The journeys found against the timetable, counted independently

python/tests/test_transit_timetables.py

Repeatability

The same run twice, with 1 and 7 threads, and without parallelism, byte for byte; a multimodal run and the Delft case at 1 thread and at every core

CI’s determinism job; python/tests/test_threads.py

The fingerprint

Changing any parameter a run uses changes its fingerprint

python/tests/test_fingerprint_complete.py

Validation cases#

Validation cases are small networks built from scratch whose answer comes from theory, the literature, or an independent count of the model’s own rules. They are run by hand before each release rather than in CI, because a known solution of an idealised system need not match the model exactly. Each comparison is judged by the kind of reference it uses:

Kind

Meaning

A difference means

exact

What the model must give by its own rules, counted independently

a fault

theory

A closed form for the idealised system

small: discretisation; large: worth a look

literature

A published number for a model that differs on purpose

the direction and size the case explains

contrast

Another model, shown beside the reference

nothing: it is not judged

A row matches within its tolerance, is close within three times it, and is off beyond.

Every case below shows its set-up, its reference and its rows from the last run, which is repeated before each release.

The last run: openmobisim 0.1.0, build f036acd815fa, on aarch64-apple-darwin, 2026-10-19. 41 judged rows, 41 match; 3 contrasts, shown without a verdict.

V-T1: One line and its waits#

Set-up. One transit line, its departures every 600 s, then alternately 240 and 960 s, then alternately 120 and 1 080 s. A traveller arrives at the first stop every 10 s for two hours and rides one stop, boarding with no slack and with 60 s of slack.

Reference. Exact: each traveller’s journey counted from the timetable, the next departure at or after their arrival plus the slack, then the ride. Theory: the mean wait of travellers arriving at random, \(E[H^2] / (2\,E[H])\) with \(H\) the time between departures [2]. Travellers here arrive on a 10-second grid, so the simulated mean wait is 5 s below the formula.

The one line of V-T1 drawn on its network, its stops A and B The one line of V-T1 drawn on its network, its stops A and B

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

headways 600 s: mean trip (s), slack 0 s

exact

895.0

895.0

+0.0

equal

matches

headways 600 s: mean trip (s) against E[H²]/2E[H]

theory

900.0

895.0

−5.0

1 %

matches

headways 600 s: mean trip (s), slack 60 s

exact

955.0

955.0

+0.0

equal

matches

headways 240/960 s: mean trip (s), slack 0 s

exact

1 003.0

1 003.0

+0.0

equal

matches

headways 240/960 s: mean trip (s) against E[H²]/2E[H]

theory

1 008.0

1 003.0

−5.0

1 %

matches

headways 240/960 s: mean trip (s), slack 60 s

exact

1 063.0

1 063.0

+0.0

equal

matches

headways 120/1080 s: mean trip (s), slack 0 s

exact

1 087.0

1 087.0

+0.0

equal

matches

headways 120/1080 s: mean trip (s) against E[H²]/2E[H]

theory

1 092.0

1 087.0

−5.0

1 %

matches

headways 120/1080 s: mean trip (s), slack 60 s

exact

1 147.0

1 147.0

+0.0

equal

matches

V-T2: Spiess and Florian’s network#

Set-up. The four-line network of Spiess and Florian[3], stops A, X, Y and B, written as timetables: line 1 from A to B, 25 min, every 12 min; line 2 from A by X to Y, 7 and 6 min, every 12; line 3 from X by Y to B, 4 and 4 min, every 30; line 4 from Y to B, 10 min, every 6.

Reference. Exact: travellers who know the timetable take the earliest arrival, counted by brute force over the network’s journeys. Literature: the optimal strategy’s 27.75 min from A to B, for travellers who board the first attractive line. That model differs on purpose: its waits are exact only when the lines’ departures interleave evenly, so travellers who know the timetable land near it, not always below it.

Spiess and Florian's four lines between stops A, X, Y and B Spiess and Florian's four lines between stops A, X, Y and B

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

mean trip (min), one set of offsets

exact

27.38

27.38

+0.00

equal

matches

timetable-aware travellers, 200 random offsets (min)

contrast

27.75

28.01

+0.26

5 %

not judged

this run against the strategy (min)

literature

27.75

27.38

−0.37

10 %

matches

V-R1: A bottleneck above its capacity#

Set-up. Cars arrive at rate \(\lambda\) for a time \(T\) at a link of 1 400 PCU/h fed by a two-lane link: 2 000 cars an hour for 30 min, 2 800 for 30 min, 1 600 for 60 min. Both flow levels 2 and 4.

Reference. Theory: the deterministic queue. It grows at \(\lambda - \mu\) until \(T\) and empties at the capacity \(\mu\) by \(T' = \lambda T / \mu\); the total delay is \(\tfrac{1}{2} (\lambda - \mu) \, T \, T'\) [4][5].

The bottleneck of V-R1: the two-lane link queued in red before the one-lane link at capacity The bottleneck of V-R1: the two-lane link queued in red before the one-lane link at capacity

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

2000/h for 30 min: total delay (veh-h), flow level 2

theory

107.1

107.0

−0.1

1 %

matches

2000/h for 30 min: total delay (veh-h), flow level 4

theory

107.1

107.0

−0.1

1 %

matches

2800/h for 30 min: total delay (veh-h), flow level 2

theory

350.0

349.8

−0.2

1 %

matches

2800/h for 30 min: total delay (veh-h), flow level 4

theory

350.0

349.8

−0.2

1 %

matches

1600/h for 60 min: total delay (veh-h), flow level 2

theory

114.3

114.2

−0.1

1 %

matches

1600/h for 60 min: total delay (veh-h), flow level 4

theory

114.3

114.2

−0.1

1 %

matches

V-R2: A saturated merge#

Set-up. A one-lane and a two-lane link merge into one lane. Both approaches are kept full and fed at the same rate, one vehicle a second each, so a merge by demand would split them equally. Measured over minutes 5 to 25, while both queues stand. Both flow levels 2 and 4.

Reference. Theory: the merge by capacity, one third from the one-lane approach and two thirds from the two-lane one, together the capacity of the road ahead [6][7].

The merge of V-R2: both approaches queued, the road ahead at capacity The merge of V-R2: both approaches queued, the road ahead at capacity

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

share from the one-lane approach, flow level 2

theory

0.3333

0.3326

−0.0007

2 %

matches

merged discharge (PCU/h), flow level 2

theory

1 400.0

1 398.0

−2.0

2 %

matches

share from the one-lane approach, flow level 4

theory

0.3333

0.3326

−0.0007

2 %

matches

merged discharge (PCU/h), flow level 4

theory

1 400.0

1 398.0

−2.0

2 %

matches

V-R3: Two routes in equilibrium#

Set-up. Two parallel routes: the short one takes 288 s at free flow and has a bottleneck of 1 200 veh/h; the long one takes 461 s. A constant inflow of 1 800 or 2 400 veh/h for one hour, run to at most 100 loadings or a gap of 0.5 %.

Reference. Theory: the dynamic user equilibrium with point queues. Everyone takes the short route until its queue costs the 173 s difference, at a time \(t^*\); then both, the short one at its capacity. The closed form gives the mean trip, \(t^*\), and the short route’s share of the trips leaving after \(t^*\), \(1\,200 / q\) for an inflow \(q\). The deterministic route choice with the method of successive averages approaches it; its route costs in 300-second bins set the scale of the tolerance. Contrast: the logit, a stochastic equilibrium, sends some travellers to the long route even while the short one is free.

The two routes of V-R3: the short route's bottleneck in red, the long route free The two routes of V-R3: the short route's bottleneck in red, the long route free

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

1800/h: mean trip (s), deterministic, msa

theory

452.5

453.8

+1.3

3 %

matches

1800/h: t* (s), from the long route’s trips

theory

345.6

312.0

−33.6

150.0

matches

1800/h: short route’s share after t*

theory

0.6667

0.6927

+0.0260

0.0300

matches

1800/h: mean trip (s), logit, msa

contrast

452.5

380.2

−72.3

3 %

not judged

2400/h: mean trip (s), deterministic, msa

theory

456.7

459.6

+2.9

3 %

matches

2400/h: t* (s), from the long route’s trips

theory

172.8

159.0

−13.8

150.0

matches

2400/h: short route’s share after t*

theory

0.5000

0.5206

+0.0206

0.0300

matches

2400/h: mean trip (s), logit, msa

contrast

456.7

447.6

−9.1

3 %

not judged

V-R4: Waves of a closure#

Set-up. A straight road of four links, the measured one 1 or 2 km long, fed at 80 % of its capacity at flow level 4. The link after it closes for 20 minutes and reopens. Read from the upstream link’s exits in one-second bins, so the tolerance is 2 s.

Reference. Theory: the triangular fundamental diagram [8][1]. The back of the jam runs upstream as a shock and reaches the measured link’s start \(L \, (k_j - k_\text{in}) / q_\text{in}\) after the closure, with \(L\) the link’s length, \(k_j\) the jam density and \(k_\text{in}\), \(q_\text{in}\) the density and flow arriving; after the reopening, the start-up wave crosses it in \(L / w\), \(w\) the backward wave speed.

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

1000 m, 1 lane: the jam reaches x’s start (s after the closure)

theory

235.9

236.0

+0.1

2.0

matches

1000 m, 1 lane: the start-up wave crosses x (s)

theory

174.3

174.0

−0.3

2.0

matches

2000 m, 1 lane: the jam reaches x’s start (s after the closure)

theory

471.8

471.0

−0.8

2.0

matches

2000 m, 1 lane: the start-up wave crosses x (s)

theory

348.6

348.0

−0.6

2.0

matches

2000 m, 2 lanes: the jam reaches x’s start (s after the closure)

theory

471.8

472.0

+0.2

2.0

matches

2000 m, 2 lanes: the start-up wave crosses x (s)

theory

348.6

348.0

−0.6

2.0

matches

V-C1: The logit’s split#

Set-up. The two routes of V-R3, the long one 1.2 times the short one, with capacities far above a demand of 2 000 cars an hour for two hours, so nothing congests. Two time weights, −0.2 and −1.0 per minute.

Reference. Theory: the logit over the two routes, \(P_\text{short} = \exp V_\text{short} / (\exp V_\text{short} + \exp V_\text{long})\) with \(V = \beta \, t\), the time weight times the route’s time; the routes share no link, so the path-size term is 0 [9][10]. The tolerance is three standard deviations of sampling.

The two free routes of V-C1, each drawn by the volume it carries The two free routes of V-C1, each drawn by the volume it carries

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

short route’s share, β -0.2/min (3σ 0.024)

theory

0.5479

0.5400

−0.0079

0.0236

matches

short route’s share, β -1.0/min (3σ 0.021)

theory

0.7231

0.7133

−0.0099

0.0212

matches

V-C2: The nested logit’s split#

Set-up. The routes of V-C1 and walking along the short one, 4 km at 4.8 km/h: 6 000 travellers choose between the car, a nest of the two routes, and walking, a nest of one. Every utility is the time weight times a known time; there are no prices and no access times. Logsum parameters \(\mu\) of 0.5 and 1.

Reference. Theory: the nested logit’s closed form for the car’s share and for the short route’s share among the cars [10][11]. At \(\mu = 1\) it is the plain logit over the three. The tolerance is three standard deviations of sampling.

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

walking’s share, μ 0.5 (3σ 0.014)

theory

0.1560

0.1578

+0.0018

0.0141

matches

the short route’s share of the cars, μ 0.5 (3σ 0.021)

theory

0.5144

0.5155

+0.0011

0.0211

matches

walking’s share, μ 1.0 (3σ 0.012)

theory

0.1156

0.1170

+0.0014

0.0124

matches

the short route’s share of the cars, μ 1.0 (3σ 0.021)

theory

0.5072

0.5055

−0.0017

0.0206

matches

V-S1: The benchmarks at low demand#

Set-up. Sioux Falls and Nguyen–Dupuis at 2 % of their demand, with the deterministic route choice, so the roads stay empty.

Reference. Theory: at no congestion, an equilibrium has every trip on a shortest route at free-flow times [12]. The mean trip is the demand-weighted shortest time, computed by a shortest-path search of the case’s own, independent of the simulator. The comparison holds whichever of several equally short routes a trip takes.

Quantity

Kind

Reference

Simulated

Difference

Tolerance

Verdict

siouxfalls, 2 % of the demand: mean trip (s)

theory

528.5

528.5

+0.0

0.5 %

matches

nguyendupuis, 2 % of the demand: mean trip (s)

theory

1 788.0

1 788.4

+0.4

0.5 %

matches

Sioux Falls against its published equilibrium#

Sioux Falls is also published with a static user equilibrium at its full demand [13][14]. That model differs from openmobisim’s on purpose: its link times come from a volume-delay function rather than from queues and waves, and its demand is a constant flow rather than departures over time. The two are shown side by side in notebook 07 · Validation, as a contrast, not judged. At low demand the two models must agree, which V-S1 checks.

Notebook 07 also works through a free-flow trip by hand and a bottleneck against queueing theory.

Reference results#

The starter cases’ reference results are checked with openmobisim check: the same platform must give the same numbers, another platform the same within tolerances. See Starter cases.

For bikes#

Bike trips take part in the repeatability tests and the mode-choice tests. There is no validation case yet with a known answer for bike route choice: bike routes are least-cost routes on the bike layer, checked by the layer tests.

References#