HOG2
|
A templated version of A*, based on HOG genericAStar. More...
#include <TemplateAStar.h>
Public Member Functions | |
TemplateAStar () | |
virtual | ~TemplateAStar () |
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 (const state &newState) |
Add additional start state to the search. More... | |
void | AddAdditionalStartState (const 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... | |
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 TemplateAStar. More... | |
bool | GetClosedListGCost (const state &val, double &gCost) const |
Get state from the closed list. More... | |
bool | GetOpenListGCost (const state &val, double &gCost) const |
bool | GetHCost (const state &val, double &hCost) const |
bool | GetClosedItem (const state &s, AStarOpenClosedDataWithF< state > &) |
unsigned int | GetNumOpenItems () |
const AStarOpenClosedDataWithF< state > & | GetOpenItem (unsigned int which) |
const int | GetNumItems () |
const AStarOpenClosedDataWithF< state > & | GetItem (unsigned int which) |
bool | HaveExpandedState (const state &val) |
dataLocation | GetStateLocation (const state &val) |
void | SetUseBPMX (int depth) |
int | GetUsingBPMX () |
void | SetReopenNodes (bool re) |
bool | GetReopenNodes () |
void | SetDirected (bool d) |
void | SetHeuristic (Heuristic< state > *h) |
void | SetConstraint (Constraint< state > *c) |
uint64_t | GetNodesExpanded () const |
uint64_t | GetNodesTouched () const |
uint64_t | GetNecessaryExpansions () const |
void | LogFinalStats (StatCollection *) |
void | SetStopAfterGoal (bool val) |
bool | GetStopAfterGoal () |
void | FullBPMX (uint64_t nodeID, int distance) |
Perform a full bpmx propagation. More... | |
void | OpenGLDraw () const |
Draw the open/closed list. More... | |
void | Draw (Graphics::Display &disp) const |
Draw the open/closed list. More... | |
std::string | SVGDraw () const |
std::string | SVGDrawDetailed () const |
void | SetPhi (std::function< double(double, double)> p) |
Setting this function. More... | |
double | Phi (double h, double g) |
void | SetWeight (double w) |
double | GetWeight () |
Public Member Functions inherited from GenericSearchAlgorithm< state, action, environment > | |
GenericSearchAlgorithm () | |
virtual | ~GenericSearchAlgorithm () |
virtual void | OpenGLDraw (const environment *env) const |
Public Attributes | |
openList | openClosedList |
state | goal |
state | start |
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 |
environment * | env |
bool | stopAfterGoal |
double | goalFCost |
double | weight |
std::function< double(double, double)> | phi |
bool | directed |
int | useBPMX |
bool | reopenNodes |
uint64_t | uniqueNodesExpanded |
environment * | radEnv |
Heuristic< state > * | theHeuristic |
Constraint< state > * | theConstraint |
A templated version of A*, based on HOG genericAStar.
Definition at line 73 of file TemplateAStar.h.
|
inline |
Definition at line 75 of file TemplateAStar.h.
|
inlinevirtual |
Definition at line 80 of file TemplateAStar.h.
void TemplateAStar< state, action, environment, openList >::AddAdditionalStartState | ( | const state & | newState | ) |
Add additional start state to the search.
This should only be called after Initialize Search and before DoSingleSearchStep.
Definition at line 285 of file TemplateAStar.h.
Referenced by Racetrack::UpdateMap().
void TemplateAStar< state, action, environment, openList >::AddAdditionalStartState | ( | const state & | newState, |
double | cost | ||
) |
Add additional start state to the search.
This should only be called after Initialize Search
Definition at line 297 of file TemplateAStar.h.
state TemplateAStar< state, action, environment, openList >::CheckNextNode |
Returns the next state on the open list (but doesn't pop it off the queue).
Definition at line 497 of file TemplateAStar.h.
Referenced by CanonicalGraphEnvironment::ComputeOrdering().
|
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 314 of file TemplateAStar.h.
Referenced by CanonicalGraphEnvironment::ComputeOrdering(), HeuristicLearningMeasure< state, action, environment >::LookupGCost(), HeuristicLearningMeasure< state, action, environment >::LookupHCost(), and Racetrack::UpdateMap().
void TemplateAStar< state, action, environment, openList >::Draw | ( | Graphics::Display & | disp | ) | const |
|
inline |
Definition at line 93 of file TemplateAStar.h.
void TemplateAStar< state, action, environment, openList >::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 564 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::ExtractPathToStart().
void TemplateAStar< state, action, environment, openList >::FullBPMX | ( | uint64_t | nodeID, |
int | distance | ||
) |
Perform a full bpmx propagation.
Definition at line 513 of file TemplateAStar.h.
bool TemplateAStar< state, action, environment, openList >::GetClosedItem | ( | const state & | s, |
AStarOpenClosedDataWithF< state > & | result | ||
) |
Definition at line 673 of file TemplateAStar.h.
Referenced by CanonicalGraphEnvironment::ComputeOrdering().
bool TemplateAStar< state, action, environment, openList >::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 634 of file TemplateAStar.h.
Referenced by HeuristicLearningMeasure< state, action, environment >::LookupGCost(), and HeuristicLearningMeasure< state, action, environment >::LookupHCost().
bool TemplateAStar< state, action, environment, openList >::GetHCost | ( | const state & | val, |
double & | hCost | ||
) | const |
Definition at line 660 of file TemplateAStar.h.
|
inline |
Definition at line 116 of file TemplateAStar.h.
Referenced by BidirectionalProblemAnalyzer< state, action, environment >::BuildDataStructures(), and Racetrack::UpdateMap().
int TemplateAStar< state, action, environment, openList >::GetMemoryUsage |
Return the amount of memory used by TemplateAStar.
Definition at line 618 of file TemplateAStar.h.
|
virtual |
Return the name of the algorithm.
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 195 of file TemplateAStar.h.
uint64_t TemplateAStar< state, action, environment, openList >::GetNecessaryExpansions |
Definition at line 584 of file TemplateAStar.h.
Referenced by BidirectionalProblemAnalyzer< state, action, environment >::BuildDataStructures(), and BidirectionalProblemAnalyzer< state, action, environment >::SaveSVG().
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 134 of file TemplateAStar.h.
Referenced by AbstractWeightedSearchAlgorithm< state, action, environment >::GetPath(), and MyPathfindingKeyHandler().
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 135 of file TemplateAStar.h.
Referenced by AbstractWeightedSearchAlgorithm< state, action, environment >::GetPath().
|
inline |
Definition at line 115 of file TemplateAStar.h.
Referenced by BidirectionalProblemAnalyzer< state, action, environment >::BuildDataStructures(), and Racetrack::UpdateMap().
|
inline |
Definition at line 113 of file TemplateAStar.h.
Referenced by CanonicalGraphEnvironment::ComputeOrdering(), and Racetrack::UpdateMap().
|
inline |
Definition at line 114 of file TemplateAStar.h.
bool TemplateAStar< state, action, environment, openList >::GetOpenListGCost | ( | const state & | val, |
double & | gCost | ||
) | const |
Definition at line 647 of file TemplateAStar.h.
Referenced by CanonicalGraphEnvironment::ComputeOrdering().
const state & TemplateAStar< state, action, environment, openList >::GetParent | ( | const state & | s | ) |
Definition at line 575 of file TemplateAStar.h.
Referenced by CanonicalGraphEnvironment::ComputeOrdering().
|
virtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 228 of file TemplateAStar.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 214 of file TemplateAStar.h.
Referenced by BidirectionalProblemAnalyzer< state, action, environment >::BuildDataStructures(), AbstractWeightedSearchAlgorithm< state, action, environment >::GetPath(), RoboticArm::HCost(), and MyPathfindingKeyHandler().
|
inline |
Definition at line 126 of file TemplateAStar.h.
|
inline |
Definition at line 119 of file TemplateAStar.h.
|
inline |
Definition at line 140 of file TemplateAStar.h.
|
inline |
Definition at line 105 of file TemplateAStar.h.
|
inline |
Definition at line 123 of file TemplateAStar.h.
|
inline |
Definition at line 163 of file TemplateAStar.h.
|
inline |
Definition at line 117 of file TemplateAStar.h.
|
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 257 of file TemplateAStar.h.
Referenced by HeuristicLearningMeasure< state, action, environment >::BuildExactDistances(), CanonicalGraphEnvironment::ComputeOrdering(), and Racetrack::UpdateMap().
|
inlinevirtual |
Implements GenericSearchAlgorithm< state, action, environment >.
Definition at line 137 of file TemplateAStar.h.
|
virtual |
Draw the open/closed list.
Reimplemented from GenericSearchAlgorithm< state, action, environment >.
Definition at line 694 of file TemplateAStar.h.
|
inline |
Definition at line 154 of file TemplateAStar.h.
void TemplateAStar< state, action, environment, openList >::PrintStats |
A function that prints the number of states in the closed list and open queue.
Definition at line 604 of file TemplateAStar.h.
|
inline |
Definition at line 106 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::TemplateAStar().
|
inline |
Definition at line 132 of file TemplateAStar.h.
|
inline |
Definition at line 129 of file TemplateAStar.h.
|
inline |
Definition at line 131 of file TemplateAStar.h.
Referenced by BidirectionalProblemAnalyzer< state, action, environment >::BuildDataStructures().
|
inline |
Setting this function.
Definition at line 150 of file TemplateAStar.h.
|
inline |
Definition at line 125 of file TemplateAStar.h.
|
inline |
Definition at line 139 of file TemplateAStar.h.
Referenced by HeuristicLearningMeasure< state, action, environment >::BuildExactDistances(), CanonicalGraphEnvironment::ComputeOrdering(), and Racetrack::UpdateMap().
|
inline |
Definition at line 122 of file TemplateAStar.h.
Referenced by MyPathfindingKeyHandler().
|
inline |
Definition at line 158 of file TemplateAStar.h.
std::string TemplateAStar< state, action, environment, openList >::SVGDraw |
Definition at line 817 of file TemplateAStar.h.
std::string TemplateAStar< state, action, environment, openList >::SVGDrawDetailed |
Definition at line 863 of file TemplateAStar.h.
|
private |
Definition at line 177 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::SetDirected(), and TemplateAStar< state, action, environment >::TemplateAStar().
|
private |
Definition at line 169 of file TemplateAStar.h.
|
private |
Definition at line 171 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::ExtractPathToStart(), TemplateAStar< state, action, environment >::GetStateLocation(), TemplateAStar< state, action, environment >::HaveExpandedState(), and TemplateAStar< state, action, environment >::TemplateAStar().
state TemplateAStar< state, action, environment, openList >::goal |
Definition at line 85 of file TemplateAStar.h.
|
private |
Definition at line 174 of file TemplateAStar.h.
|
private |
Definition at line 168 of file TemplateAStar.h.
|
private |
Definition at line 170 of file TemplateAStar.h.
|
private |
Definition at line 167 of file TemplateAStar.h.
|
private |
Definition at line 165 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::GetNodesExpanded(), and TemplateAStar< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 165 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::GetNodesTouched(), and TemplateAStar< state, action, environment >::ResetNodeCount().
openList TemplateAStar< state, action, environment, openList >::openClosedList |
Definition at line 84 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::ExtractPathToStart(), TemplateAStar< state, action, environment >::GetItem(), TemplateAStar< state, action, environment >::GetNumItems(), TemplateAStar< state, action, environment >::GetNumOpenItems(), TemplateAStar< state, action, environment >::GetOpenItem(), TemplateAStar< state, action, environment >::GetStateLocation(), and TemplateAStar< state, action, environment >::HaveExpandedState().
|
private |
|
private |
Definition at line 181 of file TemplateAStar.h.
|
private |
Definition at line 179 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::GetReopenNodes(), TemplateAStar< state, action, environment >::SetReopenNodes(), TemplateAStar< state, action, environment >::SetUseBPMX(), and TemplateAStar< state, action, environment >::TemplateAStar().
state TemplateAStar< state, action, environment, openList >::start |
Definition at line 85 of file TemplateAStar.h.
|
private |
Definition at line 172 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::GetStopAfterGoal(), TemplateAStar< state, action, environment >::SetStopAfterGoal(), and TemplateAStar< state, action, environment >::TemplateAStar().
|
private |
Definition at line 183 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::SetConstraint(), and TemplateAStar< state, action, environment >::TemplateAStar().
|
private |
Definition at line 182 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::SetHeuristic(), and TemplateAStar< state, action, environment >::TemplateAStar().
|
private |
Definition at line 180 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::GetUniqueNodesExpanded(), and TemplateAStar< state, action, environment >::ResetNodeCount().
|
private |
Definition at line 178 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::GetUsingBPMX(), TemplateAStar< state, action, environment >::SetUseBPMX(), and TemplateAStar< state, action, environment >::TemplateAStar().
|
private |
Definition at line 175 of file TemplateAStar.h.
Referenced by TemplateAStar< state, action, environment >::GetWeight(), TemplateAStar< state, action, environment >::SetWeight(), and TemplateAStar< state, action, environment >::TemplateAStar().