HOG2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CanonicalGrid::CanonicalGrid Class Reference

#include <CanonicalGrid.h>

Inheritance diagram for CanonicalGrid::CanonicalGrid:
Inheritance graph
[legend]
Collaboration diagram for CanonicalGrid::CanonicalGrid:
Collaboration graph
[legend]

Public Member Functions

 CanonicalGrid (Map *m)
 
void GetSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const
 
void GetActions (const xyLoc &nodeID, std::vector< tDirection > &actions) const
 
tDirection GetAction (const xyLoc &s1, const xyLoc &s2) const
 
void ApplyAction (xyLoc &s, tDirection dir) const
 
bool InvertAction (tDirection &a) const
 
double HCost (const xyLoc &) const
 
double HCost (const xyLoc &node1, const xyLoc &node2) const
 
double GCost (const xyLoc &node1, const xyLoc &node2) const
 
double GCost (const xyLoc &node1, const tDirection &act) const
 
bool GoalTest (const xyLoc &node, const xyLoc &goal) const
 
bool GoalTest (const xyLoc &) const
 
uint64_t GetMaxHash () const
 
uint64_t GetStateHash (const xyLoc &node) const
 
uint64_t GetActionHash (tDirection act) const
 
void OpenGLDraw () const
 
void OpenGLDraw (const xyLoc &l) const
 
void OpenGLDraw (const xyLoc &l1, const xyLoc &l2, float v) const
 
void OpenGLDraw (const xyLoc &, const tDirection &) const
 
void GLLabelState (const xyLoc &, const char *) const
 
void GLLabelState (const xyLoc &s, const char *str, double scale) const
 
void GLDrawLine (const xyLoc &x, const xyLoc &y) const
 
MapGetMap () const
 
std::string SVGHeader ()
 
std::string SVGDraw ()
 
std::string SVGDraw (const xyLoc &)
 
std::string SVGLabelState (const xyLoc &, const char *, double scale) const
 
std::string SVGDrawLine (const xyLoc &x, const xyLoc &y, int width=1) const
 
std::string SVGFrameRect (int left, int top, int right, int bottom, int width=1)
 
virtual void Draw (Graphics::Display &disp) const
 
virtual void Draw (Graphics::Display &disp, const xyLoc &l) const
 
virtual void DrawAlternate (Graphics::Display &disp, const xyLoc &l) const
 
virtual void Draw (Graphics::Display &disp, const xyLoc &l1, const xyLoc &l2, float v) const
 
virtual void DrawStateLabel (Graphics::Display &disp, const xyLoc &l1, const char *txt) const
 
virtual void DrawStateLabel (Graphics::Display &disp, const xyLoc &l1, const xyLoc &l2, float v, const char *txt) const
 
virtual void DrawLine (Graphics::Display &disp, const xyLoc &x, const xyLoc &y, double width=1.0) const
 
virtual void DrawArrow (Graphics::Display &disp, const xyLoc &x, const xyLoc &y, double width=1.0) const
 
void DrawBasicOrdering (::Graphics::Display &disp, const xyLoc l) const
 
void DrawOrdering (::Graphics::Display &disp, const xyLoc l) const
 
void GetFirstJumpPoints (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const
 
void GetNextState (const xyLoc &currents, tDirection dir, xyLoc &news) const
 
void StoreGoal (xyLoc &)
 
void ClearGoal ()
 Clears the goal from memory. More...
 
bool IsGoalStored () const
 
void SetDiagonalCost (double val)
 
double GetDiagonalCost ()
 
bool FourConnected ()
 
bool EightConnected ()
 
void SetFourConnected ()
 
void SetEightConnected ()
 
- Public Member Functions inherited from SearchEnvironment< xyLoc, tDirection >
virtual ~SearchEnvironment ()
 
virtual void GetSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const=0
 
virtual void GetActions (const xyLoc &nodeID, std::vector< tDirection > &actions) const=0
 
virtual int GetNumSuccessors (const xyLoc &stateID) const
 
virtual tDirection GetAction (const xyLoc &s1, const xyLoc &s2) const
 
virtual void ApplyAction (xyLoc &s, tDirection a) const=0
 
virtual void UndoAction (xyLoc &s, tDirection a) const
 
virtual void GetNextState (const xyLoc &s1, tDirection a, xyLoc &s2) const
 
virtual bool InvertAction (tDirection &a) const=0
 
virtual void StoreGoal (xyLoc &s)
 Stores the goal for use by single-state HCost. More...
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const xyLoc &node1, const xyLoc &node2) const=0
 Heuristic value between two arbitrary nodes. More...
 
virtual double HCost (const xyLoc &node1, const xyLoc &node2, double parentHCost) const
 
virtual double HCost (const xyLoc &node) const
 Heuristic value between node and the stored goal. More...
 
virtual double GCost (const xyLoc &node1, const xyLoc &node2) const=0
 
virtual double GCost (const xyLoc &node, const tDirection &act) const=0
 
virtual bool GoalTest (const xyLoc &node, const xyLoc &goal) const=0
 
virtual bool GoalTest (const xyLoc &node) const
 Goal Test if the goal is stored. More...
 
virtual uint64_t GetMaxHash () const
 
virtual uint64_t GetStateHash (const xyLoc &node) const=0
 
virtual void GetStateFromHash (uint64_t parent, xyLoc &s) const
 
virtual uint64_t GetActionHash (tDirection act) const=0
 
virtual double GetPathLength (std::vector< xyLoc > &neighbors)
 
virtual double GetPathLength (const xyLoc &start, std::vector< tDirection > &neighbors)
 
virtual OccupancyInterface< xyLoc, tDirection > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< xyLoc, tDirection > *)
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const xyLoc &) const
 
virtual void OpenGLDraw (const xyLoc &, const xyLoc &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void OpenGLDraw (const xyLoc &, const tDirection &) const
 
virtual void GLLabelState (const xyLoc &, const char *) const
 
virtual void GLDrawLine (const xyLoc &x, const xyLoc &y) const
 
virtual void GLDrawPath (const std::vector< xyLoc > &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 xyLoc &) const
 
virtual void DrawLine (Graphics::Display &display, const xyLoc &x, const xyLoc &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< xyLoc >
 Heuristic ()
 
virtual ~Heuristic ()
 

Protected Member Functions

void GetBasicSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const
 

Protected Attributes

Mapmap
 
double DIAGONAL_COST
 
bool fourConnected
 
std::vector< bool > grid
 
- Protected Attributes inherited from SearchEnvironment< xyLoc, tDirection >
bool bValidSearchGoal
 
xyLoc searchGoal
 
rgbColor color
 
GLfloat transparency
 

Additional Inherited Members

- Public Attributes inherited from Heuristic< xyLoc >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 

Detailed Description

Definition at line 53 of file CanonicalGrid.h.

Constructor & Destructor Documentation

◆ CanonicalGrid()

CanonicalGrid::CanonicalGrid::CanonicalGrid ( Map m)

Member Function Documentation

◆ ApplyAction()

void CanonicalGrid::CanonicalGrid::ApplyAction ( xyLoc s,
tDirection  dir 
) const

◆ ClearGoal()

void CanonicalGrid::CanonicalGrid::ClearGoal ( )
inlinevirtual

Clears the goal from memory.

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 111 of file CanonicalGrid.h.

◆ Draw() [1/3]

void CanonicalGrid::CanonicalGrid::Draw ( Graphics::Display disp) const
virtual

◆ Draw() [2/3]

void CanonicalGrid::CanonicalGrid::Draw ( Graphics::Display disp,
const xyLoc l 
) const
virtual

◆ Draw() [3/3]

void CanonicalGrid::CanonicalGrid::Draw ( Graphics::Display disp,
const xyLoc l1,
const xyLoc l2,
float  v 
) const
virtual

◆ DrawAlternate()

void CanonicalGrid::CanonicalGrid::DrawAlternate ( Graphics::Display disp,
const xyLoc l 
) const
virtual

◆ DrawArrow()

void CanonicalGrid::CanonicalGrid::DrawArrow ( Graphics::Display disp,
const xyLoc x,
const xyLoc y,
double  width = 1.0 
) const
virtual

◆ DrawBasicOrdering()

void CanonicalGrid::CanonicalGrid::DrawBasicOrdering ( ::Graphics::Display disp,
const xyLoc  l 
) const

◆ DrawLine()

void CanonicalGrid::CanonicalGrid::DrawLine ( Graphics::Display disp,
const xyLoc x,
const xyLoc y,
double  width = 1.0 
) const
virtual

◆ DrawOrdering()

void CanonicalGrid::CanonicalGrid::DrawOrdering ( ::Graphics::Display disp,
const xyLoc  l 
) const

◆ DrawStateLabel() [1/2]

void CanonicalGrid::CanonicalGrid::DrawStateLabel ( Graphics::Display disp,
const xyLoc l1,
const char *  txt 
) const
virtual

◆ DrawStateLabel() [2/2]

void CanonicalGrid::CanonicalGrid::DrawStateLabel ( Graphics::Display disp,
const xyLoc l1,
const xyLoc l2,
float  v,
const char *  txt 
) const
virtual

◆ EightConnected()

bool CanonicalGrid::CanonicalGrid::EightConnected ( )
inline

Definition at line 116 of file CanonicalGrid.h.

◆ FourConnected()

bool CanonicalGrid::CanonicalGrid::FourConnected ( )
inline

Definition at line 115 of file CanonicalGrid.h.

◆ GCost() [1/2]

double CanonicalGrid::CanonicalGrid::GCost ( const xyLoc node1,
const tDirection act 
) const

◆ GCost() [2/2]

double CanonicalGrid::CanonicalGrid::GCost ( const xyLoc node1,
const xyLoc node2 
) const

Definition at line 405 of file CanonicalGrid.cpp.

References CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.

◆ GetAction()

tDirection CanonicalGrid::CanonicalGrid::GetAction ( const xyLoc s1,
const xyLoc s2 
) const

◆ GetActionHash()

uint64_t CanonicalGrid::CanonicalGrid::GetActionHash ( tDirection  act) const

Definition at line 432 of file CanonicalGrid.cpp.

◆ GetActions()

void CanonicalGrid::CanonicalGrid::GetActions ( const xyLoc nodeID,
std::vector< tDirection > &  actions 
) const

◆ GetBasicSuccessors()

void CanonicalGrid::CanonicalGrid::GetBasicSuccessors ( const xyLoc nodeID,
std::vector< xyLoc > &  neighbors 
) const
protected

◆ GetDiagonalCost()

double CanonicalGrid::CanonicalGrid::GetDiagonalCost ( )
inline

Definition at line 114 of file CanonicalGrid.h.

◆ GetFirstJumpPoints()

void CanonicalGrid::CanonicalGrid::GetFirstJumpPoints ( const xyLoc nodeID,
std::vector< xyLoc > &  neighbors 
) const

Definition at line 165 of file CanonicalGrid.cpp.

◆ GetMap()

Map* CanonicalGrid::CanonicalGrid::GetMap ( ) const
inline

Definition at line 86 of file CanonicalGrid.h.

◆ GetMaxHash()

uint64_t CanonicalGrid::CanonicalGrid::GetMaxHash ( ) const

Definition at line 419 of file CanonicalGrid.cpp.

◆ GetNextState()

void CanonicalGrid::CanonicalGrid::GetNextState ( const xyLoc currents,
tDirection  dir,
xyLoc news 
) const

◆ GetStateHash()

uint64_t CanonicalGrid::CanonicalGrid::GetStateHash ( const xyLoc node) const

Definition at line 425 of file CanonicalGrid.cpp.

◆ GetSuccessors()

void CanonicalGrid::CanonicalGrid::GetSuccessors ( const xyLoc nodeID,
std::vector< xyLoc > &  neighbors 
) const

◆ GLDrawLine()

void CanonicalGrid::CanonicalGrid::GLDrawLine ( const xyLoc x,
const xyLoc y 
) const

◆ GLLabelState() [1/2]

void CanonicalGrid::CanonicalGrid::GLLabelState ( const xyLoc s,
const char *  str 
) const

◆ GLLabelState() [2/2]

void CanonicalGrid::CanonicalGrid::GLLabelState ( const xyLoc s,
const char *  str,
double  scale 
) const

◆ GoalTest() [1/2]

bool CanonicalGrid::CanonicalGrid::GoalTest ( const xyLoc ) const
inline

Definition at line 72 of file CanonicalGrid.h.

◆ GoalTest() [2/2]

bool CanonicalGrid::CanonicalGrid::GoalTest ( const xyLoc node,
const xyLoc goal 
) const

Definition at line 414 of file CanonicalGrid.cpp.

References CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.

◆ HCost() [1/2]

double CanonicalGrid::CanonicalGrid::HCost ( const xyLoc ) const
inline

Definition at line 64 of file CanonicalGrid.h.

◆ HCost() [2/2]

double CanonicalGrid::CanonicalGrid::HCost ( const xyLoc node1,
const xyLoc node2 
) const

Definition at line 370 of file CanonicalGrid.cpp.

References CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.

◆ InvertAction()

bool CanonicalGrid::CanonicalGrid::InvertAction ( tDirection a) const

◆ IsGoalStored()

bool CanonicalGrid::CanonicalGrid::IsGoalStored ( ) const
inline

Definition at line 112 of file CanonicalGrid.h.

◆ OpenGLDraw() [1/4]

void CanonicalGrid::CanonicalGrid::OpenGLDraw ( ) const

Definition at line 437 of file CanonicalGrid.cpp.

◆ OpenGLDraw() [2/4]

void CanonicalGrid::CanonicalGrid::OpenGLDraw ( const xyLoc initial,
const tDirection dir 
) const

◆ OpenGLDraw() [3/4]

void CanonicalGrid::CanonicalGrid::OpenGLDraw ( const xyLoc l) const

◆ OpenGLDraw() [4/4]

void CanonicalGrid::CanonicalGrid::OpenGLDraw ( const xyLoc l1,
const xyLoc l2,
float  v 
) const

◆ SetDiagonalCost()

void CanonicalGrid::CanonicalGrid::SetDiagonalCost ( double  val)
inline

Definition at line 113 of file CanonicalGrid.h.

◆ SetEightConnected()

void CanonicalGrid::CanonicalGrid::SetEightConnected ( )
inline

Definition at line 118 of file CanonicalGrid.h.

◆ SetFourConnected()

void CanonicalGrid::CanonicalGrid::SetFourConnected ( )
inline

Definition at line 117 of file CanonicalGrid.h.

◆ StoreGoal()

void CanonicalGrid::CanonicalGrid::StoreGoal ( xyLoc )
inline

Definition at line 110 of file CanonicalGrid.h.

◆ SVGDraw() [1/2]

std::string CanonicalGrid::CanonicalGrid::SVGDraw ( )

◆ SVGDraw() [2/2]

std::string CanonicalGrid::CanonicalGrid::SVGDraw ( const xyLoc l)

◆ SVGDrawLine()

std::string CanonicalGrid::CanonicalGrid::SVGDrawLine ( const xyLoc x,
const xyLoc y,
int  width = 1 
) const

◆ SVGFrameRect()

std::string CanonicalGrid::CanonicalGrid::SVGFrameRect ( int  left,
int  top,
int  right,
int  bottom,
int  width = 1 
)

◆ SVGHeader()

std::string CanonicalGrid::CanonicalGrid::SVGHeader ( )

Definition at line 571 of file CanonicalGrid.cpp.

◆ SVGLabelState()

std::string CanonicalGrid::CanonicalGrid::SVGLabelState ( const xyLoc l,
const char *  str,
double  scale 
) const

Member Data Documentation

◆ DIAGONAL_COST

double CanonicalGrid::CanonicalGrid::DIAGONAL_COST
protected

Definition at line 122 of file CanonicalGrid.h.

◆ fourConnected

bool CanonicalGrid::CanonicalGrid::fourConnected
protected

Definition at line 123 of file CanonicalGrid.h.

◆ grid

std::vector<bool> CanonicalGrid::CanonicalGrid::grid
protected

Definition at line 124 of file CanonicalGrid.h.

◆ map

Map* CanonicalGrid::CanonicalGrid::map
protected

Definition at line 121 of file CanonicalGrid.h.


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