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",
"myint": 1,
"myfloat": 3.6,
"mybool": true,
"myarray": [
0, 1, 2
],
"nested_array": [
{
"some": "value",
"another": "value"
},
{"second": "object"}
]
}
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 duration | Seconds | 300 (5 minutes) |
Time of day | Seconds after midnight | 8 * 3600 = 28800 is 8 a.m. |
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!
edge_id
: Identifier of the edge (positive integer, unique)source
: Identifier of the source node (positive integer)target
: Identifier of the target node (positive integer)speed
: Free-flow speed on the edge (m/s)length
: Length of the edge (m)bottleneck_flow
: Maximum inflow and outflow of the edge (PCE/s)overtaking
: If `True`, vehicles can overtake other vehicles in the bottleneck queues if they are going to different edgeslanes
: number of lanes available to vehicles on the edge (in the current direction)speed_density.type = "FreeFlow"
(or when omitting the variable, the speed on the link is always equal to the free-flow speedspeed_density.type = "ThreeRegimes"
, the "Three Regimes" speed-density function is used and the following parameters need to be set: speed_density.min_density
, speed_density.jam_density
, speed_density.jam_speed
and speed_density.beta
constant_travel_time
: time penalty that is added to the edge's travel time, in secondsFor additional details, go to the documentation
https://docs.metropolis.lucasjavaudin.com/getting_started/input/road-network.htmlvehicle_id
: Identifier of the vehicle (positive integer, unique)headway
: Head-to-head length between two vehicles (m, used to compute edge's density)pce
: Passenger-car equivalent for the vehicle (non-negative number)
{
[...]
"road_network": {
"recording_interval": 300.0,
"approximation_bound": 1.0,
"spillback": true,
"backward_wave_speed": 4.0,
"max_pending_duration": 60.0,
"constrain_inflow": true,
"algorithm_type": "Best",
},
[...]
}
recording_interval
: time, in seconds, between two breakpoints in the edge-level travel-time functions (Mandatory; Recommendation: 5, 10 or 15 minutes for large-scale networks)approximation_bound
: for a given travel-time function, if the difference between the maximum and the minimum travel time is smaller than this value, the function is represented as a constant function for optimization (Default: 0; Recommendation: between 0 and 5 seconds)
{
[...]
"road_network": {
"recording_interval": 300.0,
"approximation_bound": 1.0,
"spillback": true,
"backward_wave_speed": 4.0,
"max_pending_duration": 60.0,
"constrain_inflow": true,
"algorithm_type": "Best",
},
[...]
}
spillback
: whether spillback congestion (queue propagation) is enabled (Default: TRUE; Recommendation: TRUE for more realistic congestion modeling)backward_wave_speed
: speed at which the space taken by vehicles propagates backward upon exit (Default: instantaneous propagation; Recommendation: default or 15 km/h = 4.17 m/s)max_pending_duration
: maximum amount of time a vehicle can stay in a pending state (Mandatory; Recommendation: between 30s and 5m, larger values are more realistic but generate more congestion)
{
[...]
"road_network": {
"recording_interval": 300.0,
"approximation_bound": 1.0,
"spillback": true,
"backward_wave_speed": 4.0,
"max_pending_duration": 60.0,
"constrain_inflow": true,
"algorithm_type": "Best",
},
[...]
}
constrain_inflow
: whether bottlenecks limit vehicle inflow in addition to vehicle outflow (Default: TRUE; Recommendation: TRUE, set to FALSE to replicate MATSim behavior)algorithm_type
: routing algorithm to use for profile queries, "Best", "TCH", or "Intersect" (Default: "Best"; Recommendation: "Intersect" for a smaller running time, "TCH" for a smaller memory consumption)
{
[...]
"road_network": {
"recording_interval": 300.0,
"approximation_bound": 1.0,
"spillback": true,
"backward_wave_speed": 4.0,
"max_pending_duration": 60.0,
"constrain_inflow": true,
"algorithm_type": "Best",
},
[...]
}
travel_time
: constant travel time on the edgequery_id
: Identifier of the query (used in the results)origin
: Identifier of the origin nodedestination
: Identifier of the destination nodedeparture_time
: Departure time from origin
{
"input_files": {
"queries": "queries.csv",
"edges": "edges.csv",
"edge_ttfs": "edge_ttfs.csv"
},
"output_directory": "output",
"saving_format": "CSV"
"algorithm": "TCH",
"output_route": true,
"nb_threads": 8,
}
input_files
: Path to the three input files (absolute or relative to the "parameters.json" file)output_directory
: Path to the output directory (absolute or relative to the "parameters.json" file)saving_format
: "CSV" or "Parquet"algorithm
: "Best", "TCH", "Intersect", or "Dijkstra"output_route
: Whether to compute and return the fastest paths (only for earliest-arrival queries, incompatible with "Intersect")nb_threads
: Number of threads to use when running (Default is to use the maximum available)ea_results.csv
(or .parquet):
profile_results.csv
(or .parquet):
travel_time
values can be set to something else (e.g., edge's length) and the algorithm will minimize with respect to this metric