aequilibrae.paths package#

Subpackages#

Submodules#

aequilibrae.paths.AoN module#

aequilibrae.paths.AoN.bpr()#
aequilibrae.paths.AoN.bpr2()#
aequilibrae.paths.AoN.bpr2_cython(double[:] congested_time, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.bpr_cython(double[:] congested_time, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.build_compressed_graph()#
aequilibrae.paths.AoN.conical()#
aequilibrae.paths.AoN.conical_cython(double[:] congested_time, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.copy_one_dimension()#
aequilibrae.paths.AoN.copy_one_dimension_cython(double[:] target, double[:] source, int cores) void#
aequilibrae.paths.AoN.copy_three_dimensions()#
aequilibrae.paths.AoN.copy_three_dimensions_cython(double[:, :, :] target, double[:, :, :] source, int cores) void#
aequilibrae.paths.AoN.copy_two_dimensions()#
aequilibrae.paths.AoN.copy_two_dimensions_cython(double[:, :] target, double[:, :] source, int cores) void#
aequilibrae.paths.AoN.dbpr2_cython(double[:] deltaresult, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.dbpr_cython(double[:] deltaresult, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.dconical_cython(double[:] deltaresult, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.delta_bpr()#
aequilibrae.paths.AoN.delta_bpr2()#
aequilibrae.paths.AoN.delta_conical()#
aequilibrae.paths.AoN.delta_inrets()#
aequilibrae.paths.AoN.dinrets_cython(double[:] deltaresult, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.inrets()#
aequilibrae.paths.AoN.inrets_cython(double[:] congested_time, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.linear_combination()#
aequilibrae.paths.AoN.linear_combination_1d()#
aequilibrae.paths.AoN.linear_combination_cython(double stepsize, double[:, :] results, double[:, :] array1, double[:, :] array2, int cores) void#
aequilibrae.paths.AoN.linear_combination_cython_1d(double stepsize, double[:] results, double[:] array1, double[:] array2, int cores) void#
aequilibrae.paths.AoN.linear_combination_skims()#
aequilibrae.paths.AoN.linear_combination_skims_cython(double stepsize, double[:, :, :] results, double[:, :, :] array1, double[:, :, :] array2, int cores) void#
aequilibrae.paths.AoN.network_loading(long classes, double[:, :] demand, long long[:] pred, long long[:] conn, double[:, :] link_loads, long long[:] no_path, long long[:] reached_first, double[:, :] node_load, long found) void#
aequilibrae.paths.AoN.one_to_all()#
aequilibrae.paths.AoN.path_computation()#
Parameters
  • graph – AequilibraE graph. Needs to have been set with number of centroids and list of skims (if any)

  • results – AequilibraE Matrix properly set for computation using matrix.computational_view([matrix list])

  • skimming – if we will skim for all nodes or not

aequilibrae.paths.AoN.path_finding(long origin, double[:] graph_costs, long long[:] csr_indices, long long[:] graph_fs, long long[:] pred, long long[:] ids, long long[:] connectors, long long[:] reached_first) int#
aequilibrae.paths.AoN.put_path_file_on_disk(unsigned int orig, unsigned int[:] pred, long long[:] predecessors, unsigned int[:] conn, long long[:] connectors, long long[:] all_nodes, unsigned int[:] origins_to_write, unsigned int[:] nodes_to_write) void#
aequilibrae.paths.AoN.save_path_file(long origin_index, long num_links, long zones, long long[:] pred, long long[:] conn, string path_file, string index_file, bool write_feather) void#
aequilibrae.paths.AoN.skim_multiple_fields(long origin, long nodes, long zones, long skims, double[:, :] node_skims, long long[:] pred, long long[:] conn, double[:, :] graph_costs, long long[:] reached_first, long found, double[:, :] final_skims) void#
aequilibrae.paths.AoN.skimming_single_origin()#
Parameters
  • origin

  • graph

  • results

Returns

aequilibrae.paths.AoN.sum_a_times_b_minus_c()#
aequilibrae.paths.AoN.sum_a_times_b_minus_c_cython(double[:] array1, double[:] array2, double[:] array3, int cores) double#
aequilibrae.paths.AoN.sum_axis1()#
aequilibrae.paths.AoN.sum_axis1_cython(double[:] totals, double[:, :] multiples, int cores) void#
aequilibrae.paths.AoN.triple_linear_combination()#
aequilibrae.paths.AoN.triple_linear_combination_cython(double[:] stepsizes, double[:, :] results, double[:, :] array1, double[:, :] array2, double[:, :] array3, int cores) void#
aequilibrae.paths.AoN.triple_linear_combination_cython_skims(double[:] stepsizes, double[:, :, :] results, double[:, :, :] array1, double[:, :, :] array2, double[:, :, :] array3, int cores) void#
aequilibrae.paths.AoN.triple_linear_combination_skims()#
aequilibrae.paths.AoN.update_path_trace()#
Parameters
  • graph – AequilibraE graph. Needs to have been set with number of centroids and list of skims (if any)

  • results – AequilibraE Matrix properly set for computation using matrix.computational_view([matrix list])

  • skimming – if we will skim for all nodes or not

aequilibrae.paths.AoN module#

aequilibrae.paths.AoN.aggregate_link_costs()#
aequilibrae.paths.AoN.aggregate_link_costs_cython(double[:] actual, double[:] compressed, long long[:] crosswalk) void#
aequilibrae.paths.AoN.assign_link_loads()#
aequilibrae.paths.AoN.assign_link_loads_cython(double[:, :] actual, double[:, :] compressed, long long[:] crosswalk, int cores) void#
aequilibrae.paths.AoN.bpr()#
aequilibrae.paths.AoN.bpr2()#
aequilibrae.paths.AoN.bpr2_cython(double[:] congested_time, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.bpr_cython(double[:] congested_time, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.build_compressed_graph()#
aequilibrae.paths.AoN.conical()#
aequilibrae.paths.AoN.conical_cython(double[:] congested_time, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.copy_one_dimension()#
aequilibrae.paths.AoN.copy_one_dimension_cython(double[:] target, double[:] source, int cores) void#
aequilibrae.paths.AoN.copy_three_dimensions()#
aequilibrae.paths.AoN.copy_three_dimensions_cython(double[:, :, :] target, double[:, :, :] source, int cores) void#
aequilibrae.paths.AoN.copy_two_dimensions()#
aequilibrae.paths.AoN.copy_two_dimensions_cython(double[:, :] target, double[:, :] source, int cores) void#
aequilibrae.paths.AoN.dbpr2_cython(double[:] deltaresult, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.dbpr_cython(double[:] deltaresult, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.dconical_cython(double[:] deltaresult, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.delta_bpr()#
aequilibrae.paths.AoN.delta_bpr2()#
aequilibrae.paths.AoN.delta_conical()#
aequilibrae.paths.AoN.delta_inrets()#
aequilibrae.paths.AoN.dinrets_cython(double[:] deltaresult, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.inrets()#
aequilibrae.paths.AoN.inrets_cython(double[:] congested_time, double[:] link_flows, double[:] capacity, double[:] fftime, double[:] alpha, double[:] beta, int cores) void#
aequilibrae.paths.AoN.linear_combination()#
aequilibrae.paths.AoN.linear_combination_1d()#
aequilibrae.paths.AoN.linear_combination_cython(double stepsize, double[:, :] results, double[:, :] array1, double[:, :] array2, int cores) void#
aequilibrae.paths.AoN.linear_combination_cython_1d(double stepsize, double[:] results, double[:] array1, double[:] array2, int cores) void#
aequilibrae.paths.AoN.linear_combination_skims()#
aequilibrae.paths.AoN.linear_combination_skims_cython(double stepsize, double[:, :, :] results, double[:, :, :] array1, double[:, :, :] array2, int cores) void#
aequilibrae.paths.AoN.network_loading(long classes, double[:, :] demand, long long[:] pred, long long[:] conn, double[:, :] link_loads, long long[:] no_path, long long[:] reached_first, double[:, :] node_load, long found) void#
aequilibrae.paths.AoN.one_to_all()#
aequilibrae.paths.AoN.path_computation()#
Parameters
  • graph – AequilibraE graph. Needs to have been set with number of centroids and list of skims (if any)

  • results – AequilibraE Matrix properly set for computation using matrix.computational_view([matrix list])

  • skimming – if we will skim for all nodes or not

aequilibrae.paths.AoN.path_finding(long origin, double[:] graph_costs, long long[:] csr_indices, long long[:] graph_fs, long long[:] pred, long long[:] ids, long long[:] connectors, long long[:] reached_first) int#
aequilibrae.paths.AoN.put_path_file_on_disk(unsigned int orig, unsigned int[:] pred, long long[:] predecessors, unsigned int[:] conn, long long[:] connectors, long long[:] all_nodes, unsigned int[:] origins_to_write, unsigned int[:] nodes_to_write) void#
aequilibrae.paths.AoN.save_path_file(long origin_index, long num_links, long zones, long long[:] pred, long long[:] conn, string path_file, string index_file, bool write_feather) void#
aequilibrae.paths.AoN.skim_multiple_fields(long origin, long nodes, long zones, long skims, double[:, :] node_skims, long long[:] pred, long long[:] conn, double[:, :] graph_costs, long long[:] reached_first, long found, double[:, :] final_skims) void#
aequilibrae.paths.AoN.skimming_single_origin()#
Parameters
  • origin

  • graph

  • results

Returns

aequilibrae.paths.AoN.sum_a_times_b_minus_c()#
aequilibrae.paths.AoN.sum_a_times_b_minus_c_cython(double[:] array1, double[:] array2, double[:] array3, int cores) double#
aequilibrae.paths.AoN.sum_axis1()#
aequilibrae.paths.AoN.sum_axis1_cython(double[:] totals, double[:, :] multiples, int cores) void#
aequilibrae.paths.AoN.triple_linear_combination()#
aequilibrae.paths.AoN.triple_linear_combination_cython(double[:] stepsizes, double[:, :] results, double[:, :] array1, double[:, :] array2, double[:, :] array3, int cores) void#
aequilibrae.paths.AoN.triple_linear_combination_cython_skims(double[:] stepsizes, double[:, :, :] results, double[:, :, :] array1, double[:, :, :] array2, double[:, :, :] array3, int cores) void#
aequilibrae.paths.AoN.triple_linear_combination_skims()#
aequilibrae.paths.AoN.update_path_trace()#
Parameters
  • graph – AequilibraE graph. Needs to have been set with number of centroids and list of skims (if any)

  • results – AequilibraE Matrix properly set for computation using matrix.computational_view([matrix list])

  • skimming – if we will skim for all nodes or not

aequilibrae.paths.all_or_nothing module#

class aequilibrae.paths.all_or_nothing.allOrNothing(matrix: AequilibraeMatrix, graph: Graph, results: AssignmentResults)#

Bases: aequilibrae.utils.worker_thread.WorkerThread

assignment#
doWork()#
execute()#
func_assig_thread(origin, all_threads)#

aequilibrae.paths.assignment_paths module#

class aequilibrae.paths.assignment_paths.TrafficClassIdentifier(name: str, id: str)#

Bases: object

class aequilibrae.paths.assignment_paths.AssignmentResultsTable(table_name: str, project=None)#

Bases: object

get_traffic_class_names_and_id() List[aequilibrae.paths.assignment_paths.TrafficClassIdentifier]#
class aequilibrae.paths.assignment_paths.AssignmentPaths(table_name: str, project=None)#

Bases: object

Class for accessing path files optionally generated during assignment.

paths = AssignmentPath(table_name_with_assignment_results)
paths.get_path_for_destination(origin, destination, iteration, traffic_class_id)
read_path_file(origin: int, iteration: int, traffic_class_id: str) -> (<class 'pandas.core.frame.DataFrame'>, <class 'pandas.core.frame.DataFrame'>)#
get_path_for_destination(origin: int, destination: int, iteration: int, traffic_class_id: str)#

Return all link ids, i.e. the full path, for a given destination

static get_path_for_destination_from_files(path_o: pandas.core.frame.DataFrame, path_o_index: pandas.core.frame.DataFrame, destination: int)#

for a given path file and path index file, and a given destination, return the path links in o-d order

aequilibrae.paths.basic_path_finding module#

aequilibrae.paths.bpr module#

aequilibrae.paths.bpr2 module#

aequilibrae.paths.conical module#

aequilibrae.paths.graph module#

class aequilibrae.paths.graph.Graph(logger=None)#

Bases: object

Graph class

default_types(tp: str)#

Returns the default integer and float types used for computation

Arguments

tp (str): data type. ‘int’ or ‘float’

prepare_graph(centroids: numpy.ndarray) None#

Prepares the graph for a computation for a certain set of centroids

Under the hood, if sets all centroids to have IDs from 1 through n, which should correspond to the index of the matrix being assigned.

This is what enables having any node IDs as centroids, and it relies on the inference that all links connected to these nodes are centroid connectors.

Arguments

centroids (np.ndarray): Array with centroid IDs. Mandatory type Int64, unique and positive

Excludes a list of links from a graph by setting their B node equal to their A node

Arguments

links (list): List of link IDs to be excluded from the graph

set_graph(cost_field) None#

Sets the field to be used for path computation

Arguments

cost_field (str): Field name. Must be numeric

set_skimming(skim_fields: list) None#

Sets the list of skims to be computed

Arguments

skim_fields (list): Fields must be numeric

set_blocked_centroid_flows(block_centroid_flows) None#

Chooses whether we want to block paths to go through centroids or not.

Default value is True

Arguments

block_centroid_flows (bool): Blocking or not

save_to_disk(filename: str) None#

Saves graph to disk

Arguments

filename (str): Path to file. Usual file extension is aeg

load_from_disk(filename: str) None#

Loads graph from disk

Arguments

filename (str): Path to file

available_skims() List[str]#

Returns graph fields that are available to be set as skims

Returns

list (str): Field names

save_compressed_correspondence(path, mode_name, mode_id)#

Save graph and nodes_to_indices to disk

aequilibrae.paths.graph_building module#

aequilibrae.paths.inrets module#

aequilibrae.paths.linear_approximation module#

class aequilibrae.paths.linear_approximation.LinearApproximation(assig_spec, algorithm, project=None)#

Bases: aequilibrae.utils.worker_thread.WorkerThread

equilibration#
assignment#
calculate_conjugate_stepsize()#
calculate_biconjugate_direction()#
doWork()#
execute()#
calculate_stepsize()#

Calculate optimal stepsize in descent direction

check_convergence()#

Calculate relative gap and return True if it is smaller than desired precision

signal_handler(val)#

aequilibrae.paths.multi_threaded_aon module#

class aequilibrae.paths.multi_threaded_aon.MultiThreadedAoN#

Bases: object

prepare(graph, results)#

aequilibrae.paths.multi_threaded_skimming module#

class aequilibrae.paths.multi_threaded_skimming.MultiThreadedNetworkSkimming#

Bases: object

prepare(graph, results)#

aequilibrae.paths.network_skimming module#

class aequilibrae.paths.network_skimming.NetworkSkimming(graph, origins=None, project=None)#

Bases: aequilibrae.utils.worker_thread.WorkerThread

>>> from aequilibrae import Project
>>> from aequilibrae.paths.network_skimming import NetworkSkimming

>>> project = Project.from_path("/tmp/test_project")

>>> network = project.network
>>> network.build_graphs()

>>> graph = network.graphs['c']
>>> graph.set_graph(cost_field="distance")
>>> graph.set_skimming("distance")

>>> skm = NetworkSkimming(graph)
>>> skm.execute()

# The skim report (if any error generated) is available here
>>> skm.report
[]

# To access the skim matrix directly from its temporary file
>>> matrix = skm.results.skims

# Or you can save the results to disk
>>> skm.save_to_project('/tmp/skimming result.omx')

# Or specify the AequilibraE's matrix file format
>>> skm.save_to_project('skimming result', 'aem')

>>> project.close()
skimming#
doWork()#
execute()#

Runs the skimming process as specified in the graph

save_to_project(name: str, format='omx', project=None) None#

Saves skim results to the project folder and creates record in the database

Arguments

name (str): Name of the matrix. Same value for matrix record name and file (plus extension) format (str, Optional): File format (‘aem’ or ‘omx’). Default is ‘omx’ project (Project, Optional): Project we want to save the results to. Defaults to the active project

aequilibrae.paths.parallel_numpy module#

aequilibrae.paths.path_file_saving module#

aequilibrae.paths.pq_4ary_heap module#

aequilibrae.paths.setup_assignment module#

aequilibrae.paths.traffic_assignment module#

class aequilibrae.paths.traffic_assignment.TrafficAssignment(project=None)#

Bases: object

Traffic assignment class.

For a comprehensive example on use, see the Use examples page.

>>> from aequilibrae import Project
>>> from aequilibrae.matrix import AequilibraeMatrix
>>> from aequilibrae.paths import TrafficAssignment, TrafficClass

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

>>> graph = project.network.graphs['c'] # we grab the graph for cars
>>> graph.set_graph('free_flow_time') # let's say we want to minimize time
>>> graph.set_skimming(['free_flow_time', 'distance']) # And will skim time and distance
>>> graph.set_blocked_centroid_flows(True)

>>> proj_matrices = project.matrices

>>> demand = AequilibraeMatrix()
>>> demand = proj_matrices.get_matrix("demand_omx")

# We will only assign one user class stored as 'matrix' inside the OMX file
>>> demand.computational_view(['matrix'])

# Creates the assignment class
>>> assigclass = TrafficClass("car", graph, demand)

>>> assig = TrafficAssignment()

# The first thing to do is to add at list of traffic classes to be assigned
>>> assig.set_classes([assigclass])

# Then we set the volume delay function
>>> assig.set_vdf("BPR")  # This is not case-sensitive

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

>>> assig.execute() # we then execute the assignment

# If you want, it is possible to access the convergence report
>>> import pandas as pd
>>> convergence_report = pd.DataFrame(assig.assignment.convergence_report)

# Assignment results can be viewed as a Pandas DataFrame
>>> results_df = assig.results()

# Information on the assignment setup can be recovered with
>>> info = assig.info()

# Or save it directly to the results database
>>> results = assig.save_results(table_name='base_year_assignment')

# skims are here
>>> avg_skims = assigclass.results.skims # blended ones
>>> last_skims = assigclass._aon_results.skims # those for the last iteration
bpr_parameters = ['alpha', 'beta']#
all_algorithms = ['all-or-nothing', 'msa', 'frank-wolfe', 'fw', 'cfw', 'bfw']#
set_vdf(vdf_function: str) None#

Sets the Volume-delay function to be used

Arguments

vdf_function (str:) Name of the VDF to be used

set_classes(classes: List[aequilibrae.paths.traffic_class.TrafficClass]) None#

Sets Traffic classes to be assigned

Arguments

classes (List[TrafficClass]:) List of Traffic classes for assignment

add_class(traffic_class: aequilibrae.paths.traffic_class.TrafficClass) None#

Adds a traffic class to the assignment

Arguments

traffic_class (TrafficClass:) Traffic class

algorithms_available() list#

Returns all algorithms available for use

Returns

list: List of string values to be used with set_algorithm

set_algorithm(algorithm: str)#

Chooses the assignment algorithm. e.g. ‘frank-wolfe’, ‘bfw’, ‘msa’

‘fw’ is also accepted as an alternative to ‘frank-wolfe’

Arguments

algorithm (list): Algorithm to be used

set_vdf_parameters(par: dict) None#

Sets the parameters for the Volume-delay function.

Parameter values can be scalars (same values for the entire network) or network field names (link-specific values) - Examples: {‘alpha’: 0.15, ‘beta’: 4.0} or {‘alpha’: ‘alpha’, ‘beta’: ‘beta’}

Arguments

par (dict): Dictionary with all parameters for the chosen VDF

set_cores(cores: int) None#

Allows one to set the number of cores to be used AFTER traffic classes have been added

Inherited from AssignmentResults

Arguments

cores (int): Number of CPU cores to use

set_save_path_files(save_it: bool) None#

Turn path saving on or off.

Arguments

save_it (bool): Boolean to indicate whether paths should be saved

set_path_file_format(file_format: str) None#

Specify path saving format. Either parquet or feather.

Arguments

file_format (str): Name of file format to use for path files

set_time_field(time_field: str) None#

Sets the graph field that contains free flow travel time -> e.g. ‘fftime’

Arguments

time_field (str): Field name

set_capacity_field(capacity_field: str) None#

Sets the graph field that contains link capacity for the assignment period -> e.g. ‘capacity1h’

Arguments

capacity_field (str): Field name

execute() None#

Processes assignment

save_results(table_name: str, keep_zero_flows=True, project=None) None#

Saves the assignment results to results_database.sqlite

Method fails if table exists

Arguments

table_name (str): Name of the table to hold this assignment result keep_zero_flows (bool): Whether we should keep records for zero flows. Defaults to True project (Project, Optional): Project we want to save the results to. Defaults to the active project

results() pandas.core.frame.DataFrame#

Prepares the assignment results as a Pandas DataFrame

Returns

DataFrame (pd.DataFrame): Pandas dataframe with all the assignment results indexed on link_id

report() pandas.core.frame.DataFrame#

Returns the assignment convergence report

Returns

DataFrame (pd.DataFrame): Convergence report

info() dict#

Returns information for the traffic assignment procedure

Dictionary contains keys ‘Algorithm’, ‘Classes’, ‘Computer name’, ‘Procedure ID’, ‘Maximum iterations’ and ‘Target RGap’.

The classes key is also a dictionary with all the user classes per traffic class and their respective matrix totals

Returns

info (dict): Pandas dataframe with all the assignment results indexed on link_id

save_skims(matrix_name: str, which_ones='final', format='omx', project=None) None#

Saves the skims (if any) to the skim folder and registers in the matrix list

Arguments

name (str): Name of the matrix record to hold this matrix (same name used for file name) which_ones (str,optional): {‘final’: Results of the final iteration, ‘blended’: Averaged results for all iterations, ‘all’: Saves skims for both the final iteration and the blended ones} Default is ‘final’ format (str, Optional): File format (‘aem’ or ‘omx’). Default is ‘omx’ project (Project, Optional): Project we want to save the results to. Defaults to the active project

Returns a dataframe of the select link flows for each class

Saves the select link link flows for all classes into the results database. Additionally, it exports the OD matrices into OMX format.

Arguments

table_name (str): Name of the table being inserted to. Note the traffic class project (Project, Optional): Project we want to save the results to. Defaults to the active project

Saves the Select Link matrices for each TrafficClass in the current TrafficAssignment class

Saves both the Select Link matrices and flow results at the same time, using the same name.

Note

Note the Select Link matrices will have _SL_matrices.omx appended to the end for ease of identification. e.g. save_select_link_results(“Car”) will result in the following names for the flows and matrices: Select Link Flows: inserts the select link flows for each class into the database with the table name: Car Select Link Matrices (only exports to OMX format): Car.omx

Arguments

name (str): name of the matrices

aequilibrae.paths.traffic_class module#

class aequilibrae.paths.traffic_class.TrafficClass(name: str, graph: aequilibrae.paths.graph.Graph, matrix: aequilibrae.matrix.aequilibrae_matrix.AequilibraeMatrix)#

Bases: object

Traffic class for equilibrium traffic assignment

>>> from aequilibrae import Project
>>> from aequilibrae.matrix import AequilibraeMatrix
>>> from aequilibrae.paths import TrafficClass

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

>>> graph = project.network.graphs['c'] # we grab the graph for cars
>>> graph.set_graph('free_flow_time') # let's say we want to minimize time
>>> graph.set_skimming(['free_flow_time', 'distance']) # And will skim time and distance
>>> graph.set_blocked_centroid_flows(True)

>>> proj_matrices = project.matrices

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

>>> tc = TrafficClass("car", graph, demand)
>>> tc.set_pce(1.3)
set_pce(pce: Union[float, int]) None#

Sets Passenger Car equivalent

Arguments

pce (Union[float, int]): PCE. Defaults to 1 if not set

set_fixed_cost(field_name: str, multiplier=1)#

Sets value of time

Arguments

field_name (str): Name of the graph field with fixed costs for this class multiplier (Union[float, int]): Multiplier for the fixed cost. Defaults to 1 if not set

set_vot(value_of_time: float) None#

Sets value of time

Arguments

value_of_time (Union[float, int]): Value of time. Defaults to 1 if not set

Set the selected links. Checks if the links and directions are valid. Translates link_id and direction into unique link id used in compact graph. Supply links=None to disable select link analysis.

Arguments
links (Union[None, Dict[str, List[Tuple[int, int]]]]): name of link set and

Link IDs and directions to be used in select link analysis

aequilibrae.paths.vdf module#

class aequilibrae.paths.vdf.VDF#

Bases: object

Volume-Delay function

>>> from aequilibrae.paths import VDF

>>> vdf = VDF()
>>> vdf.functions_available()
['bpr', 'bpr2', 'conical', 'inrets']
functions_available() list#

returns a list of all functions available

Module contents#