aequilibrae.paths.results package#

Submodules#

aequilibrae.paths.results.assignment_results module#

class aequilibrae.paths.results.assignment_results.NetworkGraphIndices(network_ab_idx: <built-in function array>, network_ba_idx: <built-in function array>, graph_ab_idx: <built-in function array>, graph_ba_idx: <built-in function array>)[source]#

Bases: object

network_ab_idx: array#
network_ba_idx: array#
graph_ab_idx: array#
graph_ba_idx: array#
class aequilibrae.paths.results.assignment_results.AssignmentResultsBase[source]#

Bases: ABC

Assignment results base class for traffic and transit assignments.

abstract prepare(graph: GraphBase, matrix: AequilibraeMatrix) None[source]#
abstract reset() None[source]#
set_cores(cores: int) None[source]#

Sets number of cores (threads) to be used in computation

Value of zero sets number of threads to all available in the system, while negative values indicate the number of threads to be left out of the computational effort.

Resulting number of cores will be adjusted to a minimum of zero or the maximum available in the system if the inputs result in values outside those limits

Arguments:

cores (int): Number of cores to be used in computation

abstract get_load_results() AequilibraeData[source]#
class aequilibrae.paths.results.assignment_results.AssignmentResults[source]#

Bases: AssignmentResultsBase

Assignment result holder for a single TrafficClass with multiple user classes

prepare(graph: Graph, matrix: AequilibraeMatrix) None[source]#

Prepares the object with dimensions corresponding to the assignment matrix and graph objects

Arguments:

graph (Graph): Needs to have been set with number of centroids and list of skims (if any)

matrix (AequilibraeMatrix): Matrix properly set for computation with

matrix.computational_view(list)

reset() None[source]#

Resets object to prepared and pre-computation state

total_flows() None[source]#

Totals all link flows for this class into a single link load

Results are placed into total_link_loads class member

get_graph_to_network_mapping()[source]#
get_load_results() AequilibraeData[source]#

Translates the assignment results from the graph format into the network format

Returns:

dataset (AequilibraeData): AequilibraE data with the traffic class assignment results

get_sl_results() AequilibraeData[source]#
save_to_disk(file_name=None, output='loads') None[source]#

Function to write to disk all outputs computed during assignment.

Deprecated since version 0.7.0.

Arguments:

file_name (str): Name of the file, with extension. Valid extensions are: [‘aed’, ‘csv’, ‘sqlite’] output (str, optional): Type of output (‘loads’, ‘path_file’). Defaults to ‘loads’

class aequilibrae.paths.results.assignment_results.TransitAssignmentResults[source]#

Bases: AssignmentResultsBase

Assignment result holder for a single Transit

prepare(graph: TransitGraph, matrix: AequilibraeMatrix) None[source]#

Prepares the object with dimensions corresponding to the assignment matrix and graph objects

Arguments:

graph (TransitGraph): Needs to have been set with number of centroids

matrix (AequilibraeMatrix): Matrix properly set for computation with

matrix.computational_view(list)

reset() None[source]#

Resets object to prepared and pre-computation state

get_load_results() AequilibraeData[source]#

Translates the assignment results from the graph format into the network format

Returns:

dataset (AequilibraeData): AequilibraE data with the transit class assignment results

aequilibrae.paths.results.path_results module#

class aequilibrae.paths.results.path_results.PathResults[source]#

Bases: object

Path computation result holder

>>> from aequilibrae import Project
>>> from aequilibrae.paths.results import PathResults

>>> proj = Project.from_path("/tmp/test_project")
>>> proj.network.build_graphs()

# Mode c is car in this project
>>> car_graph = proj.network.graphs['c']

# minimize distance
>>> car_graph.set_graph('distance')

# If you want to compute skims
# It does increase path computation time substantially
>>> car_graph.set_skimming(['distance', 'free_flow_time'])

>>> res = PathResults()
>>> res.prepare(car_graph)
>>> res.compute_path(1, 17)

# res.milepost contains the milepost corresponding to each node along the path
# res.path_nodes contains the sequence of nodes that form the path
# res.path  contains the sequence of links that form the path
# res.path_link_directions contains the link directions corresponding to the above links
# res.skims contain all skims requested when preparing the graph

# Update all the outputs mentioned above for destination 9. Same origin: 1
>>> res.update_trace(9)

# clears all computation results
>>> res.reset()
compute_path(origin: int, destination: int, early_exit: bool = False, a_star: bool = False, heuristic: str | None = None) None[source]#

Computes the path between two nodes in the network.

A* heuristics are currently only valid distance cost fields.

Arguments:

origin (int): Origin for the path

destination (int): Destination for the path

early_exit (bool): Stop constructing the shortest path tree once the destination is found.

Doing so may cause subsequent calls to update_trace to recompute the tree. Default is False.

a_star (bool): Whether or not to use A* over Dijkstra’s algorithm. When True, early_exit

is always True. Default is False.

heuristic (str): Heuristic to use if a_star is enabled. Default is None.

prepare(graph: Graph) None[source]#

Prepares the object with dimensions corresponding to the graph object

Arguments:

graph (Graph): Needs to have been set with number of centroids and list of skims (if any)

reset() None[source]#

Resets object to prepared and pre-computation state

update_trace(destination: int) None[source]#

Updates the path’s nodes, links, skims and mileposts

If the previously computed path had early_exit enabled, update_trace will check if the destination has already been found, if not the shortest path tree will be recomputed with the early_exit argument passed on.

If the previously computed path had a_star enabled, update_trace always recompute the path.

Arguments:

destination (int): ID of the node we are computing the path too

set_heuristic(heuristic: str) None[source]#

Set the heuristics to be used in A*. Must be one of get_heuristics().

Arguments:

heuristic (str): Heuristic to use in A*.

get_heuristics() List[str][source]#

Return the availiable heuristics.

aequilibrae.paths.results.skim_results module#

class aequilibrae.paths.results.skim_results.SkimResults[source]#

Bases: object

Network skimming result holder.

>>> from aequilibrae import Project
>>> from aequilibrae.paths.results import SkimResults

>>> proj = Project.from_path("/tmp/test_project")
>>> proj.network.build_graphs()

# Mode c is car in this project
>>> car_graph = proj.network.graphs['c']

# minimize travel time
>>> car_graph.set_graph('free_flow_time')

# Skims travel time and distance
>>> car_graph.set_skimming(['free_flow_time', 'distance'])

>>> res = SkimResults()
>>> res.prepare(car_graph)

>>> res.skims.export('/tmp/test_project/matrix.aem')
prepare(graph: Graph)[source]#

Prepares the object with dimensions corresponding to the graph objects

Arguments:

graph (Graph): Needs to have been set with number of centroids and list of skims (if any)

Module contents#