HOG2
|
A general unit which collects path information from a SearchAlgorithm and incrementally executes that path in the world. More...
#include <SearchUnit.h>
Public Member Functions | |
SearchUnit (int x, int y, AbsMapUnit *target, SearchAlgorithm *alg) | |
virtual | ~SearchUnit () |
virtual const char * | GetName () |
virtual SearchAlgorithm * | getAlgorithm () |
virtual bool | Done () |
void | GetGoal (xyLoc &gs) |
virtual void | setTarget (AbsMapUnit *u) |
virtual bool | MakeMove (AbsMapEnvironment *ame, OccupancyInterface< xyLoc, tDirection > *, AbsMapSimulationInfo *si, tDirection &dir) |
virtual bool | makeMove (MapProvider *, reservationProvider *, AbsMapSimulationInfo *simInfo, tDirection &dir) |
void | UpdateLocation (AbsMapEnvironment *, xyLoc &l, bool success, AbsMapSimulationInfo *si) |
virtual void | updateLocation (int _x, int _y, bool, AbsMapSimulationInfo *) |
virtual void | OpenGLDraw (const AbsMapEnvironment *, const AbsMapSimulationInfo *) 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 AbsMapUnit | |
AbsMapUnit (int x, int y) | |
virtual | ~AbsMapUnit () |
virtual void | GetLocation (xyLoc &l) |
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 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 (path *p) |
bool | getCachedMove (tDirection &dir) |
Protected Attributes | |
int | nodesExpanded |
int | nodesTouched |
std::vector< tDirection > | moves |
SearchAlgorithm * | algorithm |
spreadExecSearchAlgorithm * | s_algorithm |
path * | spread_cache |
AbsMapUnit * | target |
double | targetTime |
bool | onTarget |
Protected Attributes inherited from AbsMapUnit | |
GLfloat | r |
GLfloat | g |
GLfloat | b |
xyLoc | loc |
A general unit which collects path information from a SearchAlgorithm and incrementally executes that path in the world.
Definition at line 26 of file SearchUnit.h.
SearchUnit::SearchUnit | ( | int | x, |
int | y, | ||
AbsMapUnit * | target, | ||
SearchAlgorithm * | alg | ||
) |
Definition at line 20 of file SearchUnit.cpp.
References algorithm, nodesExpanded, nodesTouched, onTarget, s_algorithm, spread_cache, target, and targetTime.
|
virtual |
Definition at line 79 of file SearchUnit.cpp.
References algorithm, and spread_cache.
|
protectedvirtual |
Definition at line 222 of file SearchUnit.cpp.
References node::GetLabelL(), GetName(), kE, GraphAbstractionConstants::kFirstData, kN, kS, kStay, kW, moves, path::n, and path::next.
Referenced by makeMove().
|
inlinevirtual |
Reimplemented from Unit< state, action, environment >.
Definition at line 33 of file SearchUnit.h.
References onTarget.
|
inlinevirtual |
Definition at line 31 of file SearchUnit.h.
References algorithm.
|
protected |
Definition at line 89 of file SearchUnit.cpp.
References algorithm, SearchAlgorithm::GetNodesExpanded(), SearchAlgorithm::GetNodesTouched(), moves, nodesExpanded, nodesTouched, s_algorithm, spread_cache, and spreadExecSearchAlgorithm::think().
Referenced by makeMove().
|
inlinevirtual |
Implements AbsMapUnit.
Definition at line 35 of file SearchUnit.h.
References AbsMapUnit::GetLocation(), and target.
|
inlinevirtual |
Implements AbsMapUnit.
Reimplemented in praStarUnit.
Definition at line 30 of file SearchUnit.h.
References algorithm, and SearchAlgorithm::GetName().
Referenced by addPathToCache(), LogStats(), makeMove(), and updateLocation().
|
virtual |
log any final one-time stats before a simulation is ended
Reimplemented from Unit< state, action, environment >.
Definition at line 346 of file SearchUnit.cpp.
References algorithm, 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 330 of file SearchUnit.cpp.
References StatCollection::AddStat(), GetName(), nodesExpanded, and nodesTouched.
|
inlinevirtual |
|
virtual |
Definition at line 108 of file SearchUnit.cpp.
References addPathToCache(), algorithm, getCachedMove(), node::GetLabelL(), AbsMapUnit::GetLocation(), MapProvider::GetMap(), MapProvider::GetMapAbstraction(), GetName(), Graph::GetNode(), Map::GetNodeNum(), SearchAlgorithm::GetNodesExpanded(), SearchAlgorithm::GetNodesTouched(), SearchAlgorithm::GetPath(), SimulationInfo< state, action, environment >::GetSimulationTime(), GraphAbstractionConstants::kFirstData, moves, path::n, path::next, nodesExpanded, nodesTouched, onTarget, s_algorithm, spreadExecSearchAlgorithm::setTargets(), spread_cache, path::tail(), target, targetTime, verbose, xyLoc::x, loc::x, xyLoc::y, and loc::y.
Referenced by praStarUnit::makeMove(), and MakeMove().
|
virtual |
Reimplemented from AbsMapUnit.
Definition at line 283 of file SearchUnit.cpp.
References AbsMapUnit::b, DrawPyramid(), DrawSphere(), AbsMapUnit::g, AbsMapUnit::GetLocation(), Map::GetOpenGLCoord(), SimulationInfo< state, action, environment >::GetSimulationTime(), kE, kN, kS, kW, moves, onTarget, AbsMapUnit::r, target, targetTime, xyLoc::x, loc::x, xyLoc::y, and loc::y.
|
inlinevirtual |
Definition at line 37 of file SearchUnit.h.
References target.
|
inlinevirtual |
Reimplemented from AbsMapUnit.
Definition at line 45 of file SearchUnit.h.
References updateLocation(), xyLoc::x, and xyLoc::y.
|
virtual |
Definition at line 270 of file SearchUnit.cpp.
References GetName(), moves, spread_cache, verbose, loc::x, and loc::y.
Referenced by UpdateLocation().
|
protected |
Definition at line 58 of file SearchUnit.h.
Referenced by getAlgorithm(), getCachedMove(), GetName(), LogFinalStats(), makeMove(), SearchUnit(), and ~SearchUnit().
|
protected |
Definition at line 56 of file SearchUnit.h.
Referenced by addPathToCache(), getCachedMove(), praStarUnit::makeMove(), makeMove(), OpenGLDraw(), and updateLocation().
|
protected |
Definition at line 54 of file SearchUnit.h.
Referenced by getCachedMove(), LogStats(), makeMove(), and SearchUnit().
|
protected |
Definition at line 55 of file SearchUnit.h.
Referenced by getCachedMove(), LogStats(), makeMove(), and SearchUnit().
|
protected |
Definition at line 65 of file SearchUnit.h.
Referenced by Done(), makeMove(), OpenGLDraw(), and SearchUnit().
|
protected |
Definition at line 59 of file SearchUnit.h.
Referenced by getCachedMove(), makeMove(), and SearchUnit().
|
protected |
Definition at line 60 of file SearchUnit.h.
Referenced by getCachedMove(), makeMove(), SearchUnit(), updateLocation(), and ~SearchUnit().
|
protected |
Definition at line 62 of file SearchUnit.h.
Referenced by GetGoal(), makeMove(), OpenGLDraw(), SearchUnit(), and setTarget().
|
protected |
Definition at line 64 of file SearchUnit.h.
Referenced by makeMove(), OpenGLDraw(), and SearchUnit().