subh83 / DOSL

Discrete Optimal Search Library (DOSL): A template-based C++ library for searching, path-finding and exploring discrete spaces such as graphs and simplicial complexes
GNU General Public License v3.0
45 stars 23 forks source link

One-time use? #2

Closed PascalSoftwares closed 1 year ago

PascalSoftwares commented 1 year ago

Every examples in repository uses searchproblem instance only once for a path and ditch. Is this supposed to be use like this? Is any way to rerun with new start/goals preserving algorithm instance allocation?

PascalSoftwares commented 1 year ago

Built in algorithms are not actually implemented. I was curious that a example is much slower than expected, and visits excessively large number of nodes and found out G heuristics is costatnt ZERO in source. In A implementation the solver acts just as normal Dijkstra because goal location is invisible from algorithm and current node does not measure heuristics to goal. Even image in main .md proves it - the node expansion image is perfect circle. A* should not work like that.

subh83 commented 1 year ago

hello,

You can call the 'AStart::Algorithm<>::clear' function to clear a search, and rerun with a new start/goal.

In order to use a non-zero heuristic function with A*, you'll need to define the 'AStar::Algorithm<>::getHeuristics' member function in your 'searchProblem' class. Otherwise, by default, a zero heuristic is assumed (which is equivalent to Dijkstra's). You are correct that almost all the examples provided (except the 'map2d_encapsulated_HomotopyPathPlanning' example) used the default heuristic of zero. I can understand how that could have lead to your current confusion/misunderstanding.

In the example programs of the latest version/commit, a non-zero heuristic function has been explicitly used in the examples 'minimal2d_PathPlanning_AStar' and 'map2d_PathPlanning', as well as in the bare-bones example in README.md . Hope this alleviates the confusion.

The examples are meant as basic demonstration and do not exhaustively cover every aspect of the library. Based on the requirements of your particular application you'll need to explore the available functionalities within the library. The documentation on DOSL is arguably limited, and you may need to dig into the code a little bit to figure out and make use of the features that you need.

Best, subhrajit.