Repository navigation
Smoothing crashing due to indexing error #303
Description
Activity
Also getting this error, with polar-route 1.0.0 (both python interface and CLI) when waypoint splitting is on, using an 'empty' open water mesh from the basic example (https://colab.research.google.com/drive/1N1mxOy2oX7bEGtPy7Ztshrs4Fs_7lBpV?usp=sharing#scrollTo=i-PJy6KMiLk9)
Route config
{ "objective_function": "traveltime", "path_variables": [ "fuel", "traveltime" ], "vector_names": [ "uC", "vC" ], "zero_currents": false, "variable_speed": true, "time_unit": "days", "early_stopping_criterion": true, "save_dijkstra_graphs": true, "waypoint_splitting": true, "smoothing_merge_separation": 1e-3, "smoothing_converged_sep": 1e-3, "smooth_path": { "max_iteration_number": 1000, "minimum_difference": 0.0005 } }The new bits of the config that result in this behaviour are:
"waypoint_splitting": true, "smoothing_merge_separation": 1e-3, "smoothing_converged_sep": 1e-3,
Output and stack trace:
❯ optimise_routes traveltime.config.json open_water.vessel.json waypoints_example.csv -o open_water.route.json [24-10-24 12:26:07 :INFO ] - optimise_routes 1.0.0 [24-10-24 12:26:07 :INFO ] - Initialising Route Planner [24-10-24 12:26:07 :INFO ] - Calculating Dijkstra routes [24-10-24 12:26:07 :INFO ] - Splitting around waypoints ! [24-10-24 12:26:07 :INFO ] - ============= Dijkstra Route Creation ============ [24-10-24 12:26:07 :INFO ] - - Objective = traveltime [24-10-24 12:26:07 :INFO ] - --- Processing Source Waypoint = Start [24-10-24 12:26:07 :INFO ] - Destination waypoint: End [24-10-24 12:26:08 :INFO ] - Dijkstra routing complete... [24-10-24 12:26:08 :INFO ] - Timed call to compute_routes took 0.813959 seconds [24-10-24 12:26:08 :INFO ] - Calculating smoothed routes [24-10-24 12:26:08 :INFO ] - ========= Determining Smoothed Routes =========== [24-10-24 12:26:08 :INFO ] - --- Smoothing Route - Start to End Traceback (most recent call last): File ".../bin/optimise_routes", line 8, in <module> sys.exit(optimise_routes_cli()) ^^^^^^^^^^^^^^^^^^^^^ File ".../polar_route/utils.py", line 238, in wrapper res = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File ".../polar_route/cli.py", line 202, in optimise_routes_cli smoothed_routes = rp.compute_smoothed_routes() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".../polar_route/utils.py", line 238, in wrapper res = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File ".../polar_route/route_planner/route_planner.py", line 700, in compute_smoothed_routes sf.forward() File ".../polar_route/route_planner/crossing_smoothing.py", line 1327, in forward if self.previous_diagonals(edge_a, edge_b, firstpoint, lastpoint): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".../polar_route/route_planner/crossing_smoothing.py", line 1176, in previous_diagonals edge_b_start_index = edge_b.start['id'] ~~~~~~~~~~~~^^^^^^ TypeError: 'NoneType' object is not subscriptable
Thanks @davidwilby for the info. Will look into the issue first thing tomorrow !
To add to this, if it's helpful, I've run this with the 'real data example' from the docs and get the same bug with waypoint_splitting switched on, and not when it's off.
Thanks David this has been really useful. As you say I think it's in the splitting around waypoints, currently correcting this in the work, will keep you updated when fixed
- linked a pull request that will close this issueBug Fixing - Path Smoothing failures #308
on Nov 4, 2024
Smoothing is crashing in a mesh with only land masses (no SIC, no currents, just a GRF elevation dataloader). I've plotted the mesh and I can't see anything obvious causing it.
Attached are the vessel mesh file, route config, waypoints used to create the crash, along with the dijkstra route saved out before the crash.
index_issue.zip