.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_auto_examples/plot_forecasting.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr__auto_examples_plot_forecasting.py: Forecasting ============ On this example we present a full forecasting workflow for the Sioux Falls example model. .. GENERATED FROM PYTHON SOURCE LINES 8-17 .. code-block:: python ## Imports from uuid import uuid4 from tempfile import gettempdir from os.path import join from aequilibrae.utils.create_example import create_example import logging import sys .. GENERATED FROM PYTHON SOURCE LINES 18-19 We create the example project inside our temp folder .. GENERATED FROM PYTHON SOURCE LINES 19-30 .. code-block:: python fldr = join(gettempdir(), uuid4().hex) project = create_example(fldr) logger = project.logger # We get the project open, we can tell the logger to direct all messages to the terminal as well stdout_handler = logging.StreamHandler(sys.stdout) formatter = logging.Formatter("%(asctime)s;%(levelname)s ; %(message)s") stdout_handler.setFormatter(formatter) logger.addHandler(stdout_handler) .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: python ## Traffic assignment with skimming .. GENERATED FROM PYTHON SOURCE LINES 35-38 .. code-block:: python from aequilibrae.paths import TrafficAssignment, TrafficClass .. GENERATED FROM PYTHON SOURCE LINES 39-44 .. code-block:: python # we build all graphs project.network.build_graphs() # We get warnings that several fields in the project are filled with NaNs. Which is true, but we won't use those fields .. rst-class:: sphx-glr-script-out .. code-block:: none 2023-03-28 07:06:57,207;WARNING ; Field(s) name, lanes has(ve) at least one NaN value. Check your computations 2023-03-28 07:06:57,244;WARNING ; Field(s) name, lanes has(ve) at least one NaN value. Check your computations 2023-03-28 07:06:57,279;WARNING ; Field(s) name, lanes has(ve) at least one NaN value. Check your computations 2023-03-28 07:06:57,315;WARNING ; Field(s) name, lanes has(ve) at least one NaN value. Check your computations 2023-03-28 07:06:57,350;WARNING ; Field(s) name, lanes has(ve) at least one NaN value. Check your computations 2023-03-28 07:06:57,385;WARNING ; Field(s) name, lanes has(ve) at least one NaN value. Check your computations .. GENERATED FROM PYTHON SOURCE LINES 45-59 .. code-block:: python # we grab the graph for cars graph = project.network.graphs["c"] # let's say we want to minimize 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 compute going through other centroids/centroid connectors # required for the Sioux Falls network, as all nodes are centroids graph.set_blocked_centroid_flows(False) .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/aequilibrae/aequilibrae/aequilibrae/paths/graph.py:443: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function. df = self.__graph_groupby.sum()[[cost_field]].reset_index() 2023-03-28 07:06:57,414;WARNING ; Cost field with wrong type. Converting to float64 /home/runner/work/aequilibrae/aequilibrae/aequilibrae/paths/graph.py:477: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function. df = self.__graph_groupby.sum()[skim_fields].reset_index() .. GENERATED FROM PYTHON SOURCE LINES 60-66 .. code-block:: python # We get the demand matrix directly from the project record # so let's inspect what we have in the project proj_matrices = project.matrices proj_matrices.list() .. raw:: html
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


.. GENERATED FROM PYTHON SOURCE LINES 67-72 .. code-block:: python # Let's get it in this better way demand = proj_matrices.get_matrix("demand_omx") demand.computational_view(["matrix"]) .. GENERATED FROM PYTHON SOURCE LINES 73-99 .. code-block:: python assig = TrafficAssignment() # Creates the assignment class assigclass = TrafficClass(name="car", graph=graph, matrix=demand) # The first thing to do is to add at list of traffic classes to be assigned assig.add_class(assigclass) # We set these parameters only after adding one class to the assignment assig.set_vdf("BPR") # This is not case-sensitive # Then we set the volume delay function assig.set_vdf_parameters({"alpha": "b", "beta": "power"}) # And its parameters assig.set_capacity_field("capacity") # The capacity and free flow travel times as they exist in the graph assig.set_time_field("free_flow_time") # And the algorithm we want to use to assign assig.set_algorithm("bfw") # since I haven't checked the parameters file, let's make sure convergence criteria is good assig.max_iter = 1000 assig.rgap_target = 0.001 assig.execute() # we then execute the assignment .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/aequilibrae/aequilibrae/aequilibrae/paths/graph.py:443: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function. df = self.__graph_groupby.sum()[[cost_field]].reset_index() 2023-03-28 07:06:57,732;WARNING ; Cost field with wrong type. Converting to float64 2023-03-28 07:06:57,733;INFO ; bfw Assignment STATS 2023-03-28 07:06:57,733;INFO ; Iteration, RelativeGap, stepsize 2023-03-28 07:06:57,738;INFO ; 1,inf,1.0 2023-03-28 07:06:57,743;INFO ; 2,0.8550751349428284,0.32839952448634563 2023-03-28 07:06:57,749;INFO ; 3,0.4763455007221067,0.18660240547488702 2023-03-28 07:06:57,755;INFO ; 4,0.2355126365951965,0.2411477440291793 2023-03-28 07:06:57,761;INFO ; 5,0.10924072010481088,0.8185470737942447 2023-03-28 07:06:57,766;INFO ; 6,0.1980945227617506,0.14054330572978305 2023-03-28 07:06:57,772;INFO ; 7,0.0668172221544687,0.36171152718899247 2023-03-28 07:06:57,778;INFO ; 8,0.06792122267870587,0.9634685345644044 2023-03-28 07:06:57,784;INFO ; 9,0.10705582933092855,0.13757153109677187 2023-03-28 07:06:57,789;INFO ; 10,0.04038814432034622,0.1609403425427973 2023-03-28 07:06:57,794;INFO ; 11,0.025801226183773084,0.716435057617116 2023-03-28 07:06:57,800;INFO ; 12,0.042846437173170424,0.08581544277016687 2023-03-28 07:06:57,805;INFO ; 13,0.016971662333407043,0.1660157969033195 2023-03-28 07:06:57,810;INFO ; 14,0.020396548012132195,0.4461322062863191 2023-03-28 07:06:57,815;INFO ; 15,0.025887901335905694,0.08515995223661561 2023-03-28 07:06:57,820;INFO ; 16,0.015188959427663162,0.1988698342670051 2023-03-28 07:06:57,826;INFO ; 17,0.01475141964322897,0.3548856159715819 2023-03-28 07:06:57,832;INFO ; 18,0.015582407302127808,0.06145415154081679 2023-03-28 07:06:57,837;INFO ; 19,0.008935871473338547,0.08603462968532699 2023-03-28 07:06:57,842;INFO ; 20,0.008477045208211683,0.1668913886047936 2023-03-28 07:06:57,848;INFO ; 21,0.009517581409988221,0.4917099156011133 2023-03-28 07:06:57,853;INFO ; 22,0.013060711845093087,0.060284308755231206 2023-03-28 07:06:57,858;INFO ; 23,0.006861821876765184,0.10954009782378307 2023-03-28 07:06:57,862;INFO ; 24,0.006201113315688483,0.12230718464290123 2023-03-28 07:06:57,867;INFO ; 25,0.0074574049738041406,0.3080614235512652 2023-03-28 07:06:57,872;INFO ; 26,0.006900497787039256,0.32835666337221175 2023-03-28 07:06:57,877;INFO ; 27,0.006963554132391016,0.7377893941135681 2023-03-28 07:06:57,883;INFO ; 28,0.006817764279834173,0.0443870768699142 2023-03-28 07:06:57,888;INFO ; 29,0.004277860366532555,0.05431813621783447 2023-03-28 07:06:57,893;INFO ; 30,0.004136181096381436,0.05758294976347482 2023-03-28 07:06:57,898;INFO ; 31,0.0031483923250298237,0.0918038853550363 2023-03-28 07:06:57,903;INFO ; 32,0.0034184967969881734,0.12279944254979965 2023-03-28 07:06:57,908;INFO ; 33,0.002738614050254322,0.08799214942487946 2023-03-28 07:06:57,913;INFO ; 34,0.0023403784016331874,0.1098259985006849 2023-03-28 07:06:57,919;INFO ; 35,0.0023185435502055523,0.18741920884713098 2023-03-28 07:06:57,925;INFO ; 36,0.0023838181828793143,0.1404967362503087 2023-03-28 07:06:57,932;INFO ; 37,0.0017801377860521138,0.25278698153070905 2023-03-28 07:06:57,937;INFO ; 38,0.0019264349761422953,0.30768123024764726 2023-03-28 07:06:57,942;INFO ; 39,0.0018408894375062524,0.3982324050247662 2023-03-28 07:06:57,947;INFO ; 40,0.0018205742523357215,0.5255149131180074 2023-03-28 07:06:57,953;INFO ; 41,0.0020224171108353135,0.012343794696331265 2023-03-28 07:06:57,957;INFO ; 42,0.001423836778473865,0.03045402621736974 2023-03-28 07:06:57,963;INFO ; 43,0.0011877471305860427,0.02283308748607117 2023-03-28 07:06:57,968;INFO ; 44,0.0012106681494599195,0.06969126002892805 2023-03-28 07:06:57,973;INFO ; 45,0.0011336232568064097,0.038970964685986896 2023-03-28 07:06:57,978;INFO ; 46,0.0009780989052684459,0.022071990851560294 2023-03-28 07:06:57,978;INFO ; bfw Assignment finished. 46 iterations and 0.0009780989052684459 final gap .. GENERATED FROM PYTHON SOURCE LINES 100-107 .. code-block:: python # Convergence report is easy to see import pandas as pd convergence_report = assig.report() convergence_report.head() .. raw:: html
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


.. GENERATED FROM PYTHON SOURCE LINES 108-112 .. code-block:: python volumes = assig.results() volumes.head() .. raw:: html
matrix_ab matrix_ba matrix_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 4565.043510 NaN 4565.043510 6.000869 NaN 6.000869 1.000145 NaN 1.000145 0.176255 NaN 0.176255 4565.043510 NaN 4565.043510
2 8152.210795 NaN 8152.210795 4.008833 NaN 4.008833 1.002208 NaN 1.002208 0.348333 NaN 0.348333 8152.210795 NaN 8152.210795
3 4552.603997 NaN 4552.603997 6.000859 NaN 6.000859 1.000143 NaN 1.000143 0.175775 NaN 0.175775 4552.603997 NaN 4552.603997
4 5988.789717 NaN 5988.789717 6.596350 NaN 6.596350 1.319270 NaN 1.319270 1.207860 NaN 1.207860 5988.789717 NaN 5988.789717
5 8164.650309 NaN 8164.650309 4.008888 NaN 4.008888 1.002222 NaN 1.002222 0.348865 NaN 0.348865 8164.650309 NaN 8164.650309


.. GENERATED FROM PYTHON SOURCE LINES 113-117 .. code-block:: python # We could export it to CSV or AequilibraE data, but let's put it directly into the results database assig.save_results("base_year_assignment") .. GENERATED FROM PYTHON SOURCE LINES 118-122 .. code-block:: python # And save the skims assig.save_skims("base_year_assignment_skims", which_ones="all", format="omx") .. rst-class:: sphx-glr-script-out .. code-block:: none 2023-03-28 07:06:58,035;WARNING ; Matrix Record has been saved to the database .. GENERATED FROM PYTHON SOURCE LINES 123-126 .. code-block:: python ## Trip distribution .. GENERATED FROM PYTHON SOURCE LINES 127-131 .. code-block:: python ### Calibration # We will calibrate synthetic gravity models using the skims for TIME that we just generated .. GENERATED FROM PYTHON SOURCE LINES 132-136 .. code-block:: python import numpy as np from aequilibrae.distribution import GravityCalibration .. GENERATED FROM PYTHON SOURCE LINES 137-141 .. code-block:: python # Let's take another look at what we have in terms of matrices in the model proj_matrices.list() .. raw:: html
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 aa2c18aa6e2a4fbbbefb47c99430ea92 2023-03-28 07:06:57.468531 Skimming for assignment procedure. Class car


.. GENERATED FROM PYTHON SOURCE LINES 142-149 .. code-block:: python # We need the demand demand = proj_matrices.get_matrix("demand_aem") # And the skims imped = proj_matrices.get_matrix("base_year_assignment_skims_car") .. GENERATED FROM PYTHON SOURCE LINES 150-156 .. code-block:: python # We can check which matrix cores were created for our skims to decide which one to use imped.names # Where free_flow_time_final is actually the congested time for the last iteration .. rst-class:: sphx-glr-script-out .. code-block:: none ['distance_blended', 'distance_final', 'free_flow_time_blended', 'free_flow_time_final'] .. GENERATED FROM PYTHON SOURCE LINES 157-174 .. code-block:: python # 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) .. GENERATED FROM PYTHON SOURCE LINES 175-180 .. code-block:: python # Since we are working with an OMX file, we cannot overwrite a matrix on disk # So we give a new name to save it imped.save(names=["final_time_with_intrazonals"]) .. GENERATED FROM PYTHON SOURCE LINES 181-186 .. code-block:: python # This also updates these new matrices as those being used for computation # As one can verify below imped.view_names .. rst-class:: sphx-glr-script-out .. code-block:: none ['final_time_with_intrazonals'] .. GENERATED FROM PYTHON SOURCE LINES 187-191 .. code-block:: python # We set the matrices for being used in computation demand.computational_view(["matrix"]) .. GENERATED FROM PYTHON SOURCE LINES 192-206 .. code-block:: python 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")) # 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") .. GENERATED FROM PYTHON SOURCE LINES 207-212 .. code-block:: python ## Forecast # * We create a set of * 'future' * vectors using some random growth factors # * We apply the model for inverse power, as the TFLD seems to be a better fit for the actual one .. GENERATED FROM PYTHON SOURCE LINES 213-218 .. code-block:: python from aequilibrae.distribution import Ipf, GravityApplication, SyntheticGravityModel from aequilibrae.matrix import AequilibraeData import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 219-242 .. code-block:: python # We compute the vectors from our matrix origins = np.sum(demand.matrix_view, axis=1) destinations = np.sum(demand.matrix_view, axis=0) args = { "file_path": join(fldr, "synthetic_future_vector.aed"), "entries": demand.zones, "field_names": ["origins", "destinations"], "data_types": [np.float64, np.float64], "memory_mode": False, } vectors = AequilibraeData() vectors.create_empty(**args) vectors.index[:] = demand.index[:] # Then grow them with some random growth between 0 and 10% - Plus balance them vectors.origins[:] = origins * (1 + np.random.rand(vectors.entries) / 10) vectors.destinations[:] = destinations * (1 + np.random.rand(vectors.entries) / 10) vectors.destinations *= vectors.origins.sum() / vectors.destinations.sum() .. GENERATED FROM PYTHON SOURCE LINES 243-251 .. code-block:: python # Impedance 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) .. GENERATED FROM PYTHON SOURCE LINES 252-275 .. code-block:: python for function in ["power", "expo"]: model = SyntheticGravityModel() model.load(join(fldr, f"{function}_model.mod")) outmatrix = join(proj_matrices.fldr, f"demand_{function}_model.aem") apply = GravityApplication() args = { "impedance": imped, "rows": vectors, "row_field": "origins", "model": model, "columns": vectors, "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") .. rst-class:: sphx-glr-script-out .. code-block:: none 2023-03-28 07:06:58,914;WARNING ; Matrix Record has been saved to the database 2023-03-28 07:06:59,063;WARNING ; Matrix Record has been saved to the database .. GENERATED FROM PYTHON SOURCE LINES 276-281 .. code-block:: python # We update the matrices table/records and verify that the new matrices are indeed there proj_matrices.update_database() proj_matrices.list() .. raw:: html
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 aa2c18aa6e2a4fbbbefb47c99430ea92 2023-03-28 07:06:57.468531 Skimming for assignment procedure. Class car
5 demand_power_modeled demand_power_modeled.omx 1 Synthetic gravity trip distribution 2faeadab50bd47c2b658032dddacfd8a 2023-03-28 07:06:58.861169 Synthetic gravity trip distribution. POWER
6 demand_expo_modeled demand_expo_modeled.omx 1 Synthetic gravity trip distribution 31d4e460bc754a40a9de0f281cf32368 2023-03-28 07:06:59.009231 Synthetic gravity trip distribution. EXPO


.. GENERATED FROM PYTHON SOURCE LINES 282-285 .. code-block:: python ### We now run IPF for the future vectors .. GENERATED FROM PYTHON SOURCE LINES 286-301 .. code-block:: python args = { "matrix": demand, "rows": vectors, "columns": vectors, "column_field": "destinations", "row_field": "origins", "nan_as_zero": True, } ipf = Ipf(**args) ipf.fit() ipf.save_to_project(name="demand_ipfd", file_name="demand_ipfd.aem") ipf.save_to_project(name="demand_ipfd_omx", file_name="demand_ipfd.omx") .. rst-class:: sphx-glr-script-out .. code-block:: none 2023-03-28 07:06:59,127;WARNING ; Matrix Record has been saved to the database 2023-03-28 07:06:59,141;WARNING ; Matrix Record has been saved to the database .. GENERATED FROM PYTHON SOURCE LINES 302-305 .. code-block:: python proj_matrices.list() .. raw:: html
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 aa2c18aa6e2a4fbbbefb47c99430ea92 2023-03-28 07:06:57.468531 Skimming for assignment procedure. Class car
5 demand_power_modeled demand_power_modeled.omx 1 Synthetic gravity trip distribution 2faeadab50bd47c2b658032dddacfd8a 2023-03-28 07:06:58.861169 Synthetic gravity trip distribution. POWER
6 demand_expo_modeled demand_expo_modeled.omx 1 Synthetic gravity trip distribution 31d4e460bc754a40a9de0f281cf32368 2023-03-28 07:06:59.009231 Synthetic gravity trip distribution. EXPO
7 demand_ipfd demand_ipfd.aem 1 Iterative Proportional fitting 46ea25d9382b47d9980702d50c1adcf5 2023-03-28 07:06:59.118210 None
8 demand_ipfd_omx demand_ipfd.omx 1 Iterative Proportional fitting 46ea25d9382b47d9980702d50c1adcf5 2023-03-28 07:06:59.118210 None


.. GENERATED FROM PYTHON SOURCE LINES 306-309 .. code-block:: python ## Future traffic assignment .. GENERATED FROM PYTHON SOURCE LINES 310-313 .. code-block:: python from aequilibrae.paths import TrafficAssignment, TrafficClass .. GENERATED FROM PYTHON SOURCE LINES 314-317 .. code-block:: python logger.info("\n\n\n TRAFFIC ASSIGNMENT FOR FUTURE YEAR") .. rst-class:: sphx-glr-script-out .. code-block:: none 2023-03-28 07:06:59,151;INFO ; TRAFFIC ASSIGNMENT FOR FUTURE YEAR .. GENERATED FROM PYTHON SOURCE LINES 318-324 .. code-block:: python demand = proj_matrices.get_matrix("demand_ipfd") # let's see what is the core we ended up getting. It should be 'gravity' demand.names .. rst-class:: sphx-glr-script-out .. code-block:: none ['matrix'] .. GENERATED FROM PYTHON SOURCE LINES 325-351 .. code-block:: python # Let's use the IPF matrix demand.computational_view("matrix") assig = TrafficAssignment() # Creates the assignment class assigclass = TrafficClass(name="car", graph=graph, matrix=demand) # The first thing to do is to add at list of traffic classes to be assigned assig.add_class(assigclass) assig.set_vdf("BPR") # This is not case-sensitive # Then we set the volume delay function assig.set_vdf_parameters({"alpha": "b", "beta": "power"}) # And its parameters assig.set_capacity_field("capacity") # The capacity and free flow travel times as they exist in the graph assig.set_time_field("free_flow_time") # And the algorithm we want to use to assign assig.set_algorithm("bfw") # since I haven't checked the parameters file, let's make sure convergence criteria is good assig.max_iter = 500 assig.rgap_target = 0.00001 .. GENERATED FROM PYTHON SOURCE LINES 352-368 .. code-block:: python # OPTIONAL: If we want to execute select link analysis on a particular TrafficClass, we set the links we are analysing # The format of the input select links is a dictionary (str: list[tuple]). # Each entry represents a separate set of selected links to compute. The str name will name the set of links # The list[tuple] is the list of links being selected, of the form (link_id, direction), as it occurs in the Graph # direction can be 0, 1, -1. 0 denotes bi-directionality # For example, let's use Select Link on two sets of links, select_links = { "Leaving node 1": [(1, 1), (2, 1)], "Random nodes": [(3, 1), (5, 1)], } # We call this command on the class we are analysing with our dictionary of values assigclass.set_select_links(select_links) assig.execute() # we then execute the assignment .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/aequilibrae/aequilibrae/aequilibrae/paths/traffic_class.py:104: UserWarning: Input string name has a space in it. Replacing with _ warnings.warn("Input string name has a space in it. Replacing with _") /home/runner/work/aequilibrae/aequilibrae/aequilibrae/paths/graph.py:443: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function. df = self.__graph_groupby.sum()[[cost_field]].reset_index() 2023-03-28 07:06:59,464;WARNING ; Cost field with wrong type. Converting to float64 2023-03-28 07:06:59,464;INFO ; bfw Assignment STATS 2023-03-28 07:06:59,465;INFO ; Iteration, RelativeGap, stepsize 2023-03-28 07:06:59,472;INFO ; 1,inf,1.0 2023-03-28 07:06:59,481;INFO ; 2,0.8733395200669928,0.3176402178924753 2023-03-28 07:06:59,489;INFO ; 3,0.5191103311414231,0.18105609371890896 2023-03-28 07:06:59,496;INFO ; 4,0.28008255666275983,0.15388440268486386 2023-03-28 07:06:59,503;INFO ; 5,0.09643796551178799,0.7277343092133197 2023-03-28 07:06:59,510;INFO ; 6,0.26572325697457816,0.11409750343276846 2023-03-28 07:06:59,518;INFO ; 7,0.1125562876214825,0.1653043410096878 2023-03-28 07:06:59,524;INFO ; 8,0.08396689553370684,0.4670740574002596 2023-03-28 07:06:59,531;INFO ; 9,0.1036699197583268,0.12338795795716398 2023-03-28 07:06:59,537;INFO ; 10,0.04665684716892152,0.3164675291936488 2023-03-28 07:06:59,544;INFO ; 11,0.07232206665636076,0.12093564302721306 2023-03-28 07:06:59,551;INFO ; 12,0.0392727972260968,0.35132830832843637 2023-03-28 07:06:59,558;INFO ; 13,0.05590639696976591,0.13145288924427492 2023-03-28 07:06:59,565;INFO ; 14,0.03119131098664458,0.22364440789906556 2023-03-28 07:06:59,572;INFO ; 15,0.03583918003320254,0.1648921440226198 2023-03-28 07:06:59,580;INFO ; 16,0.023823383402599603,0.47388559103146727 2023-03-28 07:06:59,586;INFO ; 17,0.04688909355231913,0.08486818671174305 2023-03-28 07:06:59,593;INFO ; 18,0.01779350182262462,0.14165548077717843 2023-03-28 07:06:59,600;INFO ; 19,0.02104807289618521,0.2952214534723885 2023-03-28 07:06:59,606;INFO ; 20,0.02265944668806584,0.8685715069119438 2023-03-28 07:06:59,613;INFO ; 21,0.03486794637185306,0.07143141295043016 2023-03-28 07:06:59,620;INFO ; 22,0.01325716968775923,0.06111006274989798 2023-03-28 07:06:59,626;INFO ; 23,0.006888928504613831,0.07882277809507261 2023-03-28 07:06:59,632;INFO ; 24,0.007742690718402554,0.11764390919838998 2023-03-28 07:06:59,639;INFO ; 25,0.007911287116745502,0.30596683875969183 2023-03-28 07:06:59,646;INFO ; 26,0.008631010181004066,0.31811701531576797 2023-03-28 07:06:59,653;INFO ; 27,0.007283137559744894,0.5880850323340016 2023-03-28 07:06:59,661;INFO ; 28,0.007941865289218086,0.03793243235961274 2023-03-28 07:06:59,668;INFO ; 29,0.005652550997954922,0.06010604449736503 2023-03-28 07:06:59,675;INFO ; 30,0.0051420396811391565,0.08655285300393731 2023-03-28 07:06:59,682;INFO ; 31,0.0040110134882622795,0.12383871624834529 2023-03-28 07:06:59,688;INFO ; 32,0.004156292034814852,0.08120882566015596 2023-03-28 07:06:59,695;INFO ; 33,0.003386298769236586,0.12160384236591751 2023-03-28 07:06:59,702;INFO ; 34,0.0031863693702177897,0.10440603100941362 2023-03-28 07:06:59,708;INFO ; 35,0.002646179269895007,0.10441018501120305 2023-03-28 07:06:59,714;INFO ; 36,0.0027475336598291695,0.4127637406849811 2023-03-28 07:06:59,722;INFO ; 37,0.0038627879174676204,0.548277970859636 2023-03-28 07:06:59,728;INFO ; 38,0.003401148023817055,0.02186082575412126 2023-03-28 07:06:59,734;INFO ; 39,0.0021529516822476535,0.033235791355814046 2023-03-28 07:06:59,740;INFO ; 40,0.0019336552642405683,0.024954273059126474 2023-03-28 07:06:59,746;INFO ; 41,0.0017655100190603033,0.042284794993221075 2023-03-28 07:06:59,754;INFO ; 42,0.001554630255292627,0.05621437999159157 2023-03-28 07:06:59,761;INFO ; 43,0.0014167025556013288,0.0793491412541857 2023-03-28 07:06:59,768;INFO ; 44,0.0015700572447001123,0.07660991062630305 2023-03-28 07:06:59,774;INFO ; 45,0.0014952490170016294,0.21533687005810295 2023-03-28 07:06:59,780;INFO ; 46,0.0017002423731332509,0.21785716906668945 2023-03-28 07:06:59,787;INFO ; 47,0.002022643166361004,0.6597146218210108 2023-03-28 07:06:59,793;INFO ; 48,0.002458436645379931,0.011912964909181246 2023-03-28 07:06:59,801;INFO ; 49,0.0014781689293733038,0.01802700777343412 2023-03-28 07:06:59,807;INFO ; 50,0.001551305039947804,0.04705399484850306 2023-03-28 07:06:59,814;INFO ; 51,0.0010982931887360845,0.031236263736558873 2023-03-28 07:06:59,822;INFO ; 52,0.0010371219865925472,0.03209100524908013 2023-03-28 07:06:59,829;INFO ; 53,0.0008675058999404086,0.02907693389585659 2023-03-28 07:06:59,835;INFO ; 54,0.0005887803659064143,0.009097477319791636 2023-03-28 07:06:59,842;INFO ; 55,0.0005232741875420099,0.010847929884448167 2023-03-28 07:06:59,849;INFO ; 56,0.0005138911857733767,0.01581618017743778 2023-03-28 07:06:59,857;INFO ; 57,0.000592453175208231,0.02932000522204678 2023-03-28 07:06:59,863;INFO ; 58,0.0004340745624429729,0.01138661917301343 2023-03-28 07:06:59,870;INFO ; 59,0.0004990745739740982,0.02182136252597503 2023-03-28 07:06:59,877;INFO ; 60,0.0003534630644157314,0.011357483231512807 2023-03-28 07:06:59,884;INFO ; 61,0.00040497513731655035,0.02355496067714502 2023-03-28 07:06:59,890;INFO ; 62,0.0003819419450035744,0.03601512946962531 2023-03-28 07:06:59,896;INFO ; 63,0.0004879104628388046,0.049783144876681625 2023-03-28 07:06:59,903;INFO ; 64,0.0004934000471721582,0.03438096630271543 2023-03-28 07:06:59,911;INFO ; 65,0.00031988865910262084,0.016927648007883045 2023-03-28 07:06:59,917;INFO ; 66,0.00029847629631881247,0.01132605220802999 2023-03-28 07:06:59,924;INFO ; 67,0.00028340754043273443,0.01633830288349469 2023-03-28 07:06:59,930;INFO ; 68,0.00026080746668297216,0.010311723563333246 2023-03-28 07:06:59,936;INFO ; 69,0.0003176242932456668,0.01923648218418697 2023-03-28 07:06:59,942;INFO ; 70,0.00040673473605759016,0.02344395394248848 2023-03-28 07:06:59,948;INFO ; 71,0.00039191890428979327,0.027112160225882614 2023-03-28 07:06:59,955;INFO ; 72,0.0004930526153896532,0.09474429535512939 2023-03-28 07:06:59,962;INFO ; 73,0.0006939618417660903,0.10577829115737986 2023-03-28 07:06:59,969;INFO ; 74,0.0006338412982689708,0.09939819762606804 2023-03-28 07:06:59,976;INFO ; 75,0.0004775515212174798,0.09495817244692212 2023-03-28 07:06:59,982;INFO ; 76,0.00046146626902680415,0.07001662565074532 2023-03-28 07:06:59,989;INFO ; 77,0.0005042937321655183,0.1395416851628897 2023-03-28 07:06:59,996;INFO ; 78,0.0005730914836408441,0.0841826027032442 2023-03-28 07:07:00,003;INFO ; 79,0.0005568423845249916,0.14443964734040265 2023-03-28 07:07:00,010;INFO ; 80,0.0005614150886688866,0.16366329148352726 2023-03-28 07:07:00,016;INFO ; 81,0.00046947851741175125,0.19556201743775828 2023-03-28 07:07:00,023;INFO ; 82,0.0005270211362258555,0.25138286826393225 2023-03-28 07:07:00,030;INFO ; 83,0.0004652555356612855,0.34080572724326835 2023-03-28 07:07:00,037;INFO ; 84,0.0003969173215715932,0.30560730385527196 2023-03-28 07:07:00,043;INFO ; 85,0.0004081396716900043,0.4182150924089962 2023-03-28 07:07:00,050;INFO ; 86,0.0003321115390913947,0.0032484388538212925 2023-03-28 07:07:00,061;INFO ; 87,0.0003116436362592927,0.0038819667552348106 2023-03-28 07:07:00,067;INFO ; 88,0.00028673643079748053,0.004923675126332469 2023-03-28 07:07:00,074;INFO ; 89,0.00026254327753560833,0.011243294147880641 2023-03-28 07:07:00,080;INFO ; 90,0.00033221984721387585,0.01064616171837822 2023-03-28 07:07:00,087;INFO ; 91,0.00030738922987346573,0.008968803131325144 2023-03-28 07:07:00,094;INFO ; 92,0.00026334452261307813,0.008325918625160012 2023-03-28 07:07:00,101;INFO ; 93,0.00023043679845168833,0.004684954949686288 2023-03-28 07:07:00,107;INFO ; 94,0.000198526542506535,0.007493818657771178 2023-03-28 07:07:00,113;INFO ; 95,0.00017973487607218991,0.007628361022391259 2023-03-28 07:07:00,120;INFO ; 96,0.00019688498675851863,0.007368213767212327 2023-03-28 07:07:00,127;INFO ; 97,0.00014284588650320535,0.0037714910343992266 2023-03-28 07:07:00,134;INFO ; 98,0.0001545242592797955,0.00629713489913998 2023-03-28 07:07:00,141;INFO ; 99,0.0001569313483118391,0.006448909704536573 2023-03-28 07:07:00,150;INFO ; 100,0.00014038453748861432,0.008232559898814688 2023-03-28 07:07:00,158;INFO ; 101,0.00012603049100129944,0.005132945409087585 2023-03-28 07:07:00,164;INFO ; 102,0.00011622520616517143,0.006113814427933844 2023-03-28 07:07:00,170;INFO ; 103,8.585308411706332e-05,0.0033382701657592626 2023-03-28 07:07:00,177;INFO ; 104,9.329264866122598e-05,0.005412149192195344 2023-03-28 07:07:00,183;INFO ; 105,9.70898955475965e-05,0.0038919335095176583 2023-03-28 07:07:00,190;INFO ; 106,7.419443005625675e-05,0.002885248433467363 2023-03-28 07:07:00,196;INFO ; 107,6.084257695899239e-05,0.002689928624785992 2023-03-28 07:07:00,203;INFO ; 108,6.865410386598496e-05,0.012825795979984763 2023-03-28 07:07:00,209;INFO ; 109,0.00010068266569032109,0.012943424814160555 2023-03-28 07:07:00,216;INFO ; 110,0.0001433022496732836,0.024886842066401977 2023-03-28 07:07:00,222;INFO ; 111,0.00015864554052759177,0.03238210789457678 2023-03-28 07:07:00,230;INFO ; 112,0.0001452756477916234,0.030894240108343005 2023-03-28 07:07:00,236;INFO ; 113,0.0001594243717204348,0.01489358553971482 2023-03-28 07:07:00,244;INFO ; 114,0.00014402332332730475,0.019693255359139933 2023-03-28 07:07:00,251;INFO ; 115,0.000124536313681912,0.014726474468859491 2023-03-28 07:07:00,258;INFO ; 116,0.00011585164982335092,0.015517747390185731 2023-03-28 07:07:00,264;INFO ; 117,0.00011304481453730818,0.012810124533706833 2023-03-28 07:07:00,271;INFO ; 118,0.00013978698423575215,0.02904167108452376 2023-03-28 07:07:00,277;INFO ; 119,0.00015041413836898603,0.03471785797320105 2023-03-28 07:07:00,284;INFO ; 120,0.00014800414834281264,0.01851890218518068 2023-03-28 07:07:00,290;INFO ; 121,9.614928539745491e-05,0.01191166293652246 2023-03-28 07:07:00,296;INFO ; 122,0.00011407614361939885,0.009090194672202297 2023-03-28 07:07:00,302;INFO ; 123,0.00011226631529832979,0.02152888765216211 2023-03-28 07:07:00,309;INFO ; 124,0.0001139141213098385,0.014078595499904712 2023-03-28 07:07:00,316;INFO ; 125,0.00013011736555885832,0.013465736180643366 2023-03-28 07:07:00,322;INFO ; 126,0.00011166690737614817,0.014651533236305046 2023-03-28 07:07:00,329;INFO ; 127,9.937656718419572e-05,0.009735606008002136 2023-03-28 07:07:00,335;INFO ; 128,7.617608749041998e-05,0.002374784124780291 2023-03-28 07:07:00,343;INFO ; 129,7.055842222497713e-05,0.0029936558215055 2023-03-28 07:07:00,353;INFO ; 130,5.5177706589207606e-05,0.0022058432035248665 2023-03-28 07:07:00,359;INFO ; 131,5.6642707924197755e-05,0.002956035064694957 2023-03-28 07:07:00,368;INFO ; 132,6.270964316364609e-05,0.0034473374737544063 2023-03-28 07:07:00,375;INFO ; 133,5.610845264934836e-05,0.0038867735051404733 2023-03-28 07:07:00,381;INFO ; 134,4.1648748697391144e-05,0.0029883272683010422 2023-03-28 07:07:00,388;INFO ; 135,4.867576418893265e-05,0.0020853306226675844 2023-03-28 07:07:00,395;INFO ; 136,4.1040087880341716e-05,0.00404357342235238 2023-03-28 07:07:00,402;INFO ; 137,5.075504497997189e-05,0.0017323627392762234 2023-03-28 07:07:00,408;INFO ; 138,3.6050925464133444e-05,0.0026945608774975615 2023-03-28 07:07:00,414;INFO ; 139,4.244629269100892e-05,0.003002040949361239 2023-03-28 07:07:00,420;INFO ; 140,3.5232248489185985e-05,0.002082659608561772 2023-03-28 07:07:00,427;INFO ; 141,3.7296313204687734e-05,0.00126232437486884 2023-03-28 07:07:00,433;INFO ; 142,3.25403498024053e-05,0.0015166206871501235 2023-03-28 07:07:00,440;INFO ; 143,3.066058242863004e-05,0.0008900385026878562 2023-03-28 07:07:00,447;INFO ; 144,3.193348822260202e-05,0.0017807283915754499 2023-03-28 07:07:00,454;INFO ; 145,2.6506245905097053e-05,0.001744762846879596 2023-03-28 07:07:00,461;INFO ; 146,2.944149849823518e-05,0.0026650506438385085 2023-03-28 07:07:00,468;INFO ; 147,3.0793524484618484e-05,0.0035715719894982272 2023-03-28 07:07:00,474;INFO ; 148,3.662197817710201e-05,0.003793744924702886 2023-03-28 07:07:00,481;INFO ; 149,2.6319941105932418e-05,0.0014679610525384216 2023-03-28 07:07:00,487;INFO ; 150,3.217298476359054e-05,0.002071023718893961 2023-03-28 07:07:00,498;INFO ; 151,3.1566829211105225e-05,0.004018646001676477 2023-03-28 07:07:00,507;INFO ; 152,3.963722428298811e-05,0.004439248471713301 2023-03-28 07:07:00,513;INFO ; 153,3.920967187222759e-05,0.005328499677680557 2023-03-28 07:07:00,519;INFO ; 154,4.202342009674377e-05,0.008023965467380097 2023-03-28 07:07:00,526;INFO ; 155,4.8473402915949e-05,0.011878950079475894 2023-03-28 07:07:00,533;INFO ; 156,3.850791344249513e-05,0.00891214196015328 2023-03-28 07:07:00,540;INFO ; 157,4.361025919832795e-05,0.008808869009408181 2023-03-28 07:07:00,547;INFO ; 158,4.8383084953111326e-05,0.008405474651157428 2023-03-28 07:07:00,553;INFO ; 159,3.8960560087957844e-05,0.009263352037435618 2023-03-28 07:07:00,561;INFO ; 160,5.0564744002183144e-05,0.009932700794001053 2023-03-28 07:07:00,568;INFO ; 161,6.579033327003523e-05,0.017183906718451995 2023-03-28 07:07:00,574;INFO ; 162,6.289518540056086e-05,0.016582284776805768 2023-03-28 07:07:00,581;INFO ; 163,6.593811033437245e-05,0.010153763326922458 2023-03-28 07:07:00,589;INFO ; 164,5.8900561025142584e-05,0.012677843570052605 2023-03-28 07:07:00,595;INFO ; 165,5.1252140611346144e-05,0.006199354119955736 2023-03-28 07:07:00,602;INFO ; 166,5.255435978042375e-05,0.008965870525684075 2023-03-28 07:07:00,608;INFO ; 167,6.036372387889496e-05,0.008367053780108621 2023-03-28 07:07:00,615;INFO ; 168,5.1660750145074106e-05,0.013148096516880661 2023-03-28 07:07:00,622;INFO ; 169,6.600814880699648e-05,0.020399216607682163 2023-03-28 07:07:00,628;INFO ; 170,5.6480972043249726e-05,0.013051392273843178 2023-03-28 07:07:00,635;INFO ; 171,6.0826244357574414e-05,0.011502939925205525 2023-03-28 07:07:00,642;INFO ; 172,5.297589294613961e-05,0.013675397565494293 2023-03-28 07:07:00,648;INFO ; 173,5.125758270753778e-05,0.010769010394629923 2023-03-28 07:07:00,655;INFO ; 174,5.0944946592985215e-05,0.009878468650712992 2023-03-28 07:07:00,662;INFO ; 175,4.6610191772893534e-05,0.010455806365975151 2023-03-28 07:07:00,669;INFO ; 176,5.122634045337866e-05,0.010294352963979358 2023-03-28 07:07:00,676;INFO ; 177,5.925902946754887e-05,0.011171226541113008 2023-03-28 07:07:00,682;INFO ; 178,5.2188694601039096e-05,0.007481902874811713 2023-03-28 07:07:00,688;INFO ; 179,4.4704434322095505e-05,0.011977324637550225 2023-03-28 07:07:00,695;INFO ; 180,5.6732639327141044e-05,0.011744004461588775 2023-03-28 07:07:00,702;INFO ; 181,5.325763753130157e-05,0.027274977957704435 2023-03-28 07:07:00,708;INFO ; 182,6.450626380871445e-05,0.02347103237287238 2023-03-28 07:07:00,715;INFO ; 183,5.672393062391784e-05,0.030365183349845115 2023-03-28 07:07:00,721;INFO ; 184,6.13979377119692e-05,0.031158521045043987 2023-03-28 07:07:00,728;INFO ; 185,8.103774689411917e-05,0.08051743308280157 2023-03-28 07:07:00,734;INFO ; 186,7.594092138476722e-05,0.03808976455289849 2023-03-28 07:07:00,741;INFO ; 187,6.380424200311004e-05,0.05264655442995958 2023-03-28 07:07:00,747;INFO ; 188,7.978964855690054e-05,0.05101404725072969 2023-03-28 07:07:00,754;INFO ; 189,5.89195450166273e-05,0.07300341837060566 2023-03-28 07:07:00,762;INFO ; 190,5.7419484480548785e-05,0.04264795547547985 2023-03-28 07:07:00,768;INFO ; 191,8.061454901512238e-05,0.0711822768608495 2023-03-28 07:07:00,774;INFO ; 192,6.408794783840073e-05,0.03352755485831355 2023-03-28 07:07:00,781;INFO ; 193,7.730924239148361e-05,0.10328499885778597 2023-03-28 07:07:00,789;INFO ; 194,7.531669019978405e-05,0.045002561568995986 2023-03-28 07:07:00,796;INFO ; 195,6.873768330622064e-05,0.031778960993182906 2023-03-28 07:07:00,802;INFO ; 196,6.529455886751063e-05,0.03098004852596535 2023-03-28 07:07:00,809;INFO ; 197,4.906209561805718e-05,0.0342438022930228 2023-03-28 07:07:00,815;INFO ; 198,6.200075723716394e-05,0.033655674204846234 2023-03-28 07:07:00,822;INFO ; 199,4.687272145288894e-05,0.031805835655190406 2023-03-28 07:07:00,916;INFO ; 200,5.655017678732337e-05,0.025240315542402646 2023-03-28 07:07:00,924;INFO ; 201,4.55045469833486e-05,0.028410433747266987 2023-03-28 07:07:00,931;INFO ; 202,5.754152377540977e-05,0.027921458271467525 2023-03-28 07:07:00,939;INFO ; 203,7.065222148851164e-05,0.04416164149925008 2023-03-28 07:07:00,946;INFO ; 204,6.117216361474971e-05,0.016149328562774037 2023-03-28 07:07:00,954;INFO ; 205,6.072442427187707e-05,0.03559232596444867 2023-03-28 07:07:00,961;INFO ; 206,6.4991904106622e-05,0.034222094230196384 2023-03-28 07:07:00,970;INFO ; 207,6.446051388780106e-05,0.06449972558527023 2023-03-28 07:07:00,976;INFO ; 208,5.822034055969976e-05,0.03521782295540805 2023-03-28 07:07:00,983;INFO ; 209,5.7902042130042906e-05,0.019558950041782906 2023-03-28 07:07:00,990;INFO ; 210,6.043323113362444e-05,0.04423664353251799 2023-03-28 07:07:00,997;INFO ; 211,5.5198293998099665e-05,0.03029076354633376 2023-03-28 07:07:01,003;INFO ; 212,5.4360553580529034e-05,0.023273571344007957 2023-03-28 07:07:01,013;INFO ; 213,4.0504282754613774e-05,0.025887110178363114 2023-03-28 07:07:01,019;INFO ; 214,6.672381991874277e-05,0.04095894665136692 2023-03-28 07:07:01,029;INFO ; 215,5.696956993629317e-05,0.026548566205369703 2023-03-28 07:07:01,034;INFO ; 216,6.521914063818842e-05,0.029238064231222764 2023-03-28 07:07:01,041;INFO ; 217,4.4074962884120126e-05,0.0229160855947131 2023-03-28 07:07:01,049;INFO ; 218,4.36335591373331e-05,0.009742769247402689 2023-03-28 07:07:01,055;INFO ; 219,4.0038161588345994e-05,0.01046196385357216 2023-03-28 07:07:01,065;INFO ; 220,3.2382816669804545e-05,0.007439421129300873 2023-03-28 07:07:01,072;INFO ; 221,3.6838414768831614e-05,0.012281397302161951 2023-03-28 07:07:01,080;INFO ; 222,4.06064369989016e-05,0.006821579237270633 2023-03-28 07:07:01,087;INFO ; 223,4.0274550493249036e-05,0.009368994568845278 2023-03-28 07:07:01,097;INFO ; 224,4.422037517287799e-05,0.011648520514034984 2023-03-28 07:07:01,104;INFO ; 225,4.168425865444502e-05,0.0070480439543462925 2023-03-28 07:07:01,111;INFO ; 226,2.9120719139793748e-05,0.006042775769098963 2023-03-28 07:07:01,118;INFO ; 227,2.5002257078938004e-05,0.0027911255320071126 2023-03-28 07:07:01,126;INFO ; 228,2.623444072522148e-05,0.010133262935990983 2023-03-28 07:07:01,134;INFO ; 229,3.994127678706054e-05,0.012485569463277182 2023-03-28 07:07:01,142;INFO ; 230,3.352718496933275e-05,0.013757835695428499 2023-03-28 07:07:01,148;INFO ; 231,2.7702877653732367e-05,0.0038799398925846843 2023-03-28 07:07:01,154;INFO ; 232,2.5994198382417043e-05,0.008001771630903348 2023-03-28 07:07:01,161;INFO ; 233,3.2531913623486954e-05,0.004799156004878299 2023-03-28 07:07:01,168;INFO ; 234,3.84822412176235e-05,0.011262150180971566 2023-03-28 07:07:01,175;INFO ; 235,2.8968739287066458e-05,0.0025304719453496985 2023-03-28 07:07:01,181;INFO ; 236,2.5392055344525986e-05,0.005815598312304717 2023-03-28 07:07:01,188;INFO ; 237,2.3394177510914655e-05,0.0053760317855004935 2023-03-28 07:07:01,194;INFO ; 238,2.30348613999992e-05,0.004050089683615845 2023-03-28 07:07:01,201;INFO ; 239,1.9488394663541885e-05,0.0026643008288713805 2023-03-28 07:07:01,207;INFO ; 240,2.4459660022066438e-05,0.00821365035529605 2023-03-28 07:07:01,214;INFO ; 241,2.874314231237023e-05,0.007926053208415378 2023-03-28 07:07:01,221;INFO ; 242,3.198796684450177e-05,0.008021744132968054 2023-03-28 07:07:01,227;INFO ; 243,2.2577647395446277e-05,0.003585187583318514 2023-03-28 07:07:01,234;INFO ; 244,2.300984874184609e-05,0.0075472755064665276 2023-03-28 07:07:01,241;INFO ; 245,2.2988475312650534e-05,0.005790465205568373 2023-03-28 07:07:01,247;INFO ; 246,3.212248110796706e-05,0.0072327060864074335 2023-03-28 07:07:01,253;INFO ; 247,2.830801973782699e-05,0.005517324194285165 2023-03-28 07:07:01,259;INFO ; 248,2.8471829222056673e-05,0.0027993025532018186 2023-03-28 07:07:01,269;INFO ; 249,2.1372047601904882e-05,0.0034493839348449643 2023-03-28 07:07:01,276;INFO ; 250,1.9613528369563637e-05,0.0014973388442102381 2023-03-28 07:07:01,283;INFO ; 251,1.6410277807400067e-05,0.004003578470088645 2023-03-28 07:07:01,289;INFO ; 252,1.6528840158950062e-05,0.0019469072754988747 2023-03-28 07:07:01,296;INFO ; 253,1.731558262761762e-05,0.00511179593752691 2023-03-28 07:07:01,303;INFO ; 254,1.9617219611477338e-05,0.0032432982614396385 2023-03-28 07:07:01,309;INFO ; 255,1.789002435439406e-05,0.005625207907716573 2023-03-28 07:07:01,316;INFO ; 256,2.3415394511240857e-05,0.006561163775871654 2023-03-28 07:07:01,322;INFO ; 257,1.9064596408601253e-05,0.0035705009525325224 2023-03-28 07:07:01,329;INFO ; 258,2.363895019163747e-05,0.007559225761155003 2023-03-28 07:07:01,335;INFO ; 259,2.509874891018198e-05,0.006413278091965013 2023-03-28 07:07:01,342;INFO ; 260,2.4574141974743037e-05,0.005618618743644352 2023-03-28 07:07:01,348;INFO ; 261,2.1806843331136008e-05,0.004331681370838184 2023-03-28 07:07:01,355;INFO ; 262,2.0611592473898758e-05,0.00595640355378514 2023-03-28 07:07:01,362;INFO ; 263,2.3163733967289257e-05,0.007882346485960283 2023-03-28 07:07:01,368;INFO ; 264,2.6309472349138578e-05,0.008920189103632197 2023-03-28 07:07:01,374;INFO ; 265,2.0387672255912822e-05,0.005943874879461277 2023-03-28 07:07:01,381;INFO ; 266,2.1530592298567718e-05,0.007179746172119635 2023-03-28 07:07:01,387;INFO ; 267,1.972919489796362e-05,0.00679929743681663 2023-03-28 07:07:01,395;INFO ; 268,2.5735155080485153e-05,0.008350467237359166 2023-03-28 07:07:01,401;INFO ; 269,2.7566843276653174e-05,0.007705720490948829 2023-03-28 07:07:01,408;INFO ; 270,2.300320294449574e-05,0.007865243677607311 2023-03-28 07:07:01,414;INFO ; 271,2.125314410458199e-05,0.0042720518357252215 2023-03-28 07:07:01,421;INFO ; 272,2.0043053076406044e-05,0.0035380063776877975 2023-03-28 07:07:01,430;INFO ; 273,1.909625233344795e-05,0.0033239525468961844 2023-03-28 07:07:01,437;INFO ; 274,1.8243192576324124e-05,0.00398739845642326 2023-03-28 07:07:01,443;INFO ; 275,2.043413005298623e-05,0.005970447834328287 2023-03-28 07:07:01,450;INFO ; 276,1.740583013072514e-05,0.0028418733443022126 2023-03-28 07:07:01,457;INFO ; 277,1.787678572883007e-05,0.0028666722071158408 2023-03-28 07:07:01,464;INFO ; 278,1.6072770861548098e-05,0.0017795401923408314 2023-03-28 07:07:01,470;INFO ; 279,1.3002193142257764e-05,0.0013782843717829777 2023-03-28 07:07:01,477;INFO ; 280,1.2137070498327178e-05,0.0012397345109950938 2023-03-28 07:07:01,483;INFO ; 281,9.837246751073227e-06,0.0008434274035069354 2023-03-28 07:07:01,483;INFO ; bfw Assignment finished. 281 iterations and 9.837246751073227e-06 final gap .. GENERATED FROM PYTHON SOURCE LINES 369-371 Now let us save our select link results, all we need to do is provide it with a name In additional to exporting the select link flows, it also exports the Select Link matrices in OMX format. .. GENERATED FROM PYTHON SOURCE LINES 371-373 .. code-block:: python assig.save_select_link_results("select_link_analysis") .. GENERATED FROM PYTHON SOURCE LINES 374-375 Say we just want to save our select link flows, we can call: .. GENERATED FROM PYTHON SOURCE LINES 375-387 .. code-block:: python assig.save_select_link_flows("just_flows") # Or if we just want the SL matrices: assig.save_select_link_matrices("just_matrices") # Internally, the save_select_link_results calls both of these methods at once. # We could export it to CSV or AequilibraE data, but let's put it directly into the results database assig.save_results("future_year_assignment") # And save the skims assig.save_skims("future_year_assignment_skims", which_ones="all", format="omx") .. rst-class:: sphx-glr-script-out .. code-block:: none 2023-03-28 07:07:01,549;WARNING ; Matrix Record has been saved to the database .. GENERATED FROM PYTHON SOURCE LINES 388-389 We can also plot convergence .. GENERATED FROM PYTHON SOURCE LINES 389-405 .. code-block:: python import matplotlib.pyplot as plt df = assig.report() x = df.iteration.values y = df.rgap.values fig = plt.figure() ax = fig.add_subplot(111) plt.plot(x, y, "k--") plt.yscale("log") plt.grid(True, which="both") plt.xlabel(r"Iterations") plt.ylabel(r"Relative Gap") plt.show() .. image-sg:: /_auto_examples/images/sphx_glr_plot_forecasting_001.png :alt: plot forecasting :srcset: /_auto_examples/images/sphx_glr_plot_forecasting_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 406-407 Close the project .. GENERATED FROM PYTHON SOURCE LINES 407-408 .. code-block:: python project.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 4.780 seconds) .. _sphx_glr_download__auto_examples_plot_forecasting.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_forecasting.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_forecasting.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_