Deltares / ra2ce

RA2CE helps to quantify resilience of critical infrastructure networks, prioritize interventions and adaptation measures and select the most appropriate action perspective to increase resilience considering future conditions.
https://deltares.github.io/ra2ce/
Other
7 stars 1 forks source link

Fix weighing == time for OD analyses #472

Closed ArdtK closed 2 weeks ago

ArdtK commented 4 weeks ago

Context During development of #433 it was found that also OD-analyses will fail when using weighing == time.

Problem If weighing == time all edges should have a valid value for attribute time. If not this message is thrown:

No path between <origin node> and <destination node> This can be triggered by calling one of these functions:

  • nx.shortest_path;
  • nx.dijkstra_path_length.

Options

  1. Fix it in the different analyses.
  2. Preprocess the networks so that attributes length, time and avgspeed are present on all edges. <- PREFERRED

Scope

Notes After this the code changed in #433 can be simplified further.

ArdtK commented 4 weeks ago

Can be reproduced by example_origin_destination_analysis and example_optimal_route_origin_destination:

from ra2ce.analysis.analysis_config_data.enums.weighing_enum import WeighingEnum

handler = Ra2ceHandler(network=network_ini, analysis=analysis_ini)
handler.input_config.analysis_config.config_data.analyses[0].weighing = WeighingEnum.TIME
handler.configure()
handler.run_analysis()
ArdtK commented 3 weeks ago

Analysis nx.shortest_path is used in:

nx.dijkstra_path_length is used in:

These work on the next inputs:

This means that on all graphs the right attributes should be added:

Conclusion As the _hazard graphs are derived from the base graphs, fixing it on base_graph and origin_destinations_graph should be sufficient. Thus option 2. sounds the most viable.

ArdtK commented 3 weeks ago

Current flow avg_speed File avg_speed.csv is read/created on creation of OSM/Vector network.

Vector (vector_network_wrapper) If the network has attribute length on all edges and maxspeed on 1 or more edges:

OSM (osm_network_wrapper) Same logic as for Vector.

Questions