HOG2
|
#include <PatrolUnit.h>
Public Member Functions | |
patrolUnit (int x, int y) | |
virtual const char * | GetName () |
virtual tDirection | makeMove (MapProvider *, reservationProvider *, SimulationInfo *simInfo) |
** Creates a patrol unit and assigns it numPLocations random locations to patrol. More... | |
void | OpenGLDraw (const MapProvider *, const SimulationInfo *) const |
void | addPatrolLocation (unit *) |
unit * | GetGoal () |
void | updateLocation (int _x, int _y, bool worked, SimulationInfo *) |
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 bool | MakeMove (environment *, OccupancyInterface< state, action > *, SimulationInfo< state, action, environment > *, action &a)=0 |
virtual void | UpdateLocation (environment *, state &, bool success, SimulationInfo< state, action, environment > *)=0 |
virtual void | GetLocation (state &)=0 |
virtual void | OpenGLDraw (const environment *, const SimulationInfo< state, action, environment > *) const =0 |
virtual void | GetGoal (state &s) |
virtual bool | Done () |
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 | |
double | goToLoc (MapAbstraction *aMap, int which) |
void | addPathToCache (path *p) |
Private Attributes | |
std::vector< tDirection > | moves |
std::vector< unit * > | Locs |
aStar | a |
int | currTarget |
uint64_t | nodesExpanded |
uint64_t | nodesTouched |
Definition at line 19 of file PatrolUnit.h.
patrolUnit::patrolUnit | ( | int | x, |
int | y | ||
) |
Definition at line 15 of file PatrolUnit.cpp.
References currTarget, nodesExpanded, and nodesTouched.
|
private |
Definition at line 125 of file PatrolUnit.cpp.
References node::GetLabelL(), GetName(), kE, GraphAbstractionConstants::kFirstData, kN, kS, kStay, kW, moves, path::n, and path::next.
Referenced by goToLoc().
void patrolUnit::addPatrolLocation | ( | unit * | ru | ) |
Definition at line 112 of file PatrolUnit.cpp.
References currTarget, and Locs.
unit * patrolUnit::GetGoal | ( | ) |
Definition at line 118 of file PatrolUnit.cpp.
References currTarget, and Locs.
|
inlinevirtual |
Implements Unit< state, action, environment >.
Definition at line 23 of file PatrolUnit.h.
Referenced by addPathToCache(), and LogStats().
|
private |
Definition at line 64 of file PatrolUnit.cpp.
References a, addPathToCache(), aStar::GetNodesExpanded(), aStar::GetNodesTouched(), aStar::GetPath(), Locs, nodesExpanded, and nodesTouched.
Referenced by makeMove().
|
virtual |
log any final one-time stats before a simulation is ended
Reimplemented from Unit< state, action, environment >.
Definition at line 189 of file PatrolUnit.cpp.
References a, and SearchAlgorithm::LogFinalStats().
|
virtual |
log an stats that may have been computed during the last run
Reimplemented from Unit< state, action, environment >.
Definition at line 173 of file PatrolUnit.cpp.
References StatCollection::AddStat(), GetName(), nodesExpanded, and nodesTouched.
|
virtual |
** Creates a patrol unit and assigns it numPLocations random locations to patrol.
Definition at line 40 of file PatrolUnit.cpp.
References currTarget, MapProvider::GetMapAbstraction(), goToLoc(), kStay, Locs, and moves.
void patrolUnit::OpenGLDraw | ( | const MapProvider * | mp, |
const SimulationInfo * | |||
) | const |
Definition at line 85 of file PatrolUnit.cpp.
References Unit< state, action, environment >::b, Unit< state, action, environment >::g, MapProvider::GetMap(), Map::GetOpenGLCoord(), kE, kN, kS, kW, moves, and Unit< state, action, environment >::r.
|
inline |
Definition at line 28 of file PatrolUnit.h.
References currTarget, and moves.
|
private |
Definition at line 37 of file PatrolUnit.h.
Referenced by goToLoc(), and LogFinalStats().
|
private |
Definition at line 39 of file PatrolUnit.h.
Referenced by addPatrolLocation(), GetGoal(), makeMove(), patrolUnit(), and updateLocation().
|
private |
Definition at line 36 of file PatrolUnit.h.
Referenced by addPatrolLocation(), GetGoal(), goToLoc(), and makeMove().
|
private |
Definition at line 35 of file PatrolUnit.h.
Referenced by addPathToCache(), makeMove(), OpenGLDraw(), and updateLocation().
|
private |
Definition at line 40 of file PatrolUnit.h.
Referenced by goToLoc(), LogStats(), and patrolUnit().
|
private |
Definition at line 41 of file PatrolUnit.h.
Referenced by goToLoc(), LogStats(), and patrolUnit().