HOG2
|
A templated version of A*, based on HOG genericAStar. More...
#include <EPEAStar.h>
Public Member Functions | |
EPEAStar () | |
virtual | ~EPEAStar () |
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 EPEAOpenClosedData< state > & | GetOpenItem (unsigned int which) |
const int | GetNumItems () |
const EPEAOpenClosedData< 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, EPEAStarCompare< state >, EPEAOpenClosedData< xyLoc > > | openClosedList |
state | goal |
state | start |
Private Attributes | |
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.
Definition at line 82 of file EPEAStar.h.
|
inline |
Definition at line 84 of file EPEAStar.h.
References EPEAStar< state, action, environment >::env, EPEAStar< state, action, environment >::reopenNodes, EPEAStar< state, action, environment >::ResetNodeCount(), EPEAStar< state, action, environment >::stopAfterGoal, and EPEAStar< state, action, environment >::weight.
|
inlinevirtual |
Definition at line 85 of file EPEAStar.h.
void EPEAStar< state, action, environment >::AddAdditionalStartState | ( | state & | newState | ) |
Add additional start state to the search.
This should only be called after Initialize Search and before DoSingleSearchStep.
Definition at line 235 of file EPEAStar.h.
void EPEAStar< state, action, environment >::AddAdditionalStartState | ( | state & | newState, |
double | cost | ||
) |
Add additional start state to the search.
This should only be called after Initialize Search
Definition at line 246 of file EPEAStar.h.
state EPEAStar< state, action, environment >::CheckNextNode |
Returns the next state on the open list (but doesn't pop it off the queue).
Definition at line 349 of file EPEAStar.h.
|
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 262 of file EPEAStar.h.
References fless(), kClosedList, kNotFound, and kOpenList.
|
inline |
void EPEAStar< 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 367 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::ExtractPathToStart().
bool EPEAStar< 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 414 of file EPEAStar.h.
References kClosedList.
|
inline |
Definition at line 118 of file EPEAStar.h.
References AStarOpenClosed< state, CmpKey, dataStructure >::Lookat(), and EPEAStar< state, action, environment >::openClosedList.
int EPEAStar< state, action, environment >::GetMemoryUsage |
Return the amount of memory used by PEAStar.
Definition at line 398 of file EPEAStar.h.
|
virtual |
Return the name of the algorithm.
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 161 of file EPEAStar.h.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 127 of file EPEAStar.h.
References EPEAStar< state, action, environment >::nodesExpanded.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 128 of file EPEAStar.h.
References EPEAStar< state, action, environment >::nodesTouched.
|
inline |
Definition at line 117 of file EPEAStar.h.
References EPEAStar< state, action, environment >::openClosedList, and AStarOpenClosed< state, CmpKey, dataStructure >::size().
|
inline |
Definition at line 115 of file EPEAStar.h.
References EPEAStar< state, action, environment >::openClosedList, and AStarOpenClosed< state, CmpKey, dataStructure >::OpenSize().
|
inline |
Definition at line 116 of file EPEAStar.h.
References AStarOpenClosed< state, CmpKey, dataStructure >::GetOpenItem(), AStarOpenClosed< state, CmpKey, dataStructure >::Lookat(), and EPEAStar< state, action, environment >::openClosedList.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 88 of file EPEAStar.h.
|
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 >.
Definition at line 180 of file EPEAStar.h.
|
inline |
Definition at line 123 of file EPEAStar.h.
References EPEAStar< state, action, environment >::reopenNodes.
|
inline |
Definition at line 133 of file EPEAStar.h.
References EPEAStar< state, action, environment >::stopAfterGoal.
|
inline |
Definition at line 106 of file EPEAStar.h.
References EPEAStar< state, action, environment >::uniqueNodesExpanded.
|
inline |
Definition at line 119 of file EPEAStar.h.
References EPEAStar< state, action, environment >::env, kNotFound, AStarOpenClosed< state, CmpKey, dataStructure >::Lookup(), and EPEAStar< 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 >.
Definition at line 201 of file EPEAStar.h.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 130 of file EPEAStar.h.
|
virtual |
Draw the open/closed list.
Reimplemented from GenericSearchAlgorithm< state, action, environment >.
Definition at line 433 of file EPEAStar.h.
References EPEAOpenClosedData< state >::data, kClosedList, kOpenList, EPEAOpenClosedData< state >::reopened, and EPEAOpenClosedData< state >::where.
void EPEAStar< state, action, environment >::PrintStats |
A function that prints the number of states in the closed list and open queue.
Definition at line 384 of file EPEAStar.h.
|
inline |
Definition at line 107 of file EPEAStar.h.
References EPEAStar< state, action, environment >::nodesExpanded, EPEAStar< state, action, environment >::nodesTouched, and EPEAStar< state, action, environment >::uniqueNodesExpanded.
Referenced by EPEAStar< state, action, environment >::EPEAStar().
|
inline |
Definition at line 125 of file EPEAStar.h.
References EPEAStar< state, action, environment >::theHeuristic.
|
inline |
Definition at line 122 of file EPEAStar.h.
References EPEAStar< state, action, environment >::reopenNodes.
|
inline |
Definition at line 132 of file EPEAStar.h.
References EPEAStar< state, action, environment >::stopAfterGoal.
|
inline |
Definition at line 137 of file EPEAStar.h.
References EPEAStar< state, action, environment >::weight.
|
private |
Definition at line 140 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::EPEAStar(), EPEAStar< state, action, environment >::ExtractPathToStart(), and EPEAStar< state, action, environment >::HaveExpandedState().
state EPEAStar< state, action, environment >::goal |
Definition at line 92 of file EPEAStar.h.
|
private |
Definition at line 139 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::GetNodesExpanded(), and EPEAStar< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 139 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::GetNodesTouched(), and EPEAStar< state, action, environment >::ResetNodeCount().
AStarOpenClosed<state, EPEAStarCompare<state>, EPEAOpenClosedData<xyLoc> > EPEAStar< state, action, environment >::openClosedList |
Definition at line 88 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::ExtractPathToStart(), EPEAStar< state, action, environment >::GetItem(), EPEAStar< state, action, environment >::GetNumItems(), EPEAStar< state, action, environment >::GetNumOpenItems(), EPEAStar< state, action, environment >::GetOpenItem(), and EPEAStar< state, action, environment >::HaveExpandedState().
|
private |
Definition at line 145 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::EPEAStar(), EPEAStar< state, action, environment >::GetReopenNodes(), and EPEAStar< state, action, environment >::SetReopenNodes().
state EPEAStar< state, action, environment >::start |
Definition at line 92 of file EPEAStar.h.
|
private |
Definition at line 141 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::EPEAStar(), EPEAStar< state, action, environment >::GetStopAfterGoal(), and EPEAStar< state, action, environment >::SetStopAfterGoal().
|
private |
Definition at line 147 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::SetHeuristic().
|
private |
Definition at line 146 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::GetUniqueNodesExpanded(), and EPEAStar< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 143 of file EPEAStar.h.
Referenced by EPEAStar< state, action, environment >::EPEAStar(), and EPEAStar< state, action, environment >::SetWeight().