Open devjolan opened 2 days ago
Hello @devjolan .
Thanks for pointing this out.
In the past we focused on CPU performance and made some great improvements but I also like to shine a light on memory consumption as well. With your proposed cache might take a lot memory (especially if a path can not be found and we searched the whole map - in that case the cache references every cell).
As we always keep a reference to a parent node, I think there is some potential for using the edge nodes and use some back-tracking to clean up the map.
I am very busy right now, but as I will do the lecture slot on path finding as part of the robotics introduction for the computer science students at University Bremen I will discuss this and (possible) other solutions with the students mid of December.
Hi. Thank you for your library.
I am implementing path precalculation for given move map (black and white image) with size 1024*1024 and 11k edges on it and always after first iteration path finding takes ~300ms, but first path find is ~1ms.
I've found that this massive time loss was in
pathfinding/core/grid.py
in functioncleanup
:In my case with this grid size every path find iteration cleaned 1024*1024 nodes what was very slow.
Maybe not best solution but i've modified library source to cache nodes that was used by path finding (only for
A*
andGrid
just for my problem solving).My solution:
pathfinding/core/grid.py
pathfinding/finder/finder.py
pathfinding/finder/a_star.py
Some tests
Before modification
After modification
Minimal project for testing
TestPathFind.zip