HOG2
|
#include <DynamicWeightedGrid.h>
Public Member Functions | |
DynamicWeightedGrid (int width, int height) | |
DynamicWeightedGrid (const char *map, int minRegionSize=80) | |
void | SaveMap (const char *filename) |
int | GetWidth () const |
int | GetHeight () const |
void | SetTerrainType (const xyLoc &l, TerrainType t) |
TerrainType | GetTerrainType (const xyLoc &l) const |
void | GetSuccessors (const abstractState &nodeID, std::vector< abstractState > &neighbors) const |
void | GetActions (const abstractState &nodeID, std::vector< edge > &actions) const |
void | ApplyAction (abstractState &s, edge a) const |
bool | InvertAction (edge &a) const |
edge | GetAction (const abstractState &s1, const abstractState &s2) const |
double | HCost (const abstractState &node1, const abstractState &node2) const |
Heuristic value between two arbitrary nodes. More... | |
double | GCost (const abstractState &node1, const abstractState &node2) const |
double | GCost (const abstractState &node, const edge &act) const |
bool | GoalTest (const abstractState &node, const abstractState &goal) const |
uint64_t | GetStateHash (const abstractState &node) const |
uint64_t | GetActionHash (edge act) const |
void | Draw (Graphics::Display &display) const |
void | Draw (Graphics::Display &display, const abstractState &) const |
void | OpenGLDraw () const |
void | OpenGLDraw (const abstractState &) const |
void | OpenGLDraw (const abstractState &, const edge &) const |
void | GLDrawLine (const abstractState &x, const abstractState &y) const |
void | GetPointFromCoordinate (point3d loc, int &px, int &py) const |
void | SetCosts (std::vector< double > &c) |
void | SetCost (TerrainType t, double cost) |
std::vector< double > & | GetCosts () |
abstractState | GetState (const xyLoc &l) |
xyLoc | GetLocation (const abstractState &a) |
uint64_t | EstimateMemoryInBytes () |
int | GetNumEdges () |
int | GetNumRegions () |
void | SetDrawAbstraction (bool draw) |
bool | GetDrawAbstraction () |
void | ValidateEdges () const |
void | GetCoordinate (const xyLoc &l, float &x, float &y, float &r) const |
Public Member Functions inherited from SearchEnvironment< abstractState, edge > | |
virtual | ~SearchEnvironment () |
virtual void | GetSuccessors (const abstractState &nodeID, std::vector< abstractState > &neighbors) const=0 |
virtual void | GetActions (const abstractState &nodeID, std::vector< edge > &actions) const=0 |
virtual int | GetNumSuccessors (const abstractState &stateID) const |
virtual edge | GetAction (const abstractState &s1, const abstractState &s2) const |
virtual void | ApplyAction (abstractState &s, edge a) const=0 |
virtual void | UndoAction (abstractState &s, edge a) const |
virtual void | GetNextState (const abstractState &s1, edge a, abstractState &s2) const |
virtual bool | InvertAction (edge &a) const=0 |
virtual void | StoreGoal (abstractState &s) |
Stores the goal for use by single-state HCost. More... | |
virtual void | ClearGoal () |
Clears the goal from memory. More... | |
virtual bool | IsGoalStored () const |
Returns true if the goal is stored and false otherwise. More... | |
virtual double | HCost (const abstractState &node1, const abstractState &node2) const=0 |
Heuristic value between two arbitrary nodes. More... | |
virtual double | HCost (const abstractState &node1, const abstractState &node2, double parentHCost) const |
virtual double | HCost (const abstractState &node) const |
Heuristic value between node and the stored goal. More... | |
virtual double | GCost (const abstractState &node1, const abstractState &node2) const=0 |
virtual double | GCost (const abstractState &node, const edge &act) const=0 |
virtual bool | GoalTest (const abstractState &node, const abstractState &goal) const=0 |
virtual bool | GoalTest (const abstractState &node) const |
Goal Test if the goal is stored. More... | |
virtual uint64_t | GetMaxHash () const |
virtual uint64_t | GetStateHash (const abstractState &node) const=0 |
virtual void | GetStateFromHash (uint64_t parent, abstractState &s) const |
virtual uint64_t | GetActionHash (edge act) const=0 |
virtual double | GetPathLength (std::vector< abstractState > &neighbors) |
virtual double | GetPathLength (const abstractState &start, std::vector< edge > &neighbors) |
virtual OccupancyInterface< abstractState, edge > * | GetOccupancyInfo () |
virtual void | SetOccupancyInfo (OccupancyInterface< abstractState, edge > *) |
virtual void | OpenGLDraw () const |
virtual void | OpenGLDraw (const abstractState &) const |
virtual void | OpenGLDraw (const abstractState &, const abstractState &, float) const |
Draw the transition at some percentage 0...1 between two states. More... | |
virtual void | OpenGLDraw (const abstractState &, const edge &) const |
virtual void | GLLabelState (const abstractState &, const char *) const |
virtual void | GLDrawLine (const abstractState &x, const abstractState &y) const |
virtual void | GLDrawPath (const std::vector< abstractState > &x) const |
virtual void | SetColor (const rgbColor &r) const |
virtual void | SetColor (GLfloat rr, GLfloat g, GLfloat b, GLfloat t=1.0) const |
virtual void | GetColor (GLfloat &rr, GLfloat &g, GLfloat &b, GLfloat &t) const |
virtual rgbColor | GetColor () const |
virtual void | Draw (Graphics::Display &display, const abstractState &) const |
virtual void | DrawLine (Graphics::Display &display, const abstractState &x, const abstractState &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< abstractState > | |
Heuristic () | |
virtual | ~Heuristic () |
Static Public Member Functions | |
static rgbColor | GetTerrainColor (TerrainType t) |
Private Member Functions | |
bool | FindEdge (int fromSector, int fromRegion, int toSector, int toRegion) const |
void | DrawSector (Graphics::Display &display, int sector) const |
void | EliminateSmallRegions (int limit) |
void | BuildAbstraction () |
void | GetRegions (int sector) |
void | GetEdges (int sector) |
regionData | BFS (SectorData< sectorSize > &d, int x, int y, int whichRegion) |
void | AddEdge (SectorData< sectorSize > &d, int s1, int r1, int s2, int r2) |
int | GetNumSectors () const |
int | GetNumXSectors () const |
int | GetNumYSectors () const |
int | GetRegion (const xyLoc &l) |
int | GetSector (const xyLoc &l) const |
void | GetSectorOffset (const xyLoc &l, int &x, int &y) const |
void | SetTerrainTypeNoRepair (const xyLoc &l, TerrainType t) |
Private Attributes | |
std::vector< SectorData< sectorSize > > | sectors |
int | mWidth |
int | mHeight |
bool | drawAbstraction |
std::vector< double > | costs |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< abstractState > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Protected Attributes inherited from SearchEnvironment< abstractState, edge > | |
bool | bValidSearchGoal |
abstractState | searchGoal |
rgbColor | color |
GLfloat | transparency |
Definition at line 70 of file DynamicWeightedGrid.h.
DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid | ( | int | width, |
int | height | ||
) |
Definition at line 266 of file DynamicWeightedGrid.h.
References DWG::DynamicWeightedGrid< sectorSize >::BuildAbstraction(), DWG::DynamicWeightedGrid< sectorSize >::drawAbstraction, DWG::DynamicWeightedGrid< sectorSize >::GetNumSectors(), DWG::kGround, DWG::DynamicWeightedGrid< sectorSize >::mHeight, DWG::DynamicWeightedGrid< sectorSize >::mWidth, DWG::DynamicWeightedGrid< sectorSize >::sectors, and DWG::DynamicWeightedGrid< sectorSize >::SetTerrainTypeNoRepair().
DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid | ( | const char * | map, |
int | minRegionSize = 80 |
||
) |
Definition at line 282 of file DynamicWeightedGrid.h.
|
private |
Definition at line 505 of file DynamicWeightedGrid.h.
References d.
void DWG::DynamicWeightedGrid< sectorSize >::ApplyAction | ( | abstractState & | s, |
edge | a | ||
) | const |
Definition at line 771 of file DynamicWeightedGrid.h.
References DWG::abstractState::region, DWG::edge::regionTo, DWG::abstractState::sector, and DWG::edge::sectorTo.
|
private |
Definition at line 421 of file DynamicWeightedGrid.h.
References d, DWG::kNoRegion, xyLoc::x, and xyLoc::y.
|
private |
Definition at line 377 of file DynamicWeightedGrid.h.
Referenced by DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid().
|
virtual |
Reimplemented from SearchEnvironment< abstractState, edge >.
Definition at line 958 of file DynamicWeightedGrid.h.
References d, Colors::darkgray, Graphics::Display::DrawLine(), Graphics::Display::FillCircle(), Colors::gray, and Colors::green.
void DWG::DynamicWeightedGrid< sectorSize >::Draw | ( | Graphics::Display & | display, |
const abstractState & | absState | ||
) | const |
Definition at line 1008 of file DynamicWeightedGrid.h.
References Graphics::Display::FillCircle(), Colors::GetColor(), DWG::abstractState::region, and DWG::abstractState::sector.
|
private |
Definition at line 904 of file DynamicWeightedGrid.h.
References Graphics::Display::FillRect(), Graphics::Display::FillSquare(), xyLoc::x, and xyLoc::y.
|
private |
Definition at line 552 of file DynamicWeightedGrid.h.
|
inline |
Definition at line 117 of file DynamicWeightedGrid.h.
References DWG::DynamicWeightedGrid< sectorSize >::mHeight, DWG::DynamicWeightedGrid< sectorSize >::mWidth, and DWG::DynamicWeightedGrid< sectorSize >::sectors.
|
private |
Definition at line 542 of file DynamicWeightedGrid.h.
double DWG::DynamicWeightedGrid< sectorSize >::GCost | ( | const abstractState & | node, |
const edge & | act | ||
) | const |
Definition at line 823 of file DynamicWeightedGrid.h.
double DWG::DynamicWeightedGrid< sectorSize >::GCost | ( | const abstractState & | node1, |
const abstractState & | node2 | ||
) | const |
Definition at line 807 of file DynamicWeightedGrid.h.
References DWG::abstractState::region, DWG::abstractState::sector, xyLoc::x, and xyLoc::y.
edge DWG::DynamicWeightedGrid< sectorSize >::GetAction | ( | const abstractState & | s1, |
const abstractState & | s2 | ||
) | const |
Definition at line 786 of file DynamicWeightedGrid.h.
uint64_t DWG::DynamicWeightedGrid< sectorSize >::GetActionHash | ( | edge | act | ) | const |
Definition at line 845 of file DynamicWeightedGrid.h.
void DWG::DynamicWeightedGrid< sectorSize >::GetActions | ( | const abstractState & | nodeID, |
std::vector< edge > & | actions | ||
) | const |
Definition at line 758 of file DynamicWeightedGrid.h.
References d, DWG::abstractState::region, and DWG::abstractState::sector.
void DWG::DynamicWeightedGrid< sectorSize >::GetCoordinate | ( | const xyLoc & | l, |
float & | x, | ||
float & | y, | ||
float & | r | ||
) | const |
Definition at line 852 of file DynamicWeightedGrid.h.
|
inline |
Definition at line 111 of file DynamicWeightedGrid.h.
References DWG::DynamicWeightedGrid< sectorSize >::costs.
|
inline |
Definition at line 150 of file DynamicWeightedGrid.h.
References DWG::DynamicWeightedGrid< sectorSize >::drawAbstraction.
|
private |
Definition at line 467 of file DynamicWeightedGrid.h.
int DWG::DynamicWeightedGrid< sectorSize >::GetHeight |
Definition at line 341 of file DynamicWeightedGrid.h.
xyLoc DWG::DynamicWeightedGrid< sectorSize >::GetLocation | ( | const abstractState & | a | ) |
Definition at line 683 of file DynamicWeightedGrid.h.
References DWG::abstractState::region, and DWG::abstractState::sector.
|
inline |
Definition at line 131 of file DynamicWeightedGrid.h.
References DWG::DynamicWeightedGrid< sectorSize >::sectors.
|
inline |
Definition at line 140 of file DynamicWeightedGrid.h.
References DWG::DynamicWeightedGrid< sectorSize >::sectors.
|
private |
Definition at line 689 of file DynamicWeightedGrid.h.
Referenced by DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid().
|
private |
Definition at line 696 of file DynamicWeightedGrid.h.
|
private |
Definition at line 703 of file DynamicWeightedGrid.h.
void DWG::DynamicWeightedGrid< sectorSize >::GetPointFromCoordinate | ( | point3d | loc, |
int & | px, | ||
int & | py | ||
) | const |
Definition at line 875 of file DynamicWeightedGrid.h.
|
private |
Definition at line 710 of file DynamicWeightedGrid.h.
|
private |
Definition at line 390 of file DynamicWeightedGrid.h.
References d, and DWG::kNoRegion.
|
private |
Definition at line 718 of file DynamicWeightedGrid.h.
|
private |
Definition at line 726 of file DynamicWeightedGrid.h.
abstractState DWG::DynamicWeightedGrid< sectorSize >::GetState | ( | const xyLoc & | l | ) |
Definition at line 674 of file DynamicWeightedGrid.h.
References DWG::abstractState::region, and DWG::abstractState::sector.
uint64_t DWG::DynamicWeightedGrid< sectorSize >::GetStateHash | ( | const abstractState & | node | ) | const |
Definition at line 837 of file DynamicWeightedGrid.h.
void DWG::DynamicWeightedGrid< sectorSize >::GetSuccessors | ( | const abstractState & | nodeID, |
std::vector< abstractState > & | neighbors | ||
) | const |
Definition at line 745 of file DynamicWeightedGrid.h.
References d, DWG::abstractState::region, and DWG::abstractState::sector.
|
inlinestatic |
Definition at line 176 of file DynamicWeightedGrid.h.
References Colors::black, Colors::blue, Colors::bluegreen, Colors::brown, Colors::cyan, Colors::darkblue, Colors::darkbluegray, Colors::darkgray, Colors::darkgreen, Colors::darkyellow, Colors::green, DWG::kBlack, DWG::kBlight, DWG::kDeepWater, DWG::kDesert, DWG::kGround, DWG::kHills, DWG::kIce, DWG::kJungle, DWG::kMountain, DWG::kPlains, DWG::kRiver, DWG::kRoad, DWG::kSwamp, DWG::kTrees, DWG::kTundra, DWG::kWater, Colors::lightblue, Colors::lightbrown, Colors::lightgray, Colors::lightyellow, Colors::orange, Colors::white, and Colors::yellow.
TerrainType DWG::DynamicWeightedGrid< sectorSize >::GetTerrainType | ( | const xyLoc & | l | ) | const |
Definition at line 367 of file DynamicWeightedGrid.h.
int DWG::DynamicWeightedGrid< sectorSize >::GetWidth |
Definition at line 337 of file DynamicWeightedGrid.h.
|
inline |
Definition at line 99 of file DynamicWeightedGrid.h.
bool DWG::DynamicWeightedGrid< sectorSize >::GoalTest | ( | const abstractState & | node, |
const abstractState & | goal | ||
) | const |
Definition at line 831 of file DynamicWeightedGrid.h.
double DWG::DynamicWeightedGrid< sectorSize >::HCost | ( | const abstractState & | node1, |
const abstractState & | node2 | ||
) | const |
Heuristic value between two arbitrary nodes.
Definition at line 793 of file DynamicWeightedGrid.h.
References DWG::abstractState::region, DWG::abstractState::sector, xyLoc::x, and xyLoc::y.
bool DWG::DynamicWeightedGrid< sectorSize >::InvertAction | ( | edge & | a | ) | const |
Definition at line 778 of file DynamicWeightedGrid.h.
References DWG::edge::regionFrom, DWG::edge::regionTo, DWG::edge::sectorFrom, DWG::edge::sectorTo, and swap().
|
inline |
Definition at line 96 of file DynamicWeightedGrid.h.
|
inline |
Definition at line 97 of file DynamicWeightedGrid.h.
|
inline |
Definition at line 98 of file DynamicWeightedGrid.h.
void DWG::DynamicWeightedGrid< sectorSize >::SaveMap | ( | const char * | filename | ) |
Definition at line 316 of file DynamicWeightedGrid.h.
|
inline |
Definition at line 107 of file DynamicWeightedGrid.h.
|
inline |
Definition at line 102 of file DynamicWeightedGrid.h.
References DWG::DynamicWeightedGrid< sectorSize >::ValidateEdges().
|
inline |
Definition at line 149 of file DynamicWeightedGrid.h.
References DWG::DynamicWeightedGrid< sectorSize >::drawAbstraction.
void DWG::DynamicWeightedGrid< sectorSize >::SetTerrainType | ( | const xyLoc & | l, |
TerrainType | t | ||
) |
Definition at line 345 of file DynamicWeightedGrid.h.
|
private |
Definition at line 733 of file DynamicWeightedGrid.h.
Referenced by DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid().
void DWG::DynamicWeightedGrid< sectorSize >::ValidateEdges |
Definition at line 517 of file DynamicWeightedGrid.h.
References fequal().
Referenced by DWG::DynamicWeightedGrid< sectorSize >::SetCosts().
|
private |
Definition at line 173 of file DynamicWeightedGrid.h.
Referenced by DWG::DynamicWeightedGrid< sectorSize >::GetCosts().
|
private |
Definition at line 172 of file DynamicWeightedGrid.h.
Referenced by DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid(), DWG::DynamicWeightedGrid< sectorSize >::GetDrawAbstraction(), and DWG::DynamicWeightedGrid< sectorSize >::SetDrawAbstraction().
|
private |
Definition at line 171 of file DynamicWeightedGrid.h.
Referenced by DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid(), and DWG::DynamicWeightedGrid< sectorSize >::EstimateMemoryInBytes().
|
private |
Definition at line 171 of file DynamicWeightedGrid.h.
Referenced by DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid(), and DWG::DynamicWeightedGrid< sectorSize >::EstimateMemoryInBytes().
|
private |
Definition at line 170 of file DynamicWeightedGrid.h.
Referenced by DWG::DynamicWeightedGrid< sectorSize >::DynamicWeightedGrid(), DWG::DynamicWeightedGrid< sectorSize >::EstimateMemoryInBytes(), DWG::DynamicWeightedGrid< sectorSize >::GetNumEdges(), and DWG::DynamicWeightedGrid< sectorSize >::GetNumRegions().