HOG2
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
OldTemplateAStar< state, action, environment > Class Template Reference

A templated version of A*, based on HOG genericAStar. More...

#include <OldTemplateAStar.h>

Inheritance diagram for OldTemplateAStar< state, action, environment >:
Inheritance graph
[legend]
Collaboration diagram for OldTemplateAStar< state, action, environment >:
Collaboration graph
[legend]

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 >, Hash64NodeLookupTable
 
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
 

Detailed Description

template<class state, class action, class environment>
class OldTemplateAStar< state, action, environment >

A templated version of A*, based on HOG genericAStar.

Definition at line 106 of file OldTemplateAStar.h.

Member Typedef Documentation

◆ closedList_iterator

template<class state , class action , class environment >
typedef NodeLookupTable::const_iterator OldTemplateAStar< state, action, environment >::closedList_iterator

Definition at line 123 of file OldTemplateAStar.h.

◆ NodeLookupTable

template<class state , class action , class environment >
typedef std::unordered_map<uint64_t, OldOldTemplateAStarUtil::SearchNode<state>, Hash64 > OldTemplateAStar< state, action, environment >::NodeLookupTable

Definition at line 117 of file OldTemplateAStar.h.

◆ PQueue

template<class state , class action , class environment >
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.

Constructor & Destructor Documentation

◆ OldTemplateAStar()

template<class state , class action , class environment >
OldTemplateAStar< state, action, environment >::OldTemplateAStar ( )
inline

◆ ~OldTemplateAStar()

template<class state , class action , class environment >
virtual OldTemplateAStar< state, action, environment >::~OldTemplateAStar ( )
inlinevirtual

Definition at line 109 of file OldTemplateAStar.h.

Member Function Documentation

◆ AddAdditionalStartState()

template<class state , class action , class environment >
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.

Author
Nathan Sturtevant
Date
01/06/08

Definition at line 280 of file OldTemplateAStar.h.

◆ AddToOpenList()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::AddToOpenList ( environment *  e,
state &  currOpenNode,
state &  neighbor 
)
private

Add a node to the open list.

Author
Nathan Sturtevant
Date
03/22/06
Parameters
currOpenNodethe state that's currently being expanded
neighborthe state to be added to the open list

Definition at line 496 of file OldTemplateAStar.h.

References fgreater().

◆ CheckNextNode()

template<class state , class action , class environment >
state OldTemplateAStar< state, action, environment >::CheckNextNode

Returns the next state on the open list (but doesn't pop it off the queue).

Author
Nathan Sturtevant
Date
03/22/06
Returns
The first state in the open list.

Definition at line 390 of file OldTemplateAStar.h.

◆ ClosedListIterNext()

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::ClosedListIterNext ( closedList_iterator it,
state &  next 
) const

Get the next state in the closed list.

Author
Nathan Sturtevant
Date
06/13/07
Parameters
itA closedList_iterator pointing at the current state in the closed list
Returns
The next state in the closed list. Returns UINT_MAX if there's no more states

Definition at line 607 of file OldTemplateAStar.h.

◆ DoAbstractSearch()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::DoAbstractSearch ( )
inline

◆ DoSingleSearchStep()

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::DoSingleSearchStep ( std::vector< state > &  thePath)
virtual

Expand a single node.

Author
Nathan Sturtevant
Date
03/22/06
Parameters
thePathwill contain an optimal path from start to goal if the function returns TRUE
Returns
TRUE if there is no path or if we have found the goal, FALSE otherwise

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.

◆ ExtractPathToStart()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::ExtractPathToStart ( state &  goalNode,
std::vector< state > &  thePath 
)

Get the path from a goal state to the start state.

Author
Nathan Sturtevant
Date
03/22/06
Parameters
goalNodethe goal state
thePathwill 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.

◆ GetClosedListGCost()

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::GetClosedListGCost ( state &  val,
double &  gCost 
) const

Get state from the closed list.

Author
Nathan Sturtevant
Date
10/09/07
Parameters
valThe state to lookup in the closed list @gCost The g-cost of the node in the closed list
Returns
success Whether we found the value or not more states

Definition at line 627 of file OldTemplateAStar.h.

◆ GetClosedListIter()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::GetClosedListIter ( closedList_iterator  )

Get an iterator for the closed list.

Author
Nathan Sturtevant
Date
06/13/07
Returns
An iterator pointing to the first node in the closed list

Definition at line 591 of file OldTemplateAStar.h.

◆ GetMemoryUsage()

template<class state , class action , class environment >
int OldTemplateAStar< state, action, environment >::GetMemoryUsage

Return the amount of memory used by OldTemplateAStar.

Author
Nathan Sturtevant
Date
03/22/06
Returns
The combined number of elements in the closed list and open queue

Definition at line 577 of file OldTemplateAStar.h.

◆ GetName()

template<class state , class action , class environment >
const char * OldTemplateAStar< state, action, environment >::GetName
virtual

Return the name of the algorithm.

Author
Nathan Sturtevant
Date
03/22/06
Returns
The name of the algorithm

Implements GenericSearchAlgorithm< state, action, environment >.

Definition at line 205 of file OldTemplateAStar.h.

◆ GetNextNode()

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::GetNextNode ( state &  next)
private

Removes the top node from the open list

Author
Nathan Sturtevant
Date
03/22/06
Parameters
statewill contain the next state in the open list
Returns
TRUE if next contains a valid state, FALSE if there is no more states in the open queue

Definition at line 405 of file OldTemplateAStar.h.

References OldOldTemplateAStarUtil::SearchNode< state >::currNode.

◆ GetNodesExpanded()

template<class state , class action , class environment >
uint64_t OldTemplateAStar< state, action, environment >::GetNodesExpanded ( )
inline

◆ GetNodesTouched()

template<class state , class action , class environment >
uint64_t OldTemplateAStar< state, action, environment >::GetNodesTouched ( )
inline

◆ GetPath() [1/2]

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::GetPath ( environment *  ,
state &  ,
state &  ,
std::vector< action > &   
)
inline

Definition at line 112 of file OldTemplateAStar.h.

◆ GetPath() [2/2]

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::GetPath ( environment *  _env,
state &  from,
state &  to,
std::vector< state > &  thePath 
)

Perform an A* search between two states.


Author
Nathan Sturtevant
Date
03/22/06
Parameters
_envThe search environment
fromThe start state
toThe goal state
thePathA 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.

◆ GetRadius()

template<class state , class action , class environment >
double OldTemplateAStar< state, action, environment >::GetRadius ( )
inline

◆ GetStopAfterGoal()

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::GetStopAfterGoal ( )
inline

◆ GetUsingBPMX()

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::GetUsingBPMX ( )
inline

◆ InitializeSearch()

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::InitializeSearch ( environment *  _env,
state &  from,
state &  to,
std::vector< state > &  thePath 
)

Initialize the A* search.

Author
Nathan Sturtevant
Date
03/22/06
Parameters
_envThe search environment
fromThe start state
toThe goal state
Returns
TRUE if initialization was successful, FALSE otherwise

Definition at line 245 of file OldTemplateAStar.h.

◆ LogFinalStats()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::LogFinalStats ( StatCollection )
inlinevirtual

◆ OpenGLDraw()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::OpenGLDraw
virtual

Draw the open/closed list.

Author
Nathan Sturtevant
Date
03/12/09

Reimplemented from GenericSearchAlgorithm< state, action, environment >.

Definition at line 644 of file OldTemplateAStar.h.

◆ PrintStats()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::PrintStats

A function that prints the number of states in the closed list and open queue.

Author
Nathan Sturtevant
Date
03/22/06

Definition at line 563 of file OldTemplateAStar.h.

◆ ResetNodeCount()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::ResetNodeCount ( )
inline

◆ SetRadius()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::SetRadius ( double  rad)
inline

◆ SetRadiusEnvironment()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::SetRadiusEnvironment ( environment *  e)
inline

◆ SetStopAfterGoal()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::SetStopAfterGoal ( bool  val)
inline

◆ SetUseBPMX()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::SetUseBPMX ( bool  use)
inline

◆ SetWeight()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::SetWeight ( double  w)
inline

Use weighted A* and set the weight.

Use f = g + weight * h during search

Author
Renee Jansen
Date
10/23/2007

Definition at line 171 of file OldTemplateAStar.h.

References OldTemplateAStar< state, action, environment >::weight.

◆ UpdateClosedNode()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::UpdateClosedNode ( environment *  e,
state &  currOpenNode,
state &  neighbor 
)
private

Check and update the weight of a closed node.

Author
Nathan Sturtevant
Date
11/10/08
Parameters
currOpenNodeThe node that's currently being expanded
neighborThe 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.

◆ UpdateWeight()

template<class state , class action , class environment >
void OldTemplateAStar< state, action, environment >::UpdateWeight ( environment *  e,
state &  currOpenNode,
state &  neighbor 
)
private

Update the weight of a node.

Author
Nathan Sturtevant
Date
03/22/06
Parameters
currOpenNodeThe node that's currently being expanded
neighborThe 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.

Member Data Documentation

◆ closedList

template<class state , class action , class environment >
NodeLookupTable OldTemplateAStar< state, action, environment >::closedList

Definition at line 120 of file OldTemplateAStar.h.

◆ env

template<class state , class action , class environment >
environment* OldTemplateAStar< state, action, environment >::env
private

◆ firstRound

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::firstRound
private

Definition at line 189 of file OldTemplateAStar.h.

◆ goal

template<class state , class action , class environment >
state OldTemplateAStar< state, action, environment >::goal

Definition at line 121 of file OldTemplateAStar.h.

◆ neighbors

template<class state , class action , class environment >
std::vector<state> OldTemplateAStar< state, action, environment >::neighbors
private

Definition at line 180 of file OldTemplateAStar.h.

◆ nodesExpanded

template<class state , class action , class environment >
uint64_t OldTemplateAStar< state, action, environment >::nodesExpanded
private

◆ nodesTouched

template<class state , class action , class environment >
uint64_t OldTemplateAStar< state, action, environment >::nodesTouched
private

◆ openQueue

template<class state , class action , class environment >
PQueue OldTemplateAStar< state, action, environment >::openQueue

Definition at line 119 of file OldTemplateAStar.h.

◆ radEnv

template<class state , class action , class environment >
environment* OldTemplateAStar< state, action, environment >::radEnv
private

◆ radius

template<class state , class action , class environment >
double OldTemplateAStar< state, action, environment >::radius
private

◆ start

template<class state , class action , class environment >
state OldTemplateAStar< state, action, environment >::start

Definition at line 121 of file OldTemplateAStar.h.

◆ stopAfterGoal

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::stopAfterGoal
private

◆ useBPMX

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::useBPMX
private

◆ useOccupancyInfo

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::useOccupancyInfo
private

◆ useRadius

template<class state , class action , class environment >
bool OldTemplateAStar< state, action, environment >::useRadius
private

◆ weight

template<class state , class action , class environment >
double OldTemplateAStar< state, action, environment >::weight
private

The documentation for this class was generated from the following file: