Forecasting#

In this example, we present a full forecasting workflow for the Sioux Falls example model.

We start creating the skim matrices, running the assignment for the base-year, and then distributing these trips into the network. Later, we estimate a set of future demand vectors which are going to be the input of a future year assignnment with select link analysis.

# Imports
from uuid import uuid4
from os.path import join
from tempfile import gettempdir

import pandas as pd

from aequilibrae.utils.create_example import create_example
# We create the example project inside our temp folder
fldr = join(gettempdir(), uuid4().hex)

project = create_example(fldr)
logger = project.logger

Traffic assignment with skimming#

In this step, we’ll set the skims for the variable free_flow_time, and execute the traffic assignment for the base-year.

from aequilibrae.paths import TrafficAssignment, TrafficClass
# We build all graphs
project.network.build_graphs()
# We get warnings that several fields in the project are filled with NaNs.
# This is true, but we won't use those fields.

# We grab the graph for cars
graph = project.network.graphs["c"]

# Let's say we want to minimize the free_flow_time
graph.set_graph("free_flow_time")

# And will skim time and distance while we are at it
graph.set_skimming(["free_flow_time", "distance"])

# And we will allow paths to be computed going through other centroids/centroid connectors
# required for the Sioux Falls network, as all nodes are centroids
graph.set_blocked_centroid_flows(False)

Let’s get the demand matrix directly from the project record, and inspect what matrices we have in the project.

proj_matrices = project.matrices
proj_matrices.list()
name file_name cores procedure procedure_id timestamp description status
0 demand_omx demand.omx 1 None None 2020-11-24 08:47:18 Original data imported to OMX format
1 demand_mc demand_mc.omx 3 None None 2021-02-24 00:51:35 None
2 skims skims.omx 2 None None None Example skim
3 demand_aem demand.aem 1 None None 2020-11-24 08:46:42 Original data imported to AEM format


We get the demand matrix, and prepare it for computation

demand = proj_matrices.get_matrix("demand_omx")
demand.computational_view(["matrix"])

Let’s perform the traffic assignment

# Create the assignment class
assigclass = TrafficClass(name="car", graph=graph, matrix=demand)

assig = TrafficAssignment()

# We start by adding the list of traffic classes to be assigned
assig.add_class(assigclass)

# Then we set these parameters, which an only be configured after adding one class to the assignment
assig.set_vdf("BPR")  # This is not case-sensitive

# Then we set the volume delay function and its parameters
assig.set_vdf_parameters({"alpha": "b", "beta": "power"})

# The capacity and free flow travel times as they exist in the graph
assig.set_capacity_field("capacity")
assig.set_time_field("free_flow_time")

# And the algorithm we want to use to assign
assig.set_algorithm("bfw")

# Since we haven't checked the parameters file, let's make sure convergence criteria is good
assig.max_iter = 1000
assig.rgap_target = 0.001

# we then execute the assignment
assig.execute()
car                                               :   0%|          | 0/24 [00:00<?, ?it/s]
Equilibrium Assignment                            :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 1/1000 [00:00<00:00, 33026.02it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 1/1000 [00:00<00:00, 8112.77it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 1/1000 - RGap: inf:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   0%|          | 2/1000 [00:00<00:11, 87.52it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 2/1000 [00:00<00:11, 87.16it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 2/1000 [00:00<00:11, 86.86it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 2/1000 - RGap: 0.855075:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   0%|          | 3/1000 [00:00<00:20, 49.56it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 3/1000 [00:00<00:20, 49.49it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 3/1000 [00:00<00:20, 49.42it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 3/1000 - RGap: 0.476346:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 3/1000 - RGap: 0.476346:   0%|          | 4/1000 [00:00<00:28, 35.15it/s]
Equilibrium Assignment                            :   0%|          | 4/1000 [00:00<00:28, 35.15it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 4/1000 [00:00<00:28, 35.15it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 4/1000 [00:00<00:28, 35.15it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 4/1000 - RGap: 0.235513:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 4/1000 - RGap: 0.235513:   0%|          | 5/1000 [00:00<00:24, 39.81it/s]
Equilibrium Assignment                            :   0%|          | 5/1000 [00:00<00:24, 39.81it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 5/1000 [00:00<00:24, 39.81it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 5/1000 [00:00<00:24, 39.81it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 5/1000 - RGap: 0.109241:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 5/1000 - RGap: 0.109241:   1%|          | 6/1000 [00:00<00:18, 53.71it/s]
Equilibrium Assignment                            :   1%|          | 6/1000 [00:00<00:18, 53.71it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 6/1000 [00:00<00:18, 53.71it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 6/1000 [00:00<00:18, 53.71it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 6/1000 - RGap: 0.109241:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 6/1000 - RGap: 0.109241:   1%|          | 7/1000 [00:00<00:18, 53.57it/s]
Equilibrium Assignment                            :   1%|          | 7/1000 [00:00<00:18, 53.57it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 7/1000 [00:00<00:18, 53.57it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 7/1000 [00:00<00:18, 53.57it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 7/1000 - RGap: 0.146818:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   1%|          | 8/1000 [00:00<00:07, 132.06it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 8/1000 [00:00<00:07, 131.86it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 8/1000 [00:00<00:07, 131.69it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 8/1000 - RGap: 0.0676479:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   1%|          | 9/1000 [00:00<00:09, 110.10it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 9/1000 [00:00<00:09, 109.98it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 9/1000 [00:00<00:09, 109.88it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 9/1000 - RGap: 0.0556948:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 9/1000 - RGap: 0.0556948:   1%|          | 10/1000 [00:00<00:12, 76.93it/s]
Equilibrium Assignment                            :   1%|          | 10/1000 [00:00<00:12, 76.93it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 10/1000 [00:00<00:12, 76.93it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 10/1000 [00:00<00:12, 76.93it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 10/1000 - RGap: 0.0556948:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 10/1000 - RGap: 0.0556948:   1%|          | 11/1000 [00:00<00:11, 89.78it/s]
Equilibrium Assignment                            :   1%|          | 11/1000 [00:00<00:11, 89.78it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 11/1000 [00:00<00:11, 89.78it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 11/1000 [00:00<00:11, 89.78it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 11/1000 - RGap: 0.0617454:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   1%|          | 12/1000 [00:00<00:04, 230.69it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 12/1000 [00:00<00:04, 229.77it/s]
All-or-Nothing - Traffic Class: car               :   1%|          | 12/1000 [00:00<00:04, 229.21it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 12/1000 - RGap: 0.0343329:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   1%|▏         | 13/1000 [00:00<00:04, 216.69it/s]
All-or-Nothing - Traffic Class: car               :   1%|▏         | 13/1000 [00:00<00:04, 216.29it/s]
All-or-Nothing - Traffic Class: car               :   1%|▏         | 13/1000 [00:00<00:04, 215.98it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 13/1000 - RGap: 0.027307:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   1%|▏         | 14/1000 [00:00<00:01, 521.26it/s]
All-or-Nothing - Traffic Class: car               :   1%|▏         | 14/1000 [00:00<00:01, 519.40it/s]
All-or-Nothing - Traffic Class: car               :   1%|▏         | 14/1000 [00:00<00:01, 517.81it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 14/1000 - RGap: 0.0292176:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 15/1000 [00:00<00:06, 161.42it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 15/1000 [00:00<00:06, 161.23it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 15/1000 [00:00<00:06, 161.07it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 15/1000 - RGap: 0.0292176:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 16/1000 [00:00<00:03, 254.29it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 16/1000 [00:00<00:03, 253.86it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 16/1000 [00:00<00:03, 253.47it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 16/1000 - RGap: 0.0186455:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 17/1000 [00:00<00:00, 1044.84it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 17/1000 [00:00<00:00, 1038.60it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 17/1000 [00:00<00:00, 1033.30it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 17/1000 - RGap: 0.0120404:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 18/1000 [00:00<00:01, 643.38it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 18/1000 [00:00<00:01, 641.07it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 18/1000 [00:00<00:01, 639.15it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 18/1000 - RGap: 0.011262:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 19/1000 [00:00<00:01, 680.77it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 19/1000 [00:00<00:01, 678.37it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 19/1000 [00:00<00:01, 676.34it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 19/1000 - RGap: 0.0107638:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 20/1000 [00:00<00:02, 475.73it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 20/1000 [00:00<00:02, 473.46it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 20/1000 [00:00<00:02, 471.97it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 20/1000 - RGap: 0.0105866:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 21/1000 [00:00<00:00, 3009.34it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 21/1000 [00:00<00:00, 2966.57it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 21/1000 [00:00<00:00, 2932.30it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 21/1000 - RGap: 0.0105866:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 22/1000 [00:00<00:00, 2776.18it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 22/1000 [00:00<00:00, 2743.00it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 22/1000 [00:00<00:00, 2715.08it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 22/1000 - RGap: 0.00925188:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 23/1000 [00:00<00:02, 428.28it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 23/1000 [00:00<00:02, 427.46it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 23/1000 [00:00<00:02, 426.77it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 23/1000 - RGap: 0.00693254:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▏         | 24/1000 [00:00<00:02, 432.17it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 24/1000 [00:00<00:02, 430.70it/s]
All-or-Nothing - Traffic Class: car               :   2%|▏         | 24/1000 [00:00<00:02, 430.00it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 24/1000 - RGap: 0.00634164:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   2%|▎         | 25/1000 [00:00<00:00, 2414.18it/s]
All-or-Nothing - Traffic Class: car               :   2%|▎         | 25/1000 [00:00<00:00, 2387.96it/s]
All-or-Nothing - Traffic Class: car               :   2%|▎         | 25/1000 [00:00<00:00, 2367.31it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 25/1000 - RGap: 0.00500407:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 26/1000 [00:00<00:02, 390.63it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 26/1000 [00:00<00:02, 390.02it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 26/1000 [00:00<00:02, 389.52it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 26/1000 - RGap: 0.00543593:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 27/1000 [00:00<00:00, 3216.95it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 27/1000 [00:00<00:00, 3180.81it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 27/1000 [00:00<00:00, 3151.15it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 27/1000 - RGap: 0.00735348:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 28/1000 [00:00<00:00, 3879.13it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 28/1000 [00:00<00:00, 3830.04it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 28/1000 [00:00<00:00, 3773.55it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 28/1000 - RGap: 0.00735348:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 29/1000 [00:00<00:00, 3327.63it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 29/1000 [00:00<00:00, 3293.03it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 29/1000 [00:00<00:00, 3255.05it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 29/1000 - RGap: 0.00456795:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 30/1000 [00:00<00:01, 563.65it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 30/1000 [00:00<00:01, 562.64it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 30/1000 [00:00<00:01, 561.76it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 30/1000 - RGap: 0.00408729:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 31/1000 [00:00<00:01, 535.90it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 31/1000 [00:00<00:01, 534.99it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 31/1000 [00:00<00:01, 534.21it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 31/1000 - RGap: 0.00364899:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 32/1000 [00:00<00:02, 414.39it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 32/1000 [00:00<00:02, 412.33it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 32/1000 [00:00<00:02, 411.58it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 32/1000 - RGap: 0.00381163:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 33/1000 [00:00<00:01, 568.52it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 33/1000 [00:00<00:01, 567.57it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 33/1000 [00:00<00:01, 566.76it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 33/1000 - RGap: 0.00268471:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   3%|▎         | 34/1000 [00:00<00:00, 5559.05it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 34/1000 [00:00<00:00, 5397.67it/s]
All-or-Nothing - Traffic Class: car               :   3%|▎         | 34/1000 [00:00<00:00, 5311.03it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 34/1000 - RGap: 0.00282386:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▎         | 35/1000 [00:00<00:00, 7434.45it/s]
All-or-Nothing - Traffic Class: car               :   4%|▎         | 35/1000 [00:00<00:00, 7254.79it/s]
All-or-Nothing - Traffic Class: car               :   4%|▎         | 35/1000 [00:00<00:00, 7128.67it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 35/1000 - RGap: 0.00246422:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▎         | 36/1000 [00:00<00:02, 437.89it/s]
All-or-Nothing - Traffic Class: car               :   4%|▎         | 36/1000 [00:00<00:02, 437.32it/s]
All-or-Nothing - Traffic Class: car               :   4%|▎         | 36/1000 [00:00<00:02, 436.87it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 36/1000 - RGap: 0.00254259:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 36/1000 - RGap: 0.00254259:   4%|▎         | 37/1000 [00:00<00:02, 325.39it/s]
Equilibrium Assignment                            :   4%|▎         | 37/1000 [00:00<00:02, 325.39it/s]
All-or-Nothing - Traffic Class: car               :   4%|▎         | 37/1000 [00:00<00:02, 325.39it/s]
All-or-Nothing - Traffic Class: car               :   4%|▎         | 37/1000 [00:00<00:02, 325.39it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 37/1000 - RGap: 0.00219302:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▍         | 38/1000 [00:00<00:00, 3330.20it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 38/1000 [00:00<00:00, 3303.22it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 38/1000 [00:00<00:00, 3279.29it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 38/1000 - RGap: 0.00193333:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▍         | 39/1000 [00:00<00:00, 6679.37it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 39/1000 [00:00<00:00, 6548.88it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 39/1000 [00:00<00:00, 6449.47it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 39/1000 - RGap: 0.00166056:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▍         | 40/1000 [00:00<00:01, 567.72it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 40/1000 [00:00<00:01, 566.83it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 40/1000 [00:00<00:01, 566.15it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 40/1000 - RGap: 0.00179386:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▍         | 41/1000 [00:00<00:00, 2126.06it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 41/1000 [00:00<00:00, 2115.00it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 41/1000 [00:00<00:00, 2105.88it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 41/1000 - RGap: 0.00202033:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▍         | 42/1000 [00:00<00:01, 594.92it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 42/1000 [00:00<00:01, 594.07it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 42/1000 [00:00<00:01, 593.36it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 42/1000 - RGap: 0.00192396:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▍         | 43/1000 [00:00<00:01, 552.87it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 43/1000 [00:00<00:01, 552.13it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 43/1000 [00:00<00:01, 551.53it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 43/1000 - RGap: 0.00157332:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 43/1000 - RGap: 0.00157332:   4%|▍         | 44/1000 [00:00<00:02, 341.58it/s]
Equilibrium Assignment                            :   4%|▍         | 44/1000 [00:00<00:02, 341.58it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 44/1000 [00:00<00:02, 341.58it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 44/1000 [00:00<00:02, 341.58it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 44/1000 - RGap: 0.0012367:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   4%|▍         | 45/1000 [00:00<00:01, 611.60it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 45/1000 [00:00<00:01, 610.73it/s]
All-or-Nothing - Traffic Class: car               :   4%|▍         | 45/1000 [00:00<00:01, 610.02it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 45/1000 - RGap: 0.00115667:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   5%|▍         | 46/1000 [00:00<00:00, 6683.92it/s]
All-or-Nothing - Traffic Class: car               :   5%|▍         | 46/1000 [00:00<00:00, 6596.85it/s]
All-or-Nothing - Traffic Class: car               :   5%|▍         | 46/1000 [00:00<00:00, 6517.95it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 46/1000 - RGap: 0.00127223:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   5%|▍         | 47/1000 [00:00<00:00, 4042.58it/s]
All-or-Nothing - Traffic Class: car               :   5%|▍         | 47/1000 [00:00<00:00, 4011.24it/s]
All-or-Nothing - Traffic Class: car               :   5%|▍         | 47/1000 [00:00<00:00, 3983.28it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 47/1000 - RGap: 0.00160194:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   5%|▍         | 48/1000 [00:00<00:00, 1704.15it/s]
All-or-Nothing - Traffic Class: car               :   5%|▍         | 48/1000 [00:00<00:00, 1698.30it/s]
All-or-Nothing - Traffic Class: car               :   5%|▍         | 48/1000 [00:00<00:00, 1691.85it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 48/1000 - RGap: 0.00121917:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   5%|▍         | 49/1000 [00:00<00:00, 4504.57it/s]
All-or-Nothing - Traffic Class: car               :   5%|▍         | 49/1000 [00:00<00:00, 4464.06it/s]
All-or-Nothing - Traffic Class: car               :   5%|▍         | 49/1000 [00:00<00:00, 4430.48it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 49/1000 - RGap: 0.00111082:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   5%|▌         | 50/1000 [00:00<00:01, 787.84it/s]
All-or-Nothing - Traffic Class: car               :   5%|▌         | 50/1000 [00:00<00:01, 786.64it/s]
All-or-Nothing - Traffic Class: car               :   5%|▌         | 50/1000 [00:00<00:01, 785.64it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment - Iteration: 50/1000 - RGap: 0.00107422:   0%|          | 0/1000 [00:00<?, ?it/s]
Equilibrium Assignment                            :   5%|▌         | 51/1000 [00:00<00:00, 1859.05it/s]
All-or-Nothing - Traffic Class: car               :   5%|▌         | 51/1000 [00:00<00:00, 1852.35it/s]
All-or-Nothing - Traffic Class: car               :   5%|▌         | 51/1000 [00:00<00:00, 1846.75it/s]
All-or-Nothing - Traffic Class: car               :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 0/24 :   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 10/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 20/24:   0%|          | 0/1000 [00:00<?, ?it/s]
All-or-Nothing - Traffic Class: car - Zones: 24/24:   0%|          | 0/1000 [00:00<?, ?it/s]

After finishing the assignment, we can easily see the convergence report.

convergence_report = assig.report()
convergence_report.head()
iteration rgap alpha warnings beta0 beta1 beta2
0 1 inf 1.000000 1.000000 0.000000 0.0
1 2 0.855075 0.328400 1.000000 0.000000 0.0
2 3 0.476346 0.186602 1.000000 0.000000 0.0
3 4 0.235513 0.241148 1.000000 0.000000 0.0
4 5 0.109241 0.818547 0.607382 0.392618 0.0


And we can also see the results of the assignment

results = assig.results()
results.head()
matrix_ab matrix_ba matrix_tot Preload_AB Preload_BA Preload_tot Congested_Time_AB Congested_Time_BA Congested_Time_Max Delay_factor_AB Delay_factor_BA Delay_factor_Max VOC_AB VOC_BA VOC_max PCE_AB PCE_BA PCE_tot
link_id
1 4536.514084 0.0 4536.514084 0.0 0.0 0.0 6.000847 0.0 6.000847 1.000141 0.0 1.000141 0.175154 0.0 0.175154 4536.514084 0.0 4536.514084
2 8144.874891 0.0 8144.874891 0.0 0.0 0.0 4.008802 0.0 4.008802 1.002200 0.0 1.002200 0.348020 0.0 0.348020 8144.874891 0.0 8144.874891
3 4544.874891 0.0 4544.874891 0.0 0.0 0.0 6.000853 0.0 6.000853 1.000142 0.0 1.000142 0.175476 0.0 0.175476 4544.874891 0.0 4544.874891
4 5923.526624 0.0 5923.526624 0.0 0.0 0.0 6.527894 0.0 6.527894 1.305579 0.0 1.305579 1.194698 0.0 1.194698 5923.526624 0.0 5923.526624
5 8136.514084 0.0 8136.514084 0.0 0.0 0.0 4.008766 0.0 4.008766 1.002191 0.0 1.002191 0.347663 0.0 0.347663 8136.514084 0.0 8136.514084


We can export our results to CSV or get a Pandas DataFrame, but let’s put it directly into the results database

assig.save_results("base_year_assignment")

And save the skims

assig.save_skims("base_year_assignment_skims", which_ones="all", format="omx")

Trip distribution#

First, let’s have a function to plot the Trip Length Frequency Distribution.

from math import log10, floor
import matplotlib.pyplot as plt
def plot_tlfd(demand, skim, name):
    plt.clf()
    b = floor(log10(skim.shape[0]) * 10)
    n, bins, patches = plt.hist(
        np.nan_to_num(skim.flatten(), 0),
        bins=b,
        weights=np.nan_to_num(demand.flatten()),
        density=False,
        facecolor="g",
        alpha=0.75,
    )

    plt.xlabel("Trip length")
    plt.ylabel("Probability")
    plt.title(f"Trip-length frequency distribution for {name}")
    return plt

Calibration#

We will calibrate synthetic gravity models using the skims for free_flow_time that we just generated

import numpy as np
from aequilibrae.distribution import GravityCalibration

We need the demand matrix and to prepare it for computation

demand = proj_matrices.get_matrix("demand_omx")
demand.computational_view(["matrix"])

We also need the skims we just saved into our project

imped = proj_matrices.get_matrix("base_year_assignment_skims_car")

# We can check which matrix cores were created for our skims to decide which one to use
imped.names
['distance_blended', 'distance_final', 'free_flow_time_blended', 'free_flow_time_final']

Where free_flow_time_final is actually the congested time for the last iteration

But before using the data, let’s get some impedance for the intrazonals. Let’s assume it is 75% of the closest zone.

imped_core = "free_flow_time_final"
imped.computational_view([imped_core])

# If we run the code below more than once, we will be overwriting the diagonal values with non-sensical data
# so let's zero it first
np.fill_diagonal(imped.matrix_view, 0)

# We compute it with a little bit of NumPy magic
intrazonals = np.amin(imped.matrix_view, where=imped.matrix_view > 0, initial=imped.matrix_view.max(), axis=1)
intrazonals *= 0.75

# Then we fill in the impedance matrix
np.fill_diagonal(imped.matrix_view, intrazonals)

Since we are working with an OMX file, we cannot overwrite a matrix on disk. So let’s give it a new name to save.

imped.save(names=["final_time_with_intrazonals"])

This also updates these new matrices as those being used for computation

imped.view_names
['final_time_with_intrazonals']

Let’s calibrate our Gravity Model

for function in ["power", "expo"]:
    gc = GravityCalibration(matrix=demand, impedance=imped, function=function, nan_as_zero=True)
    gc.calibrate()
    model = gc.model
    # We save the model
    model.save(join(fldr, f"{function}_model.mod"))

    _ = plot_tlfd(gc.result_matrix.matrix_view, imped.matrix_view, f"{function} model")

    # We can save the result of applying the model as well
    # We can also save the calibration report
    with open(join(fldr, f"{function}_convergence.log"), "w") as otp:
        for r in gc.report:
            otp.write(r + "\n")
Trip-length frequency distribution for expo model

And let’s plot a trip length frequency distribution for the demand itself

plt = plot_tlfd(demand.matrix_view, imped.matrix_view, "demand")
plt.show()
Trip-length frequency distribution for demand

Forecast#

We create a set of ‘future’ vectors using some random growth factors. We apply the model for inverse power, as the trip frequency length distribution (TFLD) seems to be a better fit for the actual one.

from aequilibrae.distribution import Ipf, GravityApplication, SyntheticGravityModel

Compute future vectors#

First thing to do is to compute the future vectors from our matrix.

origins = np.sum(demand.matrix_view, axis=1)
destinations = np.sum(demand.matrix_view, axis=0)

# Then grow them with some random growth between 0 and 10%, and balance them
orig = origins * (1 + np.random.rand(origins.shape[0]) / 10)
dest = destinations * (1 + np.random.rand(origins.shape[0]) / 10)
dest *= orig.sum() / dest.sum()

vectors = pd.DataFrame({"origins":orig, "destinations":dest}, index=demand.index[:])

IPF for the future vectors#

Let’s balance the future vectors. The output of this step is going to be used later in the traffic assignment for future year.

args = {
    "matrix": demand,
    "vectors": vectors,
    "column_field": "destinations",
    "row_field": "origins",
    "nan_as_zero": True,
}

ipf = Ipf(**args)
ipf.fit()

When saving our vector into the project, we’ll get an output that it was recored

ipf.save_to_project(name="demand_ipfd_omx", file_name="demand_ipfd.omx")
<aequilibrae.project.data.matrix_record.MatrixRecord object at 0x7f24a79bca60>

Impedance#

Let’s get the base-year assignment skim for car we created before and prepare it for computation

imped = proj_matrices.get_matrix("base_year_assignment_skims_car")
imped.computational_view(["final_time_with_intrazonals"])

If we wanted the main diagonal to not be considered…

# np.fill_diagonal(imped.matrix_view, np.nan)

Now we apply the Synthetic Gravity model

for function in ["power", "expo"]:
    model = SyntheticGravityModel()
    model.load(join(fldr, f"{function}_model.mod"))

    args = {
        "impedance": imped,
        "vectors": vectors,
        "row_field": "origins",
        "model": model,
        "column_field": "destinations",
        "nan_as_zero": True,
    }

    gravity = GravityApplication(**args)
    gravity.apply()

    # We get the output matrix and save it to OMX too,
    gravity.save_to_project(name=f"demand_{function}_modeled", file_name=f"demand_{function}_modeled.omx")

We update the matrices table/records and verify that the new matrices are indeed there

proj_matrices.update_database()
proj_matrices.list()
name file_name cores procedure procedure_id timestamp description status
0 demand_omx demand.omx 1 None None 2020-11-24 08:47:18 Original data imported to OMX format
1 demand_mc demand_mc.omx 3 None None 2021-02-24 00:51:35 None
2 skims skims.omx 2 None None None Example skim
3 demand_aem demand.aem 1 None None 2020-11-24 08:46:42 Original data imported to AEM format
4 base_year_assignment_skims_car base_year_assignment_skims_car.omx 4 Traffic Assignment ca9c5ab663a54830ae6cb7e03b672cbd 2025-09-09 04:03:52.096306 Skimming for assignment procedure. Class car
5 demand_ipfd_omx demand_ipfd.omx 1 Iterative Proportional fitting 032bc37b109c4cf3b6ce999ab8c7d622 2025-09-09 04:03:56.036399 None
6 demand_power_modeled demand_power_modeled.omx 1 Synthetic gravity trip distribution d6983cb181fe4b5faab2870de605f5c4 2025-09-09 04:03:56.096910 Synthetic gravity trip distribution. POWER
7 demand_expo_modeled demand_expo_modeled.omx 1 Synthetic gravity trip distribution 6dd2bd768879437baedea3764820eea1 2025-09-09 04:03:56.187304 Synthetic gravity trip distribution. EXPO