HOG2
|
#include <CanonicalGraphEnvironment.h>
Public Member Functions | |
CanonicalGraphEnvironment (Graph *g) | |
~CanonicalGraphEnvironment () | |
void | GetSuccessors (const canGraphState &stateID, std::vector< canGraphState > &neighbors) const |
void | GetActions (const canGraphState &stateID, std::vector< graphMove > &actions) const |
graphMove | GetAction (const canGraphState &s1, const canGraphState &s2) const |
void | ApplyAction (canGraphState &s, graphMove a) const |
bool | InvertAction (graphMove &a) const |
void | SetDirected (bool b) |
double | HCost (const canGraphState &state1, const canGraphState &state2) const |
Heuristic value between two arbitrary nodes. More... | |
double | GCost (const canGraphState &state1, const canGraphState &state2) const |
double | GCost (const canGraphState &state1, const graphMove &state2) const |
bool | GoalTest (const canGraphState &state, const canGraphState &goal) const |
uint64_t | GetMaxHash () const |
uint64_t | GetStateHash (const canGraphState &state) const |
uint64_t | GetActionHash (graphMove act) const |
void | OpenGLDraw () const |
void | OpenGLDraw (const canGraphState &s) const |
void | OpenGLDraw (const canGraphState &s, const graphMove &gm) const |
void | OpenGLDraw (const canGraphState &s, const canGraphState &, float) const |
Draw the transition at some percentage 0...1 between two states. More... | |
void | GLDrawLine (const canGraphState &x, const canGraphState &y) const |
Graph * | GetGraph () |
void | StoreGoal (canGraphState &) |
Stores the goal for use by single-state HCost. More... | |
void | ClearGoal () |
Clears the goal from memory. More... | |
bool | IsGoalStored () const |
double | HCost (const canGraphState &) const |
Heuristic value between node and the stored goal. More... | |
bool | GoalTest (const canGraphState &) const |
Goal Test if the goal is stored. More... | |
void | SetDrawEdgeCosts (bool val) |
void | SetDrawNodeLabels (bool val) |
void | SetNodeScale (double v) |
void | ComputeOrdering () |
Public Member Functions inherited from SearchEnvironment< canGraphState, graphMove > | |
virtual | ~SearchEnvironment () |
virtual int | GetNumSuccessors (const canGraphState &stateID) const |
virtual void | UndoAction (canGraphState &s, graphMove a) const |
virtual void | GetNextState (const canGraphState &s1, graphMove a, canGraphState &s2) const |
virtual bool | IsGoalStored () const |
Returns true if the goal is stored and false otherwise. More... | |
virtual double | HCost (const canGraphState &node1, const canGraphState &node2, double parentHCost) const |
virtual uint64_t | GetMaxHash () const |
virtual void | GetStateFromHash (uint64_t parent, canGraphState &s) const |
virtual double | GetPathLength (std::vector< canGraphState > &neighbors) |
virtual double | GetPathLength (const canGraphState &start, std::vector< graphMove > &neighbors) |
virtual OccupancyInterface< canGraphState, graphMove > * | GetOccupancyInfo () |
virtual void | SetOccupancyInfo (OccupancyInterface< canGraphState, graphMove > *) |
virtual void | OpenGLDraw () const |
virtual void | GLLabelState (const canGraphState &, const char *) const |
virtual void | GLDrawPath (const std::vector< canGraphState > &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 |
virtual void | Draw (Graphics::Display &display, const canGraphState &) const |
virtual void | DrawLine (Graphics::Display &display, const canGraphState &x, const canGraphState &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< canGraphState > | |
Heuristic () | |
virtual | ~Heuristic () |
Protected Attributes | |
std::unordered_map< canGraphState, uint8_t > | canonicalOrdering |
bool | directed |
Graph * | g |
bool | drawEdgeCosts |
bool | drawNodeLabels |
double | nodeScale |
Protected Attributes inherited from SearchEnvironment< canGraphState, graphMove > | |
bool | bValidSearchGoal |
canGraphState | searchGoal |
rgbColor | color |
GLfloat | transparency |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< canGraphState > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Definition at line 45 of file CanonicalGraphEnvironment.h.
CanonicalGraphEnvironment::CanonicalGraphEnvironment | ( | Graph * | g | ) |
Definition at line 26 of file CanonicalGraphEnvironment.cpp.
References ComputeOrdering(), directed, drawEdgeCosts, drawNodeLabels, and nodeScale.
CanonicalGraphEnvironment::~CanonicalGraphEnvironment | ( | ) |
Definition at line 36 of file CanonicalGraphEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 110 of file CanonicalGraphEnvironment.cpp.
|
inlinevirtual |
Clears the goal from memory.
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 74 of file CanonicalGraphEnvironment.h.
void CanonicalGraphEnvironment::ComputeOrdering | ( | ) |
Definition at line 320 of file CanonicalGraphEnvironment.cpp.
References canonicalOrdering, TemplateAStar< state, action, environment, openList >::CheckNextNode(), TemplateAStar< state, action, environment, openList >::DoSingleSearchStep(), Graph::edgeIterNext(), fgreater(), g, TemplateAStar< state, action, environment, openList >::GetClosedItem(), node::getEdge(), Graph::getEdgeIter(), edge::getFrom(), node::GetName(), Graph::GetNode(), node::GetNum(), Graph::GetNumEdges(), node::GetNumEdges(), Graph::GetNumNodes(), TemplateAStar< state, action, environment, openList >::GetNumOpenItems(), TemplateAStar< state, action, environment, openList >::GetOpenListGCost(), TemplateAStar< state, action, environment, openList >::GetParent(), edge::getTo(), edge::GetWeight(), TemplateAStar< state, action, environment, openList >::InitializeSearch(), and TemplateAStar< state, action, environment, openList >::SetStopAfterGoal().
Referenced by CanonicalGraphEnvironment().
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 132 of file CanonicalGraphEnvironment.cpp.
References Graph::FindEdge(), g, edge::GetWeight(), and canGraphState::s.
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 139 of file CanonicalGraphEnvironment.cpp.
References Graph::FindEdge(), graphMove::from, g, edge::GetWeight(), and graphMove::to.
|
virtual |
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 104 of file CanonicalGraphEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 161 of file CanonicalGraphEnvironment.cpp.
References graphMove::from, g, Graph::GetNode(), node::getUniqueID(), and graphMove::to.
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 99 of file CanonicalGraphEnvironment.cpp.
|
inline |
Definition at line 71 of file CanonicalGraphEnvironment.h.
References g.
uint64_t CanonicalGraphEnvironment::GetMaxHash | ( | ) | const |
Definition at line 151 of file CanonicalGraphEnvironment.cpp.
References g, and Graph::GetNumNodes().
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 156 of file CanonicalGraphEnvironment.cpp.
References g, Graph::GetNode(), node::GetNum(), and canGraphState::s.
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 41 of file CanonicalGraphEnvironment.cpp.
References canonicalOrdering, g, node::getEdge(), edge::getFrom(), Graph::GetNode(), node::GetNum(), node::GetNumEdges(), edge::getTo(), canGraphState::parent, and canGraphState::s.
|
virtual |
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 291 of file CanonicalGraphEnvironment.cpp.
References g, SearchEnvironment< canGraphState, graphMove >::GetColor(), node::GetLabelF(), Graph::GetNode(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, GraphSearchConstants::kZCoordinate, and canGraphState::s.
|
inlinevirtual |
Goal Test if the goal is stored.
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 81 of file CanonicalGraphEnvironment.h.
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 146 of file CanonicalGraphEnvironment.cpp.
References canGraphState::s.
|
inlinevirtual |
Heuristic value between node and the stored goal.
Asserts that the goal is stored
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 77 of file CanonicalGraphEnvironment.h.
|
virtual |
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 127 of file CanonicalGraphEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< canGraphState, graphMove >.
Definition at line 116 of file CanonicalGraphEnvironment.cpp.
References Graph::findDirectedEdge(), graphMove::from, g, and graphMove::to.
|
inline |
Definition at line 75 of file CanonicalGraphEnvironment.h.
void CanonicalGraphEnvironment::OpenGLDraw | ( | ) | const |
Definition at line 167 of file CanonicalGraphEnvironment.cpp.
References drawEdgeCosts, drawNodeLabels, DrawText(), DrawTextCentered(), Graph::edgeIterNext(), g, SearchEnvironment< canGraphState, graphMove >::GetColor(), Graph::getEdgeIter(), node::GetLabelF(), node::GetName(), Graph::GetNode(), Graph::GetNumNodes(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, and GraphSearchConstants::kZCoordinate.
|
virtual |
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 260 of file CanonicalGraphEnvironment.cpp.
References DrawSquare(), g, SearchEnvironment< canGraphState, graphMove >::GetColor(), node::GetLabelF(), Graph::GetNode(), Graph::GetNumNodes(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, GraphSearchConstants::kZCoordinate, nodeScale, OutlineRect(), and canGraphState::s.
|
inlinevirtual |
Draw the transition at some percentage 0...1 between two states.
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 68 of file CanonicalGraphEnvironment.h.
References OpenGLDraw().
Referenced by OpenGLDraw().
|
virtual |
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 286 of file CanonicalGraphEnvironment.cpp.
|
inline |
Definition at line 56 of file CanonicalGraphEnvironment.h.
References directed.
|
inline |
Definition at line 85 of file CanonicalGraphEnvironment.h.
References drawEdgeCosts.
|
inline |
Definition at line 86 of file CanonicalGraphEnvironment.h.
References drawNodeLabels.
|
inline |
Definition at line 87 of file CanonicalGraphEnvironment.h.
References nodeScale.
|
inlinevirtual |
Stores the goal for use by single-state HCost.
Reimplemented from SearchEnvironment< canGraphState, graphMove >.
Definition at line 73 of file CanonicalGraphEnvironment.h.
|
protected |
Definition at line 90 of file CanonicalGraphEnvironment.h.
Referenced by ComputeOrdering(), and GetSuccessors().
|
protected |
Definition at line 91 of file CanonicalGraphEnvironment.h.
Referenced by CanonicalGraphEnvironment(), and SetDirected().
|
protected |
Definition at line 93 of file CanonicalGraphEnvironment.h.
Referenced by CanonicalGraphEnvironment(), OpenGLDraw(), and SetDrawEdgeCosts().
|
protected |
Definition at line 94 of file CanonicalGraphEnvironment.h.
Referenced by CanonicalGraphEnvironment(), OpenGLDraw(), and SetDrawNodeLabels().
|
protected |
Definition at line 92 of file CanonicalGraphEnvironment.h.
Referenced by ComputeOrdering(), GCost(), GetActionHash(), GetGraph(), GetMaxHash(), GetStateHash(), GetSuccessors(), GLDrawLine(), InvertAction(), and OpenGLDraw().
|
protected |
Definition at line 95 of file CanonicalGraphEnvironment.h.
Referenced by CanonicalGraphEnvironment(), OpenGLDraw(), and SetNodeScale().