Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
r-akemii committed Sep 3, 2024
1 parent 12b286c commit e8bc298
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 11 deletions.
26 changes: 17 additions & 9 deletions docs/source/examples/assignment_workflows/plot_forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import sys

# %%

# 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
# --------------------------------

Expand Down Expand Up @@ -110,7 +110,7 @@
# And save the skims
assig.save_skims("base_year_assignment_skims", which_ones="all", format="omx")

#%%
# %%
# Trip distribution
# -----------------
# Calibration
Expand All @@ -137,7 +137,7 @@
# 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

# %%
Expand Down Expand Up @@ -185,7 +185,7 @@
for r in gc.report:
otp.write(r + "\n")

#%%
# %%
# Forecast
# --------
# We create a set of 'future' vectors using some random growth factors.
Expand Down Expand Up @@ -219,7 +219,7 @@
vectors.destinations[:] = destinations * (1 + np.random.rand(vectors.entries) / 10)
vectors.destinations *= vectors.origins.sum() / vectors.destinations.sum()

#%%
# %%
# Impedance
# ~~~~~~~~~

Expand Down Expand Up @@ -259,7 +259,7 @@
proj_matrices.update_database()
print(proj_matrices.list())

#%%
# %%
# IPF for the future vectors
# ~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -282,7 +282,7 @@
# %%
df = proj_matrices.list()

#%%
# %%
# Future traffic assignment
# -------------------------

Expand Down Expand Up @@ -326,7 +326,7 @@
assig.max_iter = 500
assig.rgap_target = 0.00001

#%%
# %%
# Optional: Select link analysis
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
Expand Down Expand Up @@ -393,3 +393,11 @@
# %%
# Close the project
project.close()

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.Graph`
# * :func:`aequilibrae.paths.TrafficClass` | :func:`aequilibrae.paths.TrafficAssignment`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# Let's save this model for later use.
transit.save_to_disk()

#%%
# %%
# Graph building
# --------------
# Let's build the transit network. We'll disable ``outer_stop_transfers`` and ``walking_edges``
Expand Down Expand Up @@ -131,6 +131,11 @@
# To perform an assignment we need to convert the graph builder into a graph.
transit_graph = graph.to_transit_graph()

# %%
# .. admonition:: References
#
# :ref:`transit_assignment_graph`

# %%
# Spiess & Florian assignment
# ---------------------------
Expand All @@ -155,7 +160,7 @@
mat.matrices[:, :, 0] = np.full((zones_in_the_model, zones_in_the_model), 1.0)
mat.computational_view()

#%%
# %%
# Hyperpath generation/assignment
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# We'll create a `TransitAssignment` object as well as a `TransitClass`
Expand Down Expand Up @@ -200,3 +205,16 @@
# %%
# Wrapping up
project.close()

# %%
# .. admonition:: References
#
# :ref:`transit_hyperpath_routing`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.TransitGraphBuilder`
# * :func:`aequilibrae.paths.TransitClass` | :func:`aequilibrae.paths.TransitAssignment`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

# %%

# Imports
from uuid import uuid4
from tempfile import gettempdir
Expand All @@ -18,6 +19,7 @@
# sphinx_gallery_thumbnail_path = 'images/plot_route_choice_assignment.png'

# %%

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

Expand Down Expand Up @@ -251,3 +253,15 @@ def plot_results(link_loads):

# %%
project.close()

# %%
# .. admonition:: References
#
# :ref:`route_choice`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.Graph` | :func:`aequilibrae.paths.RouteChoice`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`
12 changes: 12 additions & 0 deletions docs/source/examples/assignment_workflows/plot_route_choice_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,15 @@

# %%
project.close()

# %%
# .. admonition:: References
#
# :ref:`route_choice`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.Graph` | :func:`aequilibrae.paths.RouteChoice`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`
12 changes: 12 additions & 0 deletions docs/source/examples/assignment_workflows/plot_subarea_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,15 @@ def plot_results(link_loads):
map = plot_results(rc.get_load_results()["demand"])
subarea_zone.add_to(map)
map

# %%
# .. admonition:: References
#
# :ref:`route_choice`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.Graph` | :func:`aequilibrae.paths.RouteChoice` | :func:`aequilibrae.paths.SubAreaAnalysis`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _transit_hyperpath_routing:

Hyperpath routing in the context of transit assignment
======================================================

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _transit_assignment_graph:

The Transit assignment graph
============================

Expand Down

0 comments on commit e8bc298

Please sign in to comment.