HOG2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GenericSearchUnit< state, action, environment > Class Template Reference

A general unit which collects path information from a GenericSearchAlgorithm and incrementally executes that path in the world. More...

#include <GenericSearchUnit.h>

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

Public Member Functions

 GenericSearchUnit (state &start, state &goal, GenericSearchAlgorithm< state, action, environment > *alg)
 
 GenericSearchUnit (state &start, Unit< state, action, environment > *target, GenericSearchAlgorithm< state, action, environment > *alg)
 
virtual ~GenericSearchUnit ()
 
virtual const char * GetName ()
 
virtual GenericSearchAlgorithm< state, action, environment > * getAlgorithm ()
 
virtual bool Done ()
 
virtual void GetGoal (state &s)
 
virtual void SetTarget (Unit< state, action, environment > *u)
 
virtual Unit< state, action, environment > * GetTarget ()
 
virtual bool MakeMove (environment *env, OccupancyInterface< state, action > *oi, SimulationInfo< state, action, environment > *si, action &a)
 
virtual void UpdateLocation (environment *env, state &l, bool success, SimulationInfo< state, action, environment > *si)
 
virtual void GetLocation (state &s)
 
virtual void OpenGLDraw (const environment *, const SimulationInfo< state, action, environment > *) const
 
void LogStats (StatCollection *stats)
 log an stats that may have been computed during the last run More...
 
void LogFinalStats (StatCollection *stats)
 log any final one-time stats before a simulation is ended More...
 
- Public Member Functions inherited from Unit< state, action, environment >
 Unit ()
 
virtual ~Unit ()
 
virtual double GetSpeed ()
 
void SetSpeed (double s)
 
virtual void SetColor (GLfloat _r, GLfloat _g, GLfloat _b)
 
virtual void GetColor (GLfloat &_r, GLfloat &_g, GLfloat &_b) const
 
UnitGroup< state, action, environment > * GetUnitGroup ()
 
void SetUnitGroup (UnitGroup< state, action, environment > *_group)
 
virtual unsigned int GetNum ()
 
virtual void SetNum (unsigned int num)
 
virtual void StartNewTrial (StatCollection *)
 
virtual int GetPriority ()
 
virtual void SetPriority (int val)
 

Protected Member Functions

virtual void AddPathToCache (environment *env, std::vector< state > &path)
 Store path as a vector of actions. More...
 
bool getCachedMove (action &a)
 

Protected Attributes

int nodesExpanded
 
int nodesTouched
 
std::vector< action > moves
 
GenericSearchAlgorithm< state, action, environment > * algorithm
 
Unit< state, action, environment > * target
 
state loc
 
state goal
 
state lastloc
 
double targetTime
 
double lastTime
 
bool onTarget
 

Detailed Description

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

A general unit which collects path information from a GenericSearchAlgorithm and incrementally executes that path in the world.

Definition at line 46 of file GenericSearchUnit.h.

Constructor & Destructor Documentation

◆ GenericSearchUnit() [1/2]

template<class state , class action , class environment >
GenericSearchUnit< state, action, environment >::GenericSearchUnit ( state &  start,
state &  goal,
GenericSearchAlgorithm< state, action, environment > *  alg 
)

Definition at line 90 of file GenericSearchUnit.h.

◆ GenericSearchUnit() [2/2]

template<class state , class action , class environment >
GenericSearchUnit< state, action, environment >::GenericSearchUnit ( state &  start,
Unit< state, action, environment > *  target,
GenericSearchAlgorithm< state, action, environment > *  alg 
)

Definition at line 112 of file GenericSearchUnit.h.

◆ ~GenericSearchUnit()

template<class state , class action , class environment >
GenericSearchUnit< state, action, environment >::~GenericSearchUnit
virtual

Definition at line 127 of file GenericSearchUnit.h.

Member Function Documentation

◆ AddPathToCache()

template<class state , class action , class environment >
void GenericSearchUnit< state, action, environment >::AddPathToCache ( environment *  theEnv,
std::vector< state > &  path 
)
protectedvirtual

Store path as a vector of actions.

??? Rename moves --> actions? Moves only for maps?

Reimplemented in GenericPatrolUnit< state, action, environment >.

Definition at line 271 of file GenericSearchUnit.h.

◆ Done()

template<class state , class action , class environment >
virtual bool GenericSearchUnit< state, action, environment >::Done ( )
inlinevirtual

◆ getAlgorithm()

template<class state , class action , class environment >
virtual GenericSearchAlgorithm<state,action,environment>* GenericSearchUnit< state, action, environment >::getAlgorithm ( )
inlinevirtual

◆ getCachedMove()

template<class state , class action , class environment >
bool GenericSearchUnit< state, action, environment >::getCachedMove ( action &  a)
protected

Definition at line 280 of file GenericSearchUnit.h.

◆ GetGoal()

template<class state , class action , class environment >
virtual void GenericSearchUnit< state, action, environment >::GetGoal ( state &  s)
inlinevirtual

◆ GetLocation()

template<class state , class action , class environment >
virtual void GenericSearchUnit< state, action, environment >::GetLocation ( state &  s)
inlinevirtual

◆ GetName()

template<class state , class action , class environment >
virtual const char* GenericSearchUnit< state, action, environment >::GetName ( )
inlinevirtual

◆ GetTarget()

template<class state , class action , class environment >
virtual Unit<state,action,environment>* GenericSearchUnit< state, action, environment >::GetTarget ( )
inlinevirtual

◆ LogFinalStats()

template<class state , class action , class environment >
void GenericSearchUnit< state, action, environment >::LogFinalStats ( StatCollection )
virtual

log any final one-time stats before a simulation is ended

Reimplemented from Unit< state, action, environment >.

Definition at line 261 of file GenericSearchUnit.h.

◆ LogStats()

template<class state , class action , class environment >
void GenericSearchUnit< state, action, environment >::LogStats ( StatCollection )
virtual

log an stats that may have been computed during the last run

Reimplemented from Unit< state, action, environment >.

Definition at line 244 of file GenericSearchUnit.h.

References StatCollection::AddStat().

◆ MakeMove()

template<class state , class action , class environment >
bool GenericSearchUnit< state, action, environment >::MakeMove ( environment *  env,
OccupancyInterface< state, action > *  oi,
SimulationInfo< state, action, environment > *  si,
action &  a 
)
virtual

◆ OpenGLDraw()

template<class state , class action , class environment >
void GenericSearchUnit< state, action, environment >::OpenGLDraw ( const environment *  theEnv,
const SimulationInfo< state, action, environment > *  si 
) const
virtual

◆ SetTarget()

template<class state , class action , class environment >
virtual void GenericSearchUnit< state, action, environment >::SetTarget ( Unit< state, action, environment > *  u)
inlinevirtual

◆ UpdateLocation()

template<class state , class action , class environment >
void GenericSearchUnit< state, action, environment >::UpdateLocation ( environment *  env,
state &  l,
bool  success,
SimulationInfo< state, action, environment > *  si 
)
virtual

Member Data Documentation

◆ algorithm

template<class state , class action , class environment >
GenericSearchAlgorithm<state,action,environment>* GenericSearchUnit< state, action, environment >::algorithm
protected

◆ goal

template<class state , class action , class environment >
state GenericSearchUnit< state, action, environment >::goal
protected

◆ lastloc

template<class state , class action , class environment >
state GenericSearchUnit< state, action, environment >::lastloc
protected

Definition at line 83 of file GenericSearchUnit.h.

◆ lastTime

template<class state , class action , class environment >
double GenericSearchUnit< state, action, environment >::lastTime
protected

Definition at line 84 of file GenericSearchUnit.h.

◆ loc

template<class state , class action , class environment >
state GenericSearchUnit< state, action, environment >::loc
protected

◆ moves

template<class state , class action , class environment >
std::vector<action> GenericSearchUnit< state, action, environment >::moves
protected

Definition at line 77 of file GenericSearchUnit.h.

◆ nodesExpanded

template<class state , class action , class environment >
int GenericSearchUnit< state, action, environment >::nodesExpanded
protected

Definition at line 75 of file GenericSearchUnit.h.

◆ nodesTouched

template<class state , class action , class environment >
int GenericSearchUnit< state, action, environment >::nodesTouched
protected

Definition at line 76 of file GenericSearchUnit.h.

◆ onTarget

template<class state , class action , class environment >
bool GenericSearchUnit< state, action, environment >::onTarget
protected

Definition at line 85 of file GenericSearchUnit.h.

◆ target

template<class state , class action , class environment >
Unit<state,action,environment>* GenericSearchUnit< state, action, environment >::target
protected

◆ targetTime

template<class state , class action , class environment >
double GenericSearchUnit< state, action, environment >::targetTime
protected

Definition at line 84 of file GenericSearchUnit.h.


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