UBCSailbot / raye-global-pathfinding

UBC Sailbot's Global Pathfinding Repository: A* pathfinding that creates sailing paths with minimized length and desirable wind speeds throughout.
MIT License
5 stars 1 forks source link

Store planet #57

Closed tylerlum closed 2 years ago

tylerlum commented 2 years ago

Generating planets can be very time consuming, especially for higher resolution. However, for a given planet size, the planet should be the same every time. Thus, we are able to cache the planet to reduce runtime.

To store a planet, run

./build/bin/pathfinder_cli -p 12 --navigate 48 235 21 203 --store_planet

This creates a planet with size 12, and then stores it at cached_planets/size_12.txt.

To use a stored a planet, run

./build/bin/pathfinder_cli -p 12 --navigate 48 235 21 203 --use_cached_planet

This reads from cached_planets/size_12.txt to create the planet. It should be nearly identical, except for small rounding errors.

TODO: Investigate if we can store more planet sizes using Git LFS or could just have a link here to a file.

tylerlum commented 2 years ago

To validate: Generated path with new or with cached results in the same path (check visually). For some reason, I get slightly different distance cost because there are extra points, but the path look identical (redundant nodes). The wind cost is the same too. Let me know if that is the case for you as well @kpfgallagher

tylerlum commented 2 years ago
➜  global-pathfinding git:(StorePlanet) ✗ ./build/bin/pathfinder_cli -p 12 --navigate 48 235 21 203 --use_cached_planet
Looking for cached planet at cached_planets/size_12.txt
Planet Generation Complete (42.118265s)

Pretty good results using cache. 42s image

tylerlum commented 2 years ago
➜  global-pathfinding git:(StorePlanet) ✗ ./build/bin/pathfinder_cli -p 12 --navigate 48 235 21 203 --save             
Generating HexPlanet of Size: 12
[=============================================================>        ] 87% | Computing indirect vertex neighbours...
Planet Generation Complete (289.330859s)

Baseline: Takes 289s (5min), which is much longer than the less than 1 min with cached.

image

Appears identical