KrisLibrary
1.0.0
|
#include <GeneralizedAStar.h>
Public Types | |
typedef struct GeneralizedAStar< S, C >::Node | Node |
Public Member Functions | |
virtual void | ClearVisited () |
virtual void | Visit (const S &s, Node *n) |
virtual Node * | VisitedStateNode (const S &s) |
Public Member Functions inherited from AI::GeneralizedAStar< S, C > | |
GeneralizedAStar (const S &start) | |
void | SetStart (const S &start) |
Resets the search from the given start state. | |
bool | Search () |
Performs search until a goal is reached. | |
bool | SearchStep () |
Performs a single iteration of search. | |
bool | SearchFailed () |
Returns true if search failed. | |
int | NumNodes () const |
Returns the number of nodes in the tree. | |
int | NumExpanded () const |
Returns the number of previously expanded nodes. | |
int | NumDescendents (const Node &n) const |
Returns the number of descendents of n. | |
C | TopPriority () const |
Returns the priority of the next node to be expanded. | |
bool | GoalFound () const |
Returns true if the goal has been found. | |
C | GoalCost () const |
const std::vector< S > & | GoalPath () const |
Returns path of states to the goal. | |
virtual bool | IsGoal (const S &s)=0 |
The following must be overloaded by the subclass. | |
virtual void | Successors (const S &s, std::vector< S > &successors, std::vector< C > &costs)=0 |
virtual C | Heuristic (const S &s) |
virtual bool | OnExpand (Node *n) |
Public Attributes | |
UNORDERED_MAP_TEMPLATE< S, Node * > | visited |
Public Attributes inherited from AI::GeneralizedAStar< S, C > | |
bool | testGoalOnGeneration |
C | zero |
Node | root |
The A* search tree. | |
IndexedPriorityQueue< Node *, std::pair< C, C > > | fringe |
std::vector< S > | successors |
Temporary variables – slightly reduces the number of memory allocations. | |
std::vector< C > | costs |
int | numNodes |
Node * | goal |
Upon successful termination, goal contains the goal node. | |
std::vector< S > | path |
Upon successful termination, path contains the path from start to goal. | |
Convenience class: uses a std::unordered_map to store visited nodes. Requires S to be a hashable type.
|
inlinevirtual |
Optionally, overload these functions. If not overloaded, does no visited test
Reimplemented from AI::GeneralizedAStar< S, C >.
References AI::GeneralizedAStar< S, C >::goal, AI::GeneralizedAStar< S, C >::SetStart(), and AI::GeneralizedAStar< S, C >::testGoalOnGeneration.