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

#include <GenericPatrolUnit.h>

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

Public Member Functions

 GenericPatrolUnit (state &s, GenericSearchAlgorithm< state, action, environment > *alg)
 
 GenericPatrolUnit (state &s, GenericSearchAlgorithm< state, action, environment > *alg, GLfloat _r, GLfloat _g, GLfloat _b)
 
virtual const char * GetName ()
 
void SetName (char *myname)
 
virtual void GetLocation (state &s)
 
virtual bool MakeMove (environment *env, OccupancyInterface< state, action > *, SimulationInfo< state, action, environment > *si, action &dir)
 
virtual void OpenGLDraw (const environment *, const SimulationInfo< state, action, environment > *) const
 
void AddPatrolLocation (state &s)
 
state & GetGoal ()
 
void GetGoal (state &s)
 
virtual bool Done ()
 
void UpdateLocation (environment *, state &l, bool success, SimulationInfo< state, action, environment > *si)
 
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...
 
void SetNumPatrols (int num)
 
void SetTrimPath (bool trim)
 Set whether we want to trim the planned path. More...
 
void SetTrimWindow (double d)
 Set the window at which we want to trim the planned path. More...
 
void SetDrawUnit (bool draw)
 Set whether we want to draw the unit. More...
 
- Public Member Functions inherited from GenericSearchUnit< state, action, environment >
 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 GenericSearchAlgorithm< state, action, environment > * getAlgorithm ()
 
virtual void SetTarget (Unit< state, action, environment > *u)
 
virtual Unit< state, action, environment > * GetTarget ()
 
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)
 

Private Member Functions

void GoToLoc (environment *env, int which)
 
void AddPathToCache (environment *env, std::vector< state > &path)
 Store path as a vector of actions. More...
 

Private Attributes

state loc
 
int numPatrols
 
int counter
 
action oldDir
 
action oldDirColl
 
double totalDistance
 
double lastFailedMove
 
std::vector< action > moves
 
std::vector< state > locs
 
GenericSearchAlgorithm< state, action, environment > * algorithm
 
int currTarget
 
int nodesExpanded
 
int nodesTouched
 
int numFailedMoves
 
int numDirectionChanges
 
int numDirectionChangesCollisions
 
std::vector< int > nodesExpandedPatrols
 
std::vector< int > nodesTouchedPatrols
 
std::vector< int > numFailedMovesPatrols
 
std::vector< int > numDirectionChangesPatrols
 
std::vector< int > numDirectionChangesCollisionsPatrols
 
std::vector< double > totalDistancePatrols
 
char name [128]
 
bool trimPath
 
double trimWindow
 
bool drawUnit
 

Additional Inherited Members

- Protected Member Functions inherited from GenericSearchUnit< state, action, environment >
bool getCachedMove (action &a)
 
- Protected Attributes inherited from GenericSearchUnit< state, action, environment >
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 GenericPatrolUnit< state, action, environment >

Definition at line 11 of file GenericPatrolUnit.h.

Constructor & Destructor Documentation

◆ GenericPatrolUnit() [1/2]

template<class state , class action , class environment >
GenericPatrolUnit< state, action, environment >::GenericPatrolUnit ( state &  s,
GenericSearchAlgorithm< state, action, environment > *  alg 
)

◆ GenericPatrolUnit() [2/2]

template<class state , class action , class environment >
GenericPatrolUnit< state, action, environment >::GenericPatrolUnit ( state &  s,
GenericSearchAlgorithm< state, action, environment > *  alg,
GLfloat  _r,
GLfloat  _g,
GLfloat  _b 
)

Member Function Documentation

◆ AddPathToCache()

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

Store path as a vector of actions.

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

Reimplemented from GenericSearchUnit< state, action, environment >.

Definition at line 273 of file GenericPatrolUnit.h.

◆ AddPatrolLocation()

template<class state , class action , class environment >
void GenericPatrolUnit< state, action, environment >::AddPatrolLocation ( state &  s)

Definition at line 266 of file GenericPatrolUnit.h.

◆ Done()

template<class state , class action , class environment >
bool GenericPatrolUnit< state, action, environment >::Done
virtual

Reimplemented from GenericSearchUnit< state, action, environment >.

Definition at line 370 of file GenericPatrolUnit.h.

◆ GetGoal() [1/2]

template<class state , class action , class environment >
state& GenericPatrolUnit< state, action, environment >::GetGoal ( )

◆ GetGoal() [2/2]

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

◆ GetLocation()

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

◆ GetName()

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

◆ GoToLoc()

template<class state , class action , class environment >
void GenericPatrolUnit< state, action, environment >::GoToLoc ( environment *  env,
int  which 
)
private

Definition at line 241 of file GenericPatrolUnit.h.

References path.

◆ LogFinalStats()

template<class state , class action , class environment >
void GenericPatrolUnit< 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 405 of file GenericPatrolUnit.h.

References StatCollection::AddStat().

◆ LogStats()

template<class state , class action , class environment >
void GenericPatrolUnit< 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 385 of file GenericPatrolUnit.h.

References StatCollection::AddStat(), and StatCollection::SumStat().

◆ MakeMove()

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

Reimplemented from GenericSearchUnit< state, action, environment >.

Definition at line 160 of file GenericPatrolUnit.h.

◆ OpenGLDraw()

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

◆ SetDrawUnit()

template<class state , class action , class environment >
void GenericPatrolUnit< state, action, environment >::SetDrawUnit ( bool  draw)
inline

Set whether we want to draw the unit.

Default "true".

Author
Renee Jansen
Date
10/30/2007

Definition at line 53 of file GenericPatrolUnit.h.

References GenericPatrolUnit< state, action, environment >::drawUnit.

◆ SetName()

template<class state , class action , class environment >
void GenericPatrolUnit< state, action, environment >::SetName ( char *  myname)
inline

◆ SetNumPatrols()

template<class state , class action , class environment >
void GenericPatrolUnit< state, action, environment >::SetNumPatrols ( int  num)
inline

◆ SetTrimPath()

template<class state , class action , class environment >
void GenericPatrolUnit< state, action, environment >::SetTrimPath ( bool  trim)
inline

Set whether we want to trim the planned path.

Author
Renee Jansen
Date
10/2007

Definition at line 35 of file GenericPatrolUnit.h.

References GenericPatrolUnit< state, action, environment >::trimPath.

◆ SetTrimWindow()

template<class state , class action , class environment >
void GenericPatrolUnit< state, action, environment >::SetTrimWindow ( double  d)
inline

Set the window at which we want to trim the planned path.

If trimPath is set to true, this will determine where the path is trimmed

Author
Renee Jansen
Date
10/2007

Definition at line 45 of file GenericPatrolUnit.h.

References d, and GenericPatrolUnit< state, action, environment >::trimWindow.

◆ UpdateLocation()

template<class state , class action , class environment >
void GenericPatrolUnit< state, action, environment >::UpdateLocation ( environment *  theEnv,
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>* GenericPatrolUnit< state, action, environment >::algorithm
private

◆ counter

template<class state , class action , class environment >
int GenericPatrolUnit< state, action, environment >::counter
private

◆ currTarget

template<class state , class action , class environment >
int GenericPatrolUnit< state, action, environment >::currTarget
private

◆ drawUnit

template<class state , class action , class environment >
bool GenericPatrolUnit< state, action, environment >::drawUnit
private

◆ lastFailedMove

template<class state , class action , class environment >
double GenericPatrolUnit< state, action, environment >::lastFailedMove
private

◆ loc

template<class state , class action , class environment >
state GenericPatrolUnit< state, action, environment >::loc
private

◆ locs

template<class state , class action , class environment >
std::vector<state> GenericPatrolUnit< state, action, environment >::locs
private

◆ moves

template<class state , class action , class environment >
std::vector<action> GenericPatrolUnit< state, action, environment >::moves
private

Definition at line 71 of file GenericPatrolUnit.h.

◆ name

template<class state , class action , class environment >
char GenericPatrolUnit< state, action, environment >::name[128]
private

◆ nodesExpanded

template<class state , class action , class environment >
int GenericPatrolUnit< state, action, environment >::nodesExpanded
private

◆ nodesExpandedPatrols

template<class state , class action , class environment >
std::vector<int> GenericPatrolUnit< state, action, environment >::nodesExpandedPatrols
private

Definition at line 84 of file GenericPatrolUnit.h.

◆ nodesTouched

template<class state , class action , class environment >
int GenericPatrolUnit< state, action, environment >::nodesTouched
private

◆ nodesTouchedPatrols

template<class state , class action , class environment >
std::vector<int> GenericPatrolUnit< state, action, environment >::nodesTouchedPatrols
private

Definition at line 85 of file GenericPatrolUnit.h.

◆ numDirectionChanges

template<class state , class action , class environment >
int GenericPatrolUnit< state, action, environment >::numDirectionChanges
private

◆ numDirectionChangesCollisions

template<class state , class action , class environment >
int GenericPatrolUnit< state, action, environment >::numDirectionChangesCollisions
private

◆ numDirectionChangesCollisionsPatrols

template<class state , class action , class environment >
std::vector<int> GenericPatrolUnit< state, action, environment >::numDirectionChangesCollisionsPatrols
private

Definition at line 88 of file GenericPatrolUnit.h.

◆ numDirectionChangesPatrols

template<class state , class action , class environment >
std::vector<int> GenericPatrolUnit< state, action, environment >::numDirectionChangesPatrols
private

Definition at line 87 of file GenericPatrolUnit.h.

◆ numFailedMoves

template<class state , class action , class environment >
int GenericPatrolUnit< state, action, environment >::numFailedMoves
private

◆ numFailedMovesPatrols

template<class state , class action , class environment >
std::vector<int> GenericPatrolUnit< state, action, environment >::numFailedMovesPatrols
private

Definition at line 86 of file GenericPatrolUnit.h.

◆ numPatrols

template<class state , class action , class environment >
int GenericPatrolUnit< state, action, environment >::numPatrols
private

◆ oldDir

template<class state , class action , class environment >
action GenericPatrolUnit< state, action, environment >::oldDir
private

◆ oldDirColl

template<class state , class action , class environment >
action GenericPatrolUnit< state, action, environment >::oldDirColl
private

◆ totalDistance

template<class state , class action , class environment >
double GenericPatrolUnit< state, action, environment >::totalDistance
private

◆ totalDistancePatrols

template<class state , class action , class environment >
std::vector<double> GenericPatrolUnit< state, action, environment >::totalDistancePatrols
private

Definition at line 89 of file GenericPatrolUnit.h.

◆ trimPath

template<class state , class action , class environment >
bool GenericPatrolUnit< state, action, environment >::trimPath
private

◆ trimWindow

template<class state , class action , class environment >
double GenericPatrolUnit< state, action, environment >::trimWindow
private

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