space-search
A library providing basic generic depth-first, breadth-first, and heuristic-guided search space exploration algorithms.
Implement Searchable to perform breadth-first or depth-first searching, and implement ScoredSearchable to perform heuristically guided search space exploration. Pass them to Searcher to create an iterator that will search for a solution.
Searcher requires that you specify a Manager type that determines the strategy, return result, and optimization of the search algorithm. Choose one of the searchers defined in the hierarchy of the search module to fit your individual needs.
- Implement
ScoredSearchableto utilize theguidedsearch strategy based managers, which will prioritize searching states with a lower associated score first. If implementingScoredSearchableis too complex or unnecessary for your use case, then you may use theunguidedsearch managers, which explore the space naively in a depth-first or breadth-first manner, toggleable by a flag on the manager itself. - Implement
Eq + Hash + Clonefor yourSearchabletype to benefit from prior explored state checking optimization using ahashablemanager; if youre unable to, then use anunhashablemanager, which does not require these additional bounds, but will likely explore the space much less efficiently. - Use a
routebased manager to yield results consisting of the sequence of steps taken from the starting state to the ending state. Use ano_routemanager to just yield the solution state alone.
When implementing ScoredSearchable, make sure that lower scoring states are closer to a solution.
use *;
use ;
;
let mut searcher: =
new;
assert_eq!;
Todo
- A* shortest path algorithm implementation