Metropolis

Running Metropolis

Basic Principle

Running the Metropolis simulator can be summarized by these three steps:
  1. Write the input JSON files
  2. Run the simulator in a terminal
  3. Read and analyze the output JSON files

Input Files

Metropolis requires 3 input JSON files:
  • Road-network: list of edges with their characteristics, list of vehicle types with their characteristics
  • Agent file: list of the agents with their characteristics (including modes available)
  • Simulation parameters

Units

  • Time: number of seconds since midnight (10AM is 36 000)
  • Travel time: number of seconds
  • Length: meters
  • Speed: meters per second (50 km/h is 50 ÷ 3.6 m/s)
  • Value of time: utility unit (e.g., €, $ or an abstract unit) per second
  • Flow: vehicle length (in meters) per second

Road Network JSON File

Example Road Network JSON File

						
{
  "graph": {
    "edges": [
      [
        0,
        1,
        {
          "base_speed": 10.0,
          "length": 10.0,
          "constant_travel_time": 1.0,
          "bottleneck_flow": 1.0,
          "lanes": 2,
          "speed_density": {
            "type": "FreeFlow"
          },
          "overtaking": true
        }
      ],
      [
        1,
        2,
        {
          "base_speed": 20.0,
          "length": 10.0,
          "speed_density": {
            "type": "ThreeRegimes",
            "value": {
              "beta": 1.1,
              "jam_density": 0.2,
              "jam_speed": 2.0,
              "min_density": 0.8
            }
          }
        }
      ]
    ]
  },
  "vehicles": [
    {
      "headway": 10.0,
      "pce": 1.0
    },
    {
      "headway": 30.0,
      "pce": 5.0,
      "speed_function": {
        "type": "Piecewise",
        "value": [
          [
            0.0,
            0.0
          ],
          [
            25.0,
            25.0
          ],
          [
            100.0,
            25.0
          ]
        ]
      },
      "restricted_edges": [
        1
      ]
    }
  ]
}
						
						

Agent JSON File

Example Agent JSON File

						
[
  {
    "id": 1,
    "mode_choice": {
      "type": "Logit",
      "value": {
        "u": 0.5,
        "mu": 1.0
      }
    },
    "modes": [
      {
        "type": "Trip",
        "value": {
          "legs": [
            {
              "class": {
                "type": "Road",
                "value": {
                  "origin": 0,
                  "destination": 1,
                  "vehicle": 0
                }
              },
              "stopping_time": 600.0,
              "travel_utility": {
                "type": "Polynomial",
                "value": {
                  "a": 1.0,
                  "b": -0.003
                }
              },
              "schedule_utility": {
                "type": "None"
              }
            },
            {
              "class": {
                "type": "Virtual",
                "value": 300.0
              },
              "travel_utility": {
                "type": "Polynomial",
                "value": {
                  "b": -0.003
                }
              }
            }
          ],
          "departure_time_model": {
            "type": "ContinuousChoice",
            "value": {
              "period": [
                0.0,
                200.0
              ],
              "choice_model": {
                "type": "Logit",
                "value": {
                  "u": 0.5,
                  "mu": 1.0
                }
              }
            }
          },
          "origin_schedule_utility": {
            "type": "None"
          },
          "destination_schedule_utility": {
            "type": "AlphaBetaGamma",
            "value": {
              "t_star_low": 30.0,
              "t_star_high": 30.0,
              "beta": 1.0,
              "gamma": 4.0
            }
          },
          "pre_compute_route": true
        }
      },
      {
        "type": "Trip",
        "value": {
          "legs": [
            {
              "class": {
                "type": "Virtual",
                "value": 900.0
              }
            }
          ],
          "departure_time_model": {
            "type": "Constant",
            "value": 50.0
          }
        }
      }
    ]
  }
]
						
						

Parameters JSON File

Example Parameters JSON File

						
{
  "period": [
    0.0,
    200.0
  ],
  "network": {
    "road_network": {
      "recording_interval": 50.0,
      "approximation_bound": 1.0,
      "spillback": true,
      "max_pending_duration": 20.0,
      "algorithm_type": "Best"
    }
  },
  "learning_model": {
    "type": "Exponential",
    "value": {
      "alpha": 0.99
    }
  },
  "init_iteration_counter": 1,
  "stopping_criteria": [
    {
      "type": "MaxIteration",
      "value": 2
    },
    {
      "type": "DepartureTime",
      "value": [
        0.01,
        100.0
      ]
    }
  ],
  "update_ratio": 1.0,
  "random_seed": 19960813,
  "nb_threads": 24
}
						
						

Running the Simulator

						
						
						
						

Output Files

Metropolis output 7 different file types:
  • log.txt: text file with the log of the simulation
  • report.html: HTML file with a summary table and graphs
  • iteration{n}.json: JSON file with aggregate results, for each iteration
  • running_time.json: JSON file with running times for the different parts of the simulator
  • agent_results.json.zst: compressed JSON file with agent-specific results
  • skim_results.json.zst: compressed JSON file with network skim results (i.e., OD pair travel times)
  • weight_results.json.zst: compressed JSON file with network weight results (i.e., edges' travel times)

report.html

iteration{n}.json

agent_results.json

skim_results.json

weight_results.json

Application Example

Running a full-scale application of Metropolis can be done in 5 steps (there is a Python script for each step):
  1. Pre-processing the road network (e.g., from OpenStreetMap data)
  2. Connecting the origin/destination zones to the road network through connectors
  3. Generating the population
  4. Filtering the trips from the population that should be simulated
  5. Writing the Metropolis input files

Pre-Processing the Road Network

  • Compatible data sources: OpenStreetMap and HERE
  • Country-level and region-level OpenStreetMap data can be downloaded from https://download.geofabrik.de
  • Filters can be used to discard less relevant roads (e.g., roads tagged as "residential" in OpenStreetMap)

Creating Connectors

  • Trips' departure/arrival points are aggregated at an origin/destination zone level
  • In France, IRIS zones are a good compromise between accuracy and running time
  • Virtual nodes are created to represent the departure/arrival points of the trips in a zone
  • Connectors (virtual edges) are created to connect the virtual nodes to the road network

Generating and Filtering the Population

  • A synthetic population can be created from Hörl and Balac (2021)'s methodology
  • Python scripts to convert the output from Hörl and Balac (2021) to data compatible with Metropolis
  • Filters: simulated period, modes
  • Intra-zonal trips are removed

Hörl, S. and Balac, M., 2021. Synthetic population and travel demand for Paris and Île-de-France based on open and publicly available data. Transportation Research Part C: Emerging Technologies, 130, p.103291.

Writing Metropolis Input Files

  • Python script to write the 3 Metropolis input JSON files from the output of the previous steps
  • Many parameters to choose and calibrate:
    • Vehicle length and PCE
    • Simulated period
    • Individual preferences (alpha, beta, gamma, etc.)
    • Edges' capacities
    • Edges' constant travel times