HOG2
|
A templated version of A*, based on HOG genericAStar. More...
#include <AStarEpsilon.h>
Public Member Functions | |
AStarEpsilon (double optimalBound=2) | |
virtual | ~AStarEpsilon () |
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) |
** More... | |
void | ExtractPathToStart (state &node, std::vector< state > &thePath) |
void | ExtractPathToStartFromID (uint64_t node, std::vector< state > &thePath) |
Returns the next state on the open list (but doesn't pop it off the queue). More... | |
const state & | GetParent (const state &s) |
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 AStarEpsilon. More... | |
state | CheckNextOpenNode () |
state | CheckNextFocalNode () |
bool | GetOpenListGCost (const state &val, double &gCost) const |
bool | GetFocalListGCost (const state &val, double &gCost) const |
bool | GetClosedListGCost (const state &val, double &gCost) const |
Get state from the closed list. More... | |
bool | GetClosedItem (const state &s, AStarOpenClosedData< state > &) |
unsigned int | GetNumOpenItems () |
unsigned int | GetNumFocalItems () |
const AStarOpenClosedData< state > & | GetOpenItem (unsigned int which) |
const AStarOpenClosedData< state > & | GetFocalItem (unsigned int which) |
const int | GetNumItems () |
const AStarOpenClosedData< state > & | GetItem (unsigned int which) |
bool | HaveExpandedState (const state &val) |
dataLocation | GetStateLocation (const state &val) |
void | SetHeuristic (Heuristic< state > *h) |
uint64_t | GetNodesExpanded () const |
uint64_t | GetNodesTouched () const |
void | LogFinalStats (StatCollection *) |
void | OpenGLDraw () const |
Draw the open/closed list. More... | |
void | Draw (Graphics::Display &d) const |
void | SetOptimalityBound (double w) |
double | GetOptimalityBound () |
Public Member Functions inherited from GenericSearchAlgorithm< state, action, environment > | |
GenericSearchAlgorithm () | |
virtual | ~GenericSearchAlgorithm () |
virtual void | OpenGLDraw (const environment *env) const |
Public Attributes | |
AStarOpenClosed< state, AStarCompare< state > > | f |
AStarOpenClosed< state, GBFSCompare< state > > | focal |
state | goal |
state | start |
Private Member Functions | |
void | DrawOpen (Graphics::Display &d) const |
void | DrawFocal (Graphics::Display &d) const |
void | ExpandOpen () |
Expands a single state from the given open list. More... | |
void | ExpandFocal () |
Private Attributes | |
uint64_t | nodesTouched |
uint64_t | nodesExpanded |
std::vector< state > | neighbors |
std::vector< uint64_t > | neighborID |
std::vector< double > | edgeCosts |
std::vector< dataLocation > | neighborLoc |
std::vector< state > | solution |
environment * | env |
double | bestSolution |
double | bound |
uint64_t | uniqueNodesExpanded |
Heuristic< state > * | theHeuristic |
A templated version of A*, based on HOG genericAStar.
Definition at line 41 of file AStarEpsilon.h.
|
inline |
|
inlinevirtual |
Definition at line 44 of file AStarEpsilon.h.
state AStarEpsilon< state, action, environment >::CheckNextFocalNode |
Definition at line 614 of file AStarEpsilon.h.
state AStarEpsilon< state, action, environment >::CheckNextOpenNode |
Definition at line 607 of file AStarEpsilon.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 253 of file AStarEpsilon.h.
References flesseq().
void AStarEpsilon< state, action, environment >::Draw | ( | Graphics::Display & | d | ) | const |
Definition at line 729 of file AStarEpsilon.h.
References d.
|
private |
Definition at line 794 of file AStarEpsilon.h.
References d, kClosedList, and kOpenList.
|
private |
Definition at line 738 of file AStarEpsilon.h.
References d, kClosedList, and kOpenList.
|
private |
Definition at line 438 of file AStarEpsilon.h.
References fless(), kClosedList, kNotFound, and kOpenList.
|
private |
Expands a single state from the given open list.
Definition at line 350 of file AStarEpsilon.h.
References fless(), kClosedList, kNotFound, and kOpenList.
|
inline |
void AStarEpsilon< state, action, environment >::ExtractPathToStartFromID | ( | uint64_t | node, |
std::vector< state > & | thePath | ||
) |
Returns the next state on the open list (but doesn't pop it off the queue).
goalNode | the goal state |
thePath | will contain the path from goalNode to the start state |
Definition at line 538 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::ExtractPathToStart().
bool AStarEpsilon< state, action, environment >::GetClosedItem | ( | const state & | s, |
AStarOpenClosedData< state > & | result | ||
) |
Definition at line 649 of file AStarEpsilon.h.
References kClosedList.
bool AStarEpsilon< 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 594 of file AStarEpsilon.h.
References kClosedList.
|
inline |
Definition at line 78 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::focal, AStarOpenClosed< state, CmpKey, dataStructure >::GetOpenItem(), and AStarOpenClosed< state, CmpKey, dataStructure >::Lookat().
bool AStarEpsilon< state, action, environment >::GetFocalListGCost | ( | const state & | val, |
double & | gCost | ||
) | const |
Definition at line 635 of file AStarEpsilon.h.
References kOpenList.
|
inline |
Definition at line 80 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::focal, and AStarOpenClosed< state, CmpKey, dataStructure >::Lookat().
int AStarEpsilon< state, action, environment >::GetMemoryUsage |
Return the amount of memory used by AStarEpsilon.
Definition at line 578 of file AStarEpsilon.h.
|
virtual |
Return the name of the algorithm.
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 129 of file AStarEpsilon.h.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 88 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::nodesExpanded.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 89 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::nodesTouched.
|
inline |
Definition at line 76 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::focal, and AStarOpenClosed< state, CmpKey, dataStructure >::OpenSize().
|
inline |
Definition at line 79 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::focal, and AStarOpenClosed< state, CmpKey, dataStructure >::size().
|
inline |
Definition at line 75 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::f, and AStarOpenClosed< state, CmpKey, dataStructure >::OpenSize().
|
inline |
Definition at line 77 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::f, AStarOpenClosed< state, CmpKey, dataStructure >::GetOpenItem(), and AStarOpenClosed< state, CmpKey, dataStructure >::Lookat().
bool AStarEpsilon< state, action, environment >::GetOpenListGCost | ( | const state & | val, |
double & | gCost | ||
) | const |
Definition at line 622 of file AStarEpsilon.h.
References kOpenList.
|
inline |
Definition at line 97 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::bound.
const state & AStarEpsilon< state, action, environment >::GetParent | ( | const state & | s | ) |
Definition at line 549 of file AStarEpsilon.h.
|
virtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 163 of file AStarEpsilon.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 148 of file AStarEpsilon.h.
|
inline |
Definition at line 83 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::env, AStarEpsilon< state, action, environment >::focal, and AStarOpenClosed< state, CmpKey, dataStructure >::Lookup().
|
inline |
Definition at line 64 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::uniqueNodesExpanded.
|
inline |
Definition at line 81 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::env, AStarEpsilon< state, action, environment >::focal, kNotFound, and AStarOpenClosed< state, CmpKey, dataStructure >::Lookup().
|
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 192 of file AStarEpsilon.h.
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 91 of file AStarEpsilon.h.
|
virtual |
Draw the open/closed list.
Reimplemented from GenericSearchAlgorithm< state, action, environment >.
Definition at line 670 of file AStarEpsilon.h.
References kClosedList, and kOpenList.
void AStarEpsilon< state, action, environment >::PrintStats |
A function that prints the number of states in the closed list and open queue.
Definition at line 564 of file AStarEpsilon.h.
|
inline |
Definition at line 65 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::nodesExpanded, AStarEpsilon< state, action, environment >::nodesTouched, and AStarEpsilon< state, action, environment >::uniqueNodesExpanded.
Referenced by AStarEpsilon< state, action, environment >::AStarEpsilon().
|
inline |
Definition at line 86 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::theHeuristic.
|
inline |
Definition at line 96 of file AStarEpsilon.h.
References AStarEpsilon< state, action, environment >::bound.
|
private |
Definition at line 112 of file AStarEpsilon.h.
|
private |
Definition at line 113 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::AStarEpsilon(), AStarEpsilon< state, action, environment >::GetOptimalityBound(), and AStarEpsilon< state, action, environment >::SetOptimalityBound().
|
private |
Definition at line 107 of file AStarEpsilon.h.
|
private |
Definition at line 111 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::AStarEpsilon(), AStarEpsilon< state, action, environment >::ExtractPathToStart(), AStarEpsilon< state, action, environment >::GetStateLocation(), and AStarEpsilon< state, action, environment >::HaveExpandedState().
AStarOpenClosed<state, AStarCompare<state> > AStarEpsilon< state, action, environment >::f |
Definition at line 49 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::GetNumOpenItems(), and AStarEpsilon< state, action, environment >::GetOpenItem().
AStarOpenClosed<state, GBFSCompare<state> > AStarEpsilon< state, action, environment >::focal |
Definition at line 51 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::ExtractPathToStart(), AStarEpsilon< state, action, environment >::GetFocalItem(), AStarEpsilon< state, action, environment >::GetItem(), AStarEpsilon< state, action, environment >::GetNumFocalItems(), AStarEpsilon< state, action, environment >::GetNumItems(), AStarEpsilon< state, action, environment >::GetStateLocation(), and AStarEpsilon< state, action, environment >::HaveExpandedState().
state AStarEpsilon< state, action, environment >::goal |
Definition at line 52 of file AStarEpsilon.h.
|
private |
Definition at line 106 of file AStarEpsilon.h.
|
private |
Definition at line 108 of file AStarEpsilon.h.
|
private |
Definition at line 105 of file AStarEpsilon.h.
|
private |
Definition at line 103 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::GetNodesExpanded(), and AStarEpsilon< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 103 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::GetNodesTouched(), and AStarEpsilon< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 110 of file AStarEpsilon.h.
state AStarEpsilon< state, action, environment >::start |
Definition at line 52 of file AStarEpsilon.h.
|
private |
Definition at line 115 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::AStarEpsilon(), and AStarEpsilon< state, action, environment >::SetHeuristic().
|
private |
Definition at line 114 of file AStarEpsilon.h.
Referenced by AStarEpsilon< state, action, environment >::GetUniqueNodesExpanded(), and AStarEpsilon< state, action, environment >::ResetNodeCount().