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

#include <GraphEnvironment.h>

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

Public Member Functions

 GraphEnvironment (Graph *g, GraphHeuristic *gh=0)
 
 GraphEnvironment (Map *m, Graph *g, GraphHeuristic *gh=0)
 
virtual ~GraphEnvironment ()
 
virtual void GetSuccessors (const graphState &stateID, std::vector< graphState > &neighbors) const
 
virtual int GetNumSuccessors (const graphState &stateID) const
 
virtual void GetActions (const graphState &stateID, std::vector< graphMove > &actions) const
 
virtual graphMove GetAction (const graphState &s1, const graphState &s2) const
 
virtual void ApplyAction (graphState &s, graphMove a) const
 
virtual bool InvertAction (graphMove &a) const
 
void SetDirected (bool b)
 
OccupancyInterface< graphState, graphMove > * GetOccupancyInfo ()
 
virtual double HCost (const graphState &state1, const graphState &state2) const
 Heuristic value between two arbitrary nodes. More...
 
virtual double GCost (const graphState &state1, const graphState &state2) const
 
virtual double GCost (const graphState &state1, const graphMove &state2) const
 
virtual bool GoalTest (const graphState &state, const graphState &goal) const
 
virtual uint64_t GetMaxHash () const
 
virtual uint64_t GetStateHash (const graphState &state) const
 
virtual void GetStateFromHash (uint64_t parent, graphState &s) const
 
virtual uint64_t GetActionHash (graphMove act) const
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const graphState &s) const
 
virtual void OpenGLDraw (const graphState &s, const graphMove &gm) const
 
virtual void OpenGLDraw (const graphState &s, const graphState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void GLDrawLine (const graphState &x, const graphState &y) const
 
virtual void GLLabelState (const graphState &, const char *) const
 
std::string SVGHeader () const
 
std::string SVGDraw () const
 
std::string SVGDraw (const graphState &s) const
 
std::string SVGLabelState (const graphState &s, const char *) const
 
virtual void Draw (Graphics::Display &disp) const
 
void DrawLERP (Graphics::Display &disp, Graph *a, Graph *b, float mix) const
 
void DrawLERP (Graphics::Display &disp, Graph *a, Graph *b, float mix, std::function< float(float, float, float)> l1, std::function< float(float, float, float)> l2) const
 
void DrawLERP (Graphics::Display &disp, Graph *a, Graph *b, graphState sa, graphState sb, float mix, std::function< float(float, float, float)> l1, std::function< float(float, float, float)> l2) const
 
virtual void Draw (Graphics::Display &disp, const graphState &l) const
 
virtual void DrawStateLabel (Graphics::Display &disp, const graphState &l1, const char *txt) const
 
virtual void DrawLine (Graphics::Display &disp, const graphState &x, const graphState &y, double width=1.0) const
 
virtual void DrawLine (Graphics::Display &disp, float x1, float y1, float x2, float y2, double width=1.0) const
 
Graphics::point GetLocation (const graphState &s) const
 
GraphGetGraph ()
 
virtual void StoreGoal (graphState &)
 Stores the goal for use by single-state HCost. More...
 
virtual void ClearGoal ()
 Clears the goal from memory. More...
 
virtual bool IsGoalStored () const
 
virtual double HCost (const graphState &) const
 Heuristic value between node and the stored goal. More...
 
virtual bool GoalTest (const graphState &) const
 Goal Test if the goal is stored. More...
 
void SetIntegerEdgeCosts (bool val)
 
void SetDrawEdgeCosts (bool val)
 
void SetDrawNodeLabels (bool val)
 
void SetNodeScale (double v)
 
double GetNodeScale ()
 
- Public Member Functions inherited from SearchEnvironment< graphState, graphMove >
virtual ~SearchEnvironment ()
 
virtual void UndoAction (graphState &s, graphMove a) const
 
virtual void GetNextState (const graphState &s1, graphMove a, graphState &s2) const
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const graphState &node1, const graphState &node2, double parentHCost) const
 
virtual uint64_t GetMaxHash () const
 
virtual double GetPathLength (std::vector< graphState > &neighbors)
 
virtual double GetPathLength (const graphState &start, std::vector< graphMove > &neighbors)
 
virtual void SetOccupancyInfo (OccupancyInterface< graphState, graphMove > *)
 
virtual void OpenGLDraw () const
 
virtual void GLDrawPath (const std::vector< graphState > &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 DrawLine (Graphics::Display &display, const graphState &x, const graphState &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< graphState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Protected Attributes

bool directed
 
Mapm
 
Graphg
 
GraphHeuristich
 
bool drawEdgeCosts
 
bool integerEdgeCosts
 
bool drawNodeLabels
 
double nodeScale
 
- Protected Attributes inherited from SearchEnvironment< graphState, graphMove >
bool bValidSearchGoal
 
graphState searchGoal
 
rgbColor color
 
GLfloat transparency
 

Additional Inherited Members

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

Detailed Description

Definition at line 291 of file GraphEnvironment.h.

Constructor & Destructor Documentation

◆ GraphEnvironment() [1/2]

GraphEnvironment::GraphEnvironment ( Graph g,
GraphHeuristic gh = 0 
)

Definition at line 22 of file GraphEnvironment.cpp.

References directed, drawEdgeCosts, drawNodeLabels, integerEdgeCosts, m, and nodeScale.

◆ GraphEnvironment() [2/2]

GraphEnvironment::GraphEnvironment ( Map m,
Graph g,
GraphHeuristic gh = 0 
)

Definition at line 33 of file GraphEnvironment.cpp.

References directed, drawEdgeCosts, drawNodeLabels, integerEdgeCosts, m, and nodeScale.

◆ ~GraphEnvironment()

GraphEnvironment::~GraphEnvironment ( )
virtual

Definition at line 52 of file GraphEnvironment.cpp.

Member Function Documentation

◆ ApplyAction()

void GraphEnvironment::ApplyAction ( graphState s,
graphMove  a 
) const
virtual

Implements SearchEnvironment< graphState, graphMove >.

Definition at line 141 of file GraphEnvironment.cpp.

References graphMove::from, and graphMove::to.

Referenced by RoadMap::ApplyAction().

◆ ClearGoal()

virtual void GraphEnvironment::ClearGoal ( )
inlinevirtual

Clears the goal from memory.

Reimplemented from SearchEnvironment< graphState, graphMove >.

Reimplemented in AbsGraphEnvironment.

Definition at line 341 of file GraphEnvironment.h.

◆ Draw() [1/2]

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

◆ Draw() [2/2]

void GraphEnvironment::Draw ( Graphics::Display disp,
const graphState l 
) const
virtual

◆ DrawLERP() [1/3]

void GraphEnvironment::DrawLERP ( Graphics::Display disp,
Graph a,
Graph b,
float  mix 
) const

Definition at line 559 of file GraphEnvironment.cpp.

◆ DrawLERP() [2/3]

void GraphEnvironment::DrawLERP ( Graphics::Display disp,
Graph a,
Graph b,
float  mix,
std::function< float(float, float, float)>  l1,
std::function< float(float, float, float)>  l2 
) const

◆ DrawLERP() [3/3]

void GraphEnvironment::DrawLERP ( Graphics::Display disp,
Graph a,
Graph b,
graphState  sa,
graphState  sb,
float  mix,
std::function< float(float, float, float)>  l1,
std::function< float(float, float, float)>  l2 
) const

◆ DrawLine() [1/2]

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

◆ DrawLine() [2/2]

void GraphEnvironment::DrawLine ( Graphics::Display disp,
float  x1,
float  y1,
float  x2,
float  y2,
double  width = 1.0 
) const
virtual

◆ DrawStateLabel()

void GraphEnvironment::DrawStateLabel ( Graphics::Display disp,
const graphState l1,
const char *  txt 
) const
virtual

◆ GCost() [1/2]

double GraphEnvironment::GCost ( const graphState state1,
const graphMove state2 
) const
virtual

◆ GCost() [2/2]

double GraphEnvironment::GCost ( const graphState state1,
const graphState state2 
) const
virtual

◆ GetAction()

graphMove GraphEnvironment::GetAction ( const graphState s1,
const graphState s2 
) const
virtual

Reimplemented from SearchEnvironment< graphState, graphMove >.

Definition at line 136 of file GraphEnvironment.cpp.

Referenced by RoadMap::GetAction().

◆ GetActionHash()

uint64_t GraphEnvironment::GetActionHash ( graphMove  act) const
virtual

◆ GetActions()

void GraphEnvironment::GetActions ( const graphState stateID,
std::vector< graphMove > &  actions 
) const
virtual

◆ GetGraph()

Graph* GraphEnvironment::GetGraph ( )
inline

Definition at line 338 of file GraphEnvironment.h.

References g.

◆ GetLocation()

Graphics::point GraphEnvironment::GetLocation ( const graphState s) const

◆ GetMaxHash()

virtual uint64_t GraphEnvironment::GetMaxHash ( ) const
inlinevirtual

Definition at line 310 of file GraphEnvironment.h.

References g, and Graph::GetNumNodes().

◆ GetNodeScale()

double GraphEnvironment::GetNodeScale ( )
inline

Definition at line 356 of file GraphEnvironment.h.

References nodeScale.

◆ GetNumSuccessors()

int GraphEnvironment::GetNumSuccessors ( const graphState stateID) const
virtual

◆ GetOccupancyInfo()

OccupancyInterface<graphState, graphMove>* GraphEnvironment::GetOccupancyInfo ( )
inlinevirtual

Reimplemented from SearchEnvironment< graphState, graphMove >.

Reimplemented in AbsGraphEnvironment.

Definition at line 305 of file GraphEnvironment.h.

◆ GetStateFromHash()

void GraphEnvironment::GetStateFromHash ( uint64_t  parent,
graphState s 
) const
virtual

Reimplemented from SearchEnvironment< graphState, graphMove >.

Definition at line 192 of file GraphEnvironment.cpp.

◆ GetStateHash()

uint64_t GraphEnvironment::GetStateHash ( const graphState state) const
virtual

Implements SearchEnvironment< graphState, graphMove >.

Reimplemented in TopSpinGraph.

Definition at line 187 of file GraphEnvironment.cpp.

References g, Graph::GetNode(), and node::getUniqueID().

◆ GetSuccessors()

void GraphEnvironment::GetSuccessors ( const graphState stateID,
std::vector< graphState > &  neighbors 
) const
virtual

◆ GLDrawLine()

void GraphEnvironment::GLDrawLine ( const graphState x,
const graphState y 
) const
virtual

◆ GLLabelState()

void GraphEnvironment::GLLabelState ( const graphState s,
const char *  txt 
) const
virtual

◆ GoalTest() [1/2]

virtual bool GraphEnvironment::GoalTest ( const graphState node) const
inlinevirtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< graphState, graphMove >.

Reimplemented in GraphRefinementEnvironment.

Definition at line 348 of file GraphEnvironment.h.

◆ GoalTest() [2/2]

bool GraphEnvironment::GoalTest ( const graphState state,
const graphState goal 
) const
virtual

◆ HCost() [1/2]

virtual double GraphEnvironment::HCost ( const graphState node) const
inlinevirtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< graphState, graphMove >.

Reimplemented in AbsGraphEnvironment, and GraphRefinementEnvironment.

Definition at line 344 of file GraphEnvironment.h.

◆ HCost() [2/2]

double GraphEnvironment::HCost ( const graphState node1,
const graphState node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< graphState, graphMove >.

Reimplemented in AbsGraphEnvironment, and GraphRefinementEnvironment.

Definition at line 157 of file GraphEnvironment.cpp.

References h, and GraphHeuristic::HCost().

Referenced by MyPathfindingKeyHandler().

◆ InvertAction()

bool GraphEnvironment::InvertAction ( graphMove a) const
virtual

◆ IsGoalStored()

virtual bool GraphEnvironment::IsGoalStored ( ) const
inlinevirtual

Reimplemented in AbsGraphEnvironment.

Definition at line 342 of file GraphEnvironment.h.

◆ OpenGLDraw() [1/4]

void GraphEnvironment::OpenGLDraw ( ) const
virtual

◆ OpenGLDraw() [2/4]

void GraphEnvironment::OpenGLDraw ( const graphState s) const
virtual

◆ OpenGLDraw() [3/4]

void GraphEnvironment::OpenGLDraw ( const graphState s,
const graphMove gm 
) const
virtual

Reimplemented from SearchEnvironment< graphState, graphMove >.

Definition at line 414 of file GraphEnvironment.cpp.

◆ OpenGLDraw() [4/4]

virtual void GraphEnvironment::OpenGLDraw ( const graphState ,
const graphState ,
float   
) const
inlinevirtual

Draw the transition at some percentage 0...1 between two states.

Reimplemented from SearchEnvironment< graphState, graphMove >.

Definition at line 317 of file GraphEnvironment.h.

References OpenGLDraw().

Referenced by OpenGLDraw().

◆ SetDirected()

void GraphEnvironment::SetDirected ( bool  b)
inline

◆ SetDrawEdgeCosts()

void GraphEnvironment::SetDrawEdgeCosts ( bool  val)
inline

Definition at line 353 of file GraphEnvironment.h.

References drawEdgeCosts.

◆ SetDrawNodeLabels()

void GraphEnvironment::SetDrawNodeLabels ( bool  val)
inline

Definition at line 354 of file GraphEnvironment.h.

References drawNodeLabels.

◆ SetIntegerEdgeCosts()

void GraphEnvironment::SetIntegerEdgeCosts ( bool  val)
inline

Definition at line 352 of file GraphEnvironment.h.

References integerEdgeCosts.

◆ SetNodeScale()

void GraphEnvironment::SetNodeScale ( double  v)
inline

Definition at line 355 of file GraphEnvironment.h.

References nodeScale.

◆ StoreGoal()

virtual void GraphEnvironment::StoreGoal ( graphState s)
inlinevirtual

Stores the goal for use by single-state HCost.

Reimplemented from SearchEnvironment< graphState, graphMove >.

Reimplemented in AbsGraphEnvironment.

Definition at line 340 of file GraphEnvironment.h.

◆ SVGDraw() [1/2]

std::string GraphEnvironment::SVGDraw ( ) const

◆ SVGDraw() [2/2]

std::string GraphEnvironment::SVGDraw ( const graphState s) const

◆ SVGHeader()

std::string GraphEnvironment::SVGHeader ( ) const

Definition at line 447 of file GraphEnvironment.cpp.

◆ SVGLabelState()

std::string GraphEnvironment::SVGLabelState ( const graphState s,
const char *  str 
) const

Member Data Documentation

◆ directed

bool GraphEnvironment::directed
protected

◆ drawEdgeCosts

bool GraphEnvironment::drawEdgeCosts
protected

Definition at line 362 of file GraphEnvironment.h.

Referenced by Draw(), GraphEnvironment(), OpenGLDraw(), and SetDrawEdgeCosts().

◆ drawNodeLabels

bool GraphEnvironment::drawNodeLabels
protected

Definition at line 364 of file GraphEnvironment.h.

Referenced by Draw(), GraphEnvironment(), OpenGLDraw(), and SetDrawNodeLabels().

◆ g

Graph* GraphEnvironment::g
protected

◆ h

GraphHeuristic* GraphEnvironment::h
protected

Definition at line 361 of file GraphEnvironment.h.

Referenced by GraphRefinementEnvironment::HCost(), and HCost().

◆ integerEdgeCosts

bool GraphEnvironment::integerEdgeCosts
protected

Definition at line 363 of file GraphEnvironment.h.

Referenced by Draw(), GraphEnvironment(), OpenGLDraw(), and SetIntegerEdgeCosts().

◆ m

Map* GraphEnvironment::m
protected

Definition at line 359 of file GraphEnvironment.h.

Referenced by GraphEnvironment(), and OpenGLDraw().

◆ nodeScale

double GraphEnvironment::nodeScale
protected

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