Transport simulator with the following characteristics:
Python scripts can be shared between users or replaced by other tools
Travel surplus variation at the IRIS level when Paris's Low Emission Zone is implemented
Car flows for all trips going through highway A15 near Cergy
Public-transit flows by line, Paris' urban area, Morning peak
Vehicle movements in the surroundings of Cergy, 08:00 to 08:05
METROPOLIS2 | MATSim |
---|---|
Trip-based | Activity-based |
Exogenous activity duration | Endogenous activity duration |
Flexible utility specification | Charypar-Nagel utility function |
CSV / Parquet input | XML input |
Discrete-choice theory | Co-evolutionary algorithm |
How to draw departure times from the probability function?
Inverse transform sampling: $t^d = F^{-1}(u)$ with $u \sim \mathcal{U}([0, 1])$ and $F^{-1}$ the CDF
Draws with $N = 100$
Draws with $N = 100,000$
Inconsistency / Non-equilibrium: The travel-time function used to simulate the departure times (in the demand model) does not match the travel-time function resulting from these departure times (in the supply model)
Nash equilibrium definition: No agent can increasing their utility by choosing another departure time, given the other agents' departure times
(TTF = travel-time function)
$\hat{T}$: Expected TTF, used to compute utilities in the demand model
$T$: Simulated TTF computed in the supply model from the chosen departure times
Naive algorithm:
$\lambda = 0.5$
Browse
and select your parameters.json
file.Run simulation
button.
.\execs\metropolis_cli.exe .\examples\data\csv\parameters.json
./execs/metropolis_cli ./examples/data/csv/parameters.json
examples/data/csv/output/
{
"key": "value",
"integer": 1,
"float": 3.6,
"boolean": true,
"array": [
0, 1, 2
],
"nested_array": [
{"some": "value"},
{"another": "value"}
]
}
dict
type
col1,col2,col3,col4
1,Alice,3.2,true
2,Bob,1.4,false
3,Charlie,2.5,false
import polars as pl
df = pl.DataFrame(
{
"agent_id": [0, 1, 2],
"alt_choice.type": ["Deterministic", "Logit", "Logit"],
"alt_choice.u": [0.3, 0.6, 0.5],
"alt_choice.mu": [None, 0.9, 1.0],
"alt_choice.constants": [[0.9, 1.3, 2.1], None, None],
}
)
df.write_parquet("input/agents.parquet")
In [3]: df
Out[3]:
shape: (3, 5)
┌──────────┬─────────────────┬──────────────┬───────────────┬──────────────────────┐
│ agent_id ┆ alt_choice.type ┆ alt_choice.u ┆ alt_choice.mu ┆ alt_choice.constants │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ str ┆ f64 ┆ f64 ┆ list[f64] │
╞══════════╪═════════════════╪══════════════╪═══════════════╪══════════════════════╡
│ 0 ┆ Deterministic ┆ 0.3 ┆ null ┆ [0.9, 1.3, 2.1] │
│ 1 ┆ Logit ┆ 0.6 ┆ 0.9 ┆ null │
│ 2 ┆ Logit ┆ 0.5 ┆ 1.0 ┆ null │
└──────────┴─────────────────┴──────────────┴───────────────┴──────────────────────┘
For consistency and to prevent mistakes, METROPOLIS2 uses the same units for all input and output variables.
Type | Unit | Example |
---|---|---|
Time of day | Seconds after midnight | 8 * 3600 = 28800 is 8 a.m. |
Time duration | Seconds | 300 (5 minutes) |
Length | Meters | |
Speed | Meters / Second | 50 / 3.6 = 13.89 m/s is 50 km/h |
Passenger Car Equivalent (PCE) | N/A | Usually normalized to 1 for car |
Flow | PCE / Second | 0.5 PCE/s = 1800 PCE per hour |
Utility | No specific unit (can be monetary units) | |
Value of Time | Utility / Second | 15 / 3600 = 0.004167 is 15 $/h |
Mistakes are still possibles, be careful!
The documentation (WIP) is the best way to understand the input and output formats
https://docs.metropolis.lucasjavaudin.comJavaudin, L., & de Palma, A. (2024). METROPOLIS2: Bridging Theory and Simulation in Agent-Based Transport Modeling. THEMA, CY Cergy Paris Université.