revrt.routing.cli.point_to_point.compute_lcp_routes#

compute_lcp_routes(cost_fpath, route_table_fpath, out_dir, job_name, routing_options, drivers=None, transition_costs=None, tracked_layers=None, transmission_config=None, save_paths=False, save_routing_layer=False, invalid_costs_block_routing=False, memory_utilization_limit=0.9, system_mem_limit_gb=5, _split_params=None, algorithm='bidirectional_long_range_dijkstra')[source]#

Run least-cost path routing for pairs of points

Given a table that defines start and end points (via latitude and longitude inputs; see the route_table parameter), compute the least-cost paths (LCPs) between each pair of points using the routing layers defined in routing_options.

Parameters:
  • cost_fpath (path-like) – Path to layered Zarr file containing cost and other required routing layers.

  • route_table_fpath (path-like) –

    Path to CSV file defining the start and end points of all routes. Must have the following columns:

    • ”start_lat”: Stating point latitude

    • ”start_lon”: Stating point longitude

    • ”end_lat”: Ending point latitude

    • ”end_lon”: Ending point longitude

    You can also specify polarity and voltage columns which apply to every routing option. If you want to provide per-option polarity and voltage, use polarity_<option> and voltage_<option>. Options that are omitted will use polarity and voltage column values.

  • out_dir (path-like) – Directory where routing outputs should be written.

  • job_name (str) – Label used to name the generated output file.

  • routing_options (dict) – Mapping of routing-option names to dictionaries describing the cost, friction, barrier, and option-level multiplier inputs for each option. See RoutingOptionConfig for details.

  • drivers (dict, optional) – Optional driver-rule configuration keyed by routing option. See DriverConfig for details.

  • transition_costs (dict, optional) – Optional transition-cost configuration between routing options. See TransitionCostsConfig for details.

  • tracked_layers (list, optional) – List of dictionaries defining route-characterization layers. These layers do not influence the routing objective and are only summarized for output characterization. See TrackedLayer for details.

  • transmission_config (path-like or dict, optional) –

    Dictionary of transmission cost configuration values, or path to JSON/JSON5 file containing this dictionary. The dictionary should have a subset of the following keys:

    • base_line_costs

    • iso_lookup

    • iso_multipliers

    • land_use_classes

    • new_substation_costs

    • power_classes

    • power_to_voltage

    • transformer_costs

    • upgrade_substation_costs

    • voltage_polarity_mult

    • row_width

    Each of these keys should point to another dictionary or path to JSON/JSON5 file containing a dictionary of configurations for each section. For the expected contents of each dictionary, see the default config. If None, values from the default config are used. By default, None.

  • save_paths (bool, default False) – Save outputs as a GeoPackage with path geometries when True. Defaults to False.

  • save_routing_layer (bool, default False) – Save Rust routing layer outputs to out_dir/extra_outputs when True. Defaults to False.

  • invalid_costs_block_routing (bool, optional) – Optional flag to treat any invalid cost values (<= 0) as impassable (i.e. no paths can ever cross this). If False, invalid cost values (<= 0) are set to a large value to simulate a strong but permeable “quasi-barrier”. By default, False.

  • algorithm (str, default "bidirectional_long_range_dijkstra") – Routing algorithm implementation to use. Supported values are "astar", "long_range_astar", "long_range_dijkstra", "bidirectional_long_range_dijkstra", and "dijkstra". "astar" and "dijkstra" are in-memory implementations that do not respect the memory limit. Prefer a long-range option unless you know for a fact that your route computations will not need much memory and speed is very important to you. By default, "bidirectional_long_range_dijkstra".

  • memory_utilization_limit (float, default 0.9) – Fraction of system_mem_limit_gb to utilize for routing. Should be a value between 0 and 1. By default, 0.9.

  • system_mem_limit_gb (int or float, default 5) – Maximum amount of system memory (in GB) to utilize for routing. This is used in conjunction with memory_utilization_limit to determine the memory limit for routing. By default, 5 GB.

Returns:

str or None – Path to the output table if any routes were computed.

See also

revrt.routing.cli.point_to_feature.compute_lcp_routes

Compute LCP routes between points and features.