HOG2
|
A templated version of A*, based on HOG genericAStar. More...
#include <OldTemplateAStar.h>
Public Types | |
typedef OpenClosedList< OldOldTemplateAStarUtil::SearchNode< state >, OldOldTemplateAStarUtil::SearchNodeHash< state >, OldOldTemplateAStarUtil::SearchNodeEqual< state >, OldOldTemplateAStarUtil::SearchNodeCompare< state > > | PQueue |
typedef std::unordered_map< uint64_t, OldOldTemplateAStarUtil::SearchNode< state >, Hash64 > | NodeLookupTable |
typedef NodeLookupTable::const_iterator | closedList_iterator |
Public Member Functions | |
OldTemplateAStar () | |
virtual | ~OldTemplateAStar () |
void | GetPath (environment *env, state &from, state &to, std::vector< state > &thePath) |
Perform an A* search between two states. More... | |
void | GetPath (environment *, state &, state &, std::vector< action > &) |
bool | InitializeSearch (environment *env, state &from, 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... | |
state | CheckNextNode () |
Returns the next state on the open list (but doesn't pop it off the queue). More... | |
void | ExtractPathToStart (state &n, std::vector< state > &thePath) |
Get the path from a goal state to the start state. More... | |
void | DoAbstractSearch () |
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... | |
void | ResetNodeCount () |
int | GetMemoryUsage () |
Return the amount of memory used by OldTemplateAStar. More... | |
void | GetClosedListIter (closedList_iterator) |
Get an iterator for the closed list. More... | |
bool | ClosedListIterNext (closedList_iterator &it, state &next) const |
Get the next state in the closed list. More... | |
bool | GetClosedListGCost (state &val, double &gCost) const |
Get state from the closed list. More... | |
void | SetUseBPMX (bool use) |
bool | GetUsingBPMX () |
uint64_t | GetNodesExpanded () |
uint64_t | GetNodesTouched () |
void | LogFinalStats (StatCollection *) |
void | SetRadius (double rad) |
double | GetRadius () |
void | SetRadiusEnvironment (environment *e) |
void | SetStopAfterGoal (bool val) |
bool | GetStopAfterGoal () |
void | OpenGLDraw () const |
Draw the open/closed list. More... | |
void | SetWeight (double w) |
Use weighted A* and set the weight. More... | |
Public Member Functions inherited from GenericSearchAlgorithm< state, action, environment > | |
GenericSearchAlgorithm () | |
virtual | ~GenericSearchAlgorithm () |
virtual void | GetPath (environment *env, const state &from, const state &to, std::vector< state > &path)=0 |
virtual void | GetPath (environment *env, const state &from, const state &to, std::vector< action > &path)=0 |
virtual bool | InitializeSearch (environment *env, const state &from, const state &to, std::vector< state > &thePath) |
virtual uint64_t | GetNodesExpanded () const =0 |
virtual uint64_t | GetNodesTouched () const =0 |
virtual void | OpenGLDraw (const environment *env) const |
Public Attributes | |
PQueue | openQueue |
NodeLookupTable | closedList |
state | goal |
state | start |
Private Member Functions | |
bool | GetNextNode (state &next) |
Removes the top node from the open list More... | |
void | UpdateClosedNode (environment *env, state &currOpenNode, state &neighbor) |
Check and update the weight of a closed node. More... | |
void | UpdateWeight (environment *env, state &currOpenNode, state &neighbor) |
Update the weight of a node. More... | |
void | AddToOpenList (environment *env, state &currOpenNode, state &neighbor) |
Add a node to the open list. More... | |
Private Attributes | |
uint64_t | nodesTouched |
uint64_t | nodesExpanded |
std::vector< state > | neighbors |
environment * | env |
bool | stopAfterGoal |
double | radius |
double | weight |
bool | useOccupancyInfo |
bool | useRadius |
bool | firstRound |
bool | useBPMX |
environment * | radEnv |
A templated version of A*, based on HOG genericAStar.
Definition at line 106 of file OldTemplateAStar.h.
typedef NodeLookupTable::const_iterator OldTemplateAStar< state, action, environment >::closedList_iterator |
Definition at line 123 of file OldTemplateAStar.h.
typedef std::unordered_map<uint64_t, OldOldTemplateAStarUtil::SearchNode<state>, Hash64 > OldTemplateAStar< state, action, environment >::NodeLookupTable |
Definition at line 117 of file OldTemplateAStar.h.
typedef OpenClosedList<OldOldTemplateAStarUtil::SearchNode<state>, OldOldTemplateAStarUtil::SearchNodeHash<state>, OldOldTemplateAStarUtil::SearchNodeEqual<state>, OldOldTemplateAStarUtil::SearchNodeCompare<state> > OldTemplateAStar< state, action, environment >::PQueue |
Definition at line 112 of file OldTemplateAStar.h.
|
inline |
Definition at line 108 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::env, OldTemplateAStar< state, action, environment >::radEnv, OldTemplateAStar< state, action, environment >::radius, OldTemplateAStar< state, action, environment >::stopAfterGoal, OldTemplateAStar< state, action, environment >::useBPMX, OldTemplateAStar< state, action, environment >::useOccupancyInfo, OldTemplateAStar< state, action, environment >::useRadius, and OldTemplateAStar< state, action, environment >::weight.
|
inlinevirtual |
Definition at line 109 of file OldTemplateAStar.h.
void OldTemplateAStar< 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 280 of file OldTemplateAStar.h.
|
private |
Add a node to the open list.
currOpenNode | the state that's currently being expanded |
neighbor | the state to be added to the open list |
Definition at line 496 of file OldTemplateAStar.h.
References fgreater().
state OldTemplateAStar< state, action, environment >::CheckNextNode |
Returns the next state on the open list (but doesn't pop it off the queue).
Definition at line 390 of file OldTemplateAStar.h.
bool OldTemplateAStar< state, action, environment >::ClosedListIterNext | ( | closedList_iterator & | it, |
state & | next | ||
) | const |
Get the next state in the closed list.
it | A closedList_iterator pointing at the current state in the closed list |
Definition at line 607 of file OldTemplateAStar.h.
|
inline |
Definition at line 131 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::useOccupancyInfo, and OldTemplateAStar< state, action, environment >::useRadius.
|
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 297 of file OldTemplateAStar.h.
References OldOldTemplateAStarUtil::SearchNode< state >::fCost, fgreater(), and OldOldTemplateAStarUtil::SearchNode< state >::gCost.
void OldTemplateAStar< state, action, environment >::ExtractPathToStart | ( | state & | goalNode, |
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 530 of file OldTemplateAStar.h.
References OldOldTemplateAStarUtil::SearchNode< state >::currNode, and OldOldTemplateAStarUtil::SearchNode< state >::prevNode.
bool OldTemplateAStar< state, action, environment >::GetClosedListGCost | ( | 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 627 of file OldTemplateAStar.h.
void OldTemplateAStar< state, action, environment >::GetClosedListIter | ( | closedList_iterator | ) |
Get an iterator for the closed list.
Definition at line 591 of file OldTemplateAStar.h.
int OldTemplateAStar< state, action, environment >::GetMemoryUsage |
Return the amount of memory used by OldTemplateAStar.
Definition at line 577 of file OldTemplateAStar.h.
|
virtual |
Return the name of the algorithm.
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 205 of file OldTemplateAStar.h.
|
private |
Removes the top node from the open list
state | will contain the next state in the open list |
Definition at line 405 of file OldTemplateAStar.h.
References OldOldTemplateAStarUtil::SearchNode< state >::currNode.
|
inline |
Definition at line 149 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::nodesExpanded.
|
inline |
Definition at line 150 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::nodesTouched.
|
inline |
Definition at line 112 of file OldTemplateAStar.h.
void OldTemplateAStar< state, action, environment >::GetPath | ( | environment * | _env, |
state & | from, | ||
state & | to, | ||
std::vector< state > & | thePath | ||
) |
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. |
Definition at line 224 of file OldTemplateAStar.h.
|
inline |
Definition at line 155 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::radius.
|
inline |
Definition at line 160 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::stopAfterGoal.
|
inline |
Definition at line 146 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::useBPMX.
bool OldTemplateAStar< state, action, environment >::InitializeSearch | ( | environment * | _env, |
state & | from, | ||
state & | to, | ||
std::vector< state > & | thePath | ||
) |
Initialize the A* search.
_env | The search environment |
from | The start state |
to | The goal state |
Definition at line 245 of file OldTemplateAStar.h.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 152 of file OldTemplateAStar.h.
|
virtual |
Draw the open/closed list.
Reimplemented from GenericSearchAlgorithm< state, action, environment >.
Definition at line 644 of file OldTemplateAStar.h.
void OldTemplateAStar< state, action, environment >::PrintStats |
A function that prints the number of states in the closed list and open queue.
Definition at line 563 of file OldTemplateAStar.h.
|
inline |
Definition at line 137 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::nodesExpanded, and OldTemplateAStar< state, action, environment >::nodesTouched.
|
inline |
Definition at line 154 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::radius.
|
inline |
Definition at line 157 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::radEnv.
|
inline |
Definition at line 159 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::stopAfterGoal.
|
inline |
Definition at line 145 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::useBPMX.
|
inline |
Use weighted A* and set the weight.
Use f = g + weight * h during search
Definition at line 171 of file OldTemplateAStar.h.
References OldTemplateAStar< state, action, environment >::weight.
|
private |
Check and update the weight of a closed node.
currOpenNode | The node that's currently being expanded |
neighbor | The node whose weight will be updated |
Definition at line 433 of file OldTemplateAStar.h.
References OldOldTemplateAStarUtil::SearchNode< state >::currNode, OldOldTemplateAStarUtil::SearchNode< state >::fCost, fgreater(), OldOldTemplateAStarUtil::SearchNode< state >::gCost, and OldOldTemplateAStarUtil::SearchNode< state >::prevNode.
|
private |
Update the weight of a node.
currOpenNode | The node that's currently being expanded |
neighbor | The node whose weight will be updated |
Definition at line 466 of file OldTemplateAStar.h.
References OldOldTemplateAStarUtil::SearchNode< state >::currNode, OldOldTemplateAStarUtil::SearchNode< state >::fCost, fgreater(), OldOldTemplateAStarUtil::SearchNode< state >::gCost, and OldOldTemplateAStarUtil::SearchNode< state >::prevNode.
NodeLookupTable OldTemplateAStar< state, action, environment >::closedList |
Definition at line 120 of file OldTemplateAStar.h.
|
private |
Definition at line 181 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::OldTemplateAStar().
|
private |
Definition at line 189 of file OldTemplateAStar.h.
state OldTemplateAStar< state, action, environment >::goal |
Definition at line 121 of file OldTemplateAStar.h.
|
private |
Definition at line 180 of file OldTemplateAStar.h.
|
private |
Definition at line 173 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::GetNodesExpanded(), and OldTemplateAStar< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 173 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::GetNodesTouched(), and OldTemplateAStar< state, action, environment >::ResetNodeCount().
PQueue OldTemplateAStar< state, action, environment >::openQueue |
Definition at line 119 of file OldTemplateAStar.h.
|
private |
Definition at line 191 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::OldTemplateAStar(), and OldTemplateAStar< state, action, environment >::SetRadiusEnvironment().
|
private |
Definition at line 184 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::GetRadius(), OldTemplateAStar< state, action, environment >::OldTemplateAStar(), and OldTemplateAStar< state, action, environment >::SetRadius().
state OldTemplateAStar< state, action, environment >::start |
Definition at line 121 of file OldTemplateAStar.h.
|
private |
|
private |
Definition at line 190 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::GetUsingBPMX(), OldTemplateAStar< state, action, environment >::OldTemplateAStar(), and OldTemplateAStar< state, action, environment >::SetUseBPMX().
|
private |
Definition at line 187 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::DoAbstractSearch(), and OldTemplateAStar< state, action, environment >::OldTemplateAStar().
|
private |
Definition at line 188 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::DoAbstractSearch(), and OldTemplateAStar< state, action, environment >::OldTemplateAStar().
|
private |
Definition at line 185 of file OldTemplateAStar.h.
Referenced by OldTemplateAStar< state, action, environment >::OldTemplateAStar(), and OldTemplateAStar< state, action, environment >::SetWeight().