HOG2
|
A templated version of A*, based on HOG genericAStar. More...
#include <PEAStar.h>
Public Member Functions | |
PEAStar () | |
virtual | ~PEAStar () |
void | GetPath (environment *env, const state &from, const state &to, std::vector< state > &thePath) |
Perform an A* search between two states. More... | |
void | GetPath (environment *, const state &, const state &, std::vector< action > &) |
bool | InitializeSearch (environment *env, const state &from, const state &to, std::vector< state > &thePath) |
Initialize the A* search. More... | |
bool | DoSingleSearchStep (std::vector< state > &thePath) |
Expand a single node. More... | |
void | AddAdditionalStartState (state &newState) |
Add additional start state to the search. More... | |
void | AddAdditionalStartState (state &newState, double cost) |
Add additional start state to the search. More... | |
state | CheckNextNode () |
Returns the next state on the open list (but doesn't pop it off the queue). More... | |
void | ExtractPathToStart (state &node, std::vector< state > &thePath) |
void | ExtractPathToStartFromID (uint64_t node, std::vector< state > &thePath) |
Get the path from a goal state to the start state. More... | |
virtual const char * | GetName () |
Return the name of the algorithm. More... | |
void | PrintStats () |
A function that prints the number of states in the closed list and open queue. More... | |
uint64_t | GetUniqueNodesExpanded () |
void | ResetNodeCount () |
int | GetMemoryUsage () |
Return the amount of memory used by PEAStar. More... | |
bool | GetClosedListGCost (const state &val, double &gCost) const |
Get state from the closed list. More... | |
unsigned int | GetNumOpenItems () |
const AStarOpenClosedData< state > & | GetOpenItem (unsigned int which) |
const int | GetNumItems () |
const AStarOpenClosedData< state > & | GetItem (unsigned int which) |
bool | HaveExpandedState (const state &val) |
void | SetReopenNodes (bool re) |
bool | GetReopenNodes () |
void | SetHeuristic (Heuristic< state > *h) |
uint64_t | GetNodesExpanded () const |
uint64_t | GetNodesTouched () const |
void | LogFinalStats (StatCollection *) |
void | SetStopAfterGoal (bool val) |
bool | GetStopAfterGoal () |
void | OpenGLDraw () const |
Draw the open/closed list. More... | |
void | SetWeight (double w) |
Public Member Functions inherited from GenericSearchAlgorithm< state, action, environment > | |
GenericSearchAlgorithm () | |
virtual | ~GenericSearchAlgorithm () |
virtual void | OpenGLDraw (const environment *env) const |
Public Attributes | |
AStarOpenClosed< state, PEAStarCompare< state > > | openClosedList |
state | goal |
state | start |
Private Attributes | |
std::vector< state > | succ |
uint64_t | nodesTouched |
uint64_t | nodesExpanded |
environment * | env |
bool | stopAfterGoal |
double | weight |
bool | reopenNodes |
uint64_t | uniqueNodesExpanded |
Heuristic< state > * | theHeuristic |
A templated version of A*, based on HOG genericAStar.
|
inline |
Definition at line 68 of file PEAStar.h.
References PEAStar< state, action, environment >::env, PEAStar< state, action, environment >::reopenNodes, PEAStar< state, action, environment >::ResetNodeCount(), PEAStar< state, action, environment >::stopAfterGoal, and PEAStar< state, action, environment >::weight.
void PEAStar< state, action, environment >::AddAdditionalStartState | ( | state & | newState | ) |
void PEAStar< state, action, environment >::AddAdditionalStartState | ( | state & | newState, |
double | cost | ||
) |
state PEAStar< state, action, environment >::CheckNextNode |
|
virtual |
Expand a single node.
thePath | will contain an optimal path from start to goal if the function returns TRUE |
Reimplemented from GenericSearchAlgorithm< state, action, environment >.
Definition at line 247 of file PEAStar.h.
References fequal(), fgreater(), fless(), kClosedList, kNotFound, and kOpenList.
|
inline |
void PEAStar< state, action, environment >::ExtractPathToStartFromID | ( | uint64_t | node, |
std::vector< state > & | thePath | ||
) |
Get the path from a goal state to the start state.
goalNode | the goal state |
thePath | will contain the path from goalNode to the start state |
Definition at line 375 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::ExtractPathToStart().
bool PEAStar< state, action, environment >::GetClosedListGCost | ( | const state & | val, |
double & | gCost | ||
) | const |
Get state from the closed list.
val | The state to lookup in the closed list @gCost The g-cost of the node in the closed list |
Definition at line 422 of file PEAStar.h.
References kClosedList.
|
inline |
Definition at line 102 of file PEAStar.h.
References AStarOpenClosed< state, CmpKey, dataStructure >::Lookat(), and PEAStar< state, action, environment >::openClosedList.
int PEAStar< state, action, environment >::GetMemoryUsage |
|
virtual |
Return the name of the algorithm.
Implements GenericSearchAlgorithm< state, action, environment >.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 111 of file PEAStar.h.
References PEAStar< state, action, environment >::nodesExpanded.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 112 of file PEAStar.h.
References PEAStar< state, action, environment >::nodesTouched.
|
inline |
Definition at line 101 of file PEAStar.h.
References PEAStar< state, action, environment >::openClosedList, and AStarOpenClosed< state, CmpKey, dataStructure >::size().
|
inline |
Definition at line 99 of file PEAStar.h.
References PEAStar< state, action, environment >::openClosedList, and AStarOpenClosed< state, CmpKey, dataStructure >::OpenSize().
|
inline |
Definition at line 100 of file PEAStar.h.
References AStarOpenClosed< state, CmpKey, dataStructure >::GetOpenItem(), AStarOpenClosed< state, CmpKey, dataStructure >::Lookat(), and PEAStar< state, action, environment >::openClosedList.
|
inlinevirtual |
|
virtual |
Perform an A* search between two states.
_env | The search environment |
from | The start state |
to | The goal state |
thePath | A vector of states which will contain an optimal path between from and to when the function returns, if one exists. |
Implements GenericSearchAlgorithm< state, action, environment >.
|
inline |
Definition at line 107 of file PEAStar.h.
References PEAStar< state, action, environment >::reopenNodes.
|
inline |
Definition at line 117 of file PEAStar.h.
References PEAStar< state, action, environment >::stopAfterGoal.
|
inline |
Definition at line 90 of file PEAStar.h.
References PEAStar< state, action, environment >::uniqueNodesExpanded.
|
inline |
Definition at line 103 of file PEAStar.h.
References PEAStar< state, action, environment >::env, kNotFound, AStarOpenClosed< state, CmpKey, dataStructure >::Lookup(), and PEAStar< state, action, environment >::openClosedList.
|
virtual |
Initialize the A* search.
_env | The search environment |
from | The start state |
to | The goal state |
Reimplemented from GenericSearchAlgorithm< state, action, environment >.
|
inlinevirtual |
|
virtual |
Draw the open/closed list.
Reimplemented from GenericSearchAlgorithm< state, action, environment >.
Definition at line 441 of file PEAStar.h.
References AStarOpenClosedData< state >::data, kClosedList, kOpenList, AStarOpenClosedData< state >::reopened, and AStarOpenClosedData< state >::where.
void PEAStar< state, action, environment >::PrintStats |
|
inline |
Definition at line 91 of file PEAStar.h.
References PEAStar< state, action, environment >::nodesExpanded, PEAStar< state, action, environment >::nodesTouched, and PEAStar< state, action, environment >::uniqueNodesExpanded.
Referenced by PEAStar< state, action, environment >::PEAStar().
|
inline |
Definition at line 109 of file PEAStar.h.
References PEAStar< state, action, environment >::theHeuristic.
|
inline |
Definition at line 106 of file PEAStar.h.
References PEAStar< state, action, environment >::reopenNodes.
|
inline |
Definition at line 116 of file PEAStar.h.
References PEAStar< state, action, environment >::stopAfterGoal.
|
inline |
Definition at line 121 of file PEAStar.h.
References PEAStar< state, action, environment >::weight.
|
private |
Definition at line 125 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::ExtractPathToStart(), PEAStar< state, action, environment >::HaveExpandedState(), and PEAStar< state, action, environment >::PEAStar().
state PEAStar< state, action, environment >::goal |
|
private |
Definition at line 124 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::GetNodesExpanded(), and PEAStar< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 124 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::GetNodesTouched(), and PEAStar< state, action, environment >::ResetNodeCount().
AStarOpenClosed<state, PEAStarCompare<state> > PEAStar< state, action, environment >::openClosedList |
Definition at line 72 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::ExtractPathToStart(), PEAStar< state, action, environment >::GetItem(), PEAStar< state, action, environment >::GetNumItems(), PEAStar< state, action, environment >::GetNumOpenItems(), PEAStar< state, action, environment >::GetOpenItem(), and PEAStar< state, action, environment >::HaveExpandedState().
|
private |
Definition at line 130 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::GetReopenNodes(), PEAStar< state, action, environment >::PEAStar(), and PEAStar< state, action, environment >::SetReopenNodes().
state PEAStar< state, action, environment >::start |
|
private |
Definition at line 126 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::GetStopAfterGoal(), PEAStar< state, action, environment >::PEAStar(), and PEAStar< state, action, environment >::SetStopAfterGoal().
|
private |
|
private |
Definition at line 132 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::SetHeuristic().
|
private |
Definition at line 131 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::GetUniqueNodesExpanded(), and PEAStar< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 128 of file PEAStar.h.
Referenced by PEAStar< state, action, environment >::PEAStar(), and PEAStar< state, action, environment >::SetWeight().