KrisLibrary  1.0.0
Public Types | Public Member Functions | Public Attributes | List of all members
AI::GeneralizedAStarWithHashMap< S, C > Class Template Reference

#include <GeneralizedAStar.h>

Inheritance diagram for AI::GeneralizedAStarWithHashMap< S, C >:
AI::GeneralizedAStar< S, C >

Public Types

typedef struct GeneralizedAStar< S, C >::Node Node
 

Public Member Functions

virtual void ClearVisited ()
 
virtual void Visit (const S &s, Node *n)
 
virtual NodeVisitedStateNode (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.
 
TopPriority () const
 Returns the priority of the next node to be expanded.
 
bool GoalFound () const
 Returns true if the goal has been found.
 
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
 
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
 
Nodegoal
 Upon successful termination, goal contains the goal node.
 
std::vector< S > path
 Upon successful termination, path contains the path from start to goal.
 

Detailed Description

template<class S, class C>
class AI::GeneralizedAStarWithHashMap< S, C >

Convenience class: uses a std::unordered_map to store visited nodes. Requires S to be a hashable type.

Member Function Documentation

template<class S , class C >
virtual void AI::GeneralizedAStarWithHashMap< S, C >::ClearVisited ( )
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.


The documentation for this class was generated from the following file: