HOG2
|
#include <GraphEnvironment.h>
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 |
Graph * | GetGraph () |
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 |
Map * | m |
Graph * | g |
GraphHeuristic * | h |
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< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Definition at line 291 of file GraphEnvironment.h.
GraphEnvironment::GraphEnvironment | ( | Graph * | g, |
GraphHeuristic * | gh = 0 |
||
) |
Definition at line 22 of file GraphEnvironment.cpp.
References directed, drawEdgeCosts, drawNodeLabels, integerEdgeCosts, m, and nodeScale.
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.
|
virtual |
Definition at line 52 of file GraphEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Definition at line 141 of file GraphEnvironment.cpp.
References graphMove::from, and graphMove::to.
Referenced by RoadMap::ApplyAction().
|
inlinevirtual |
Clears the goal from memory.
Reimplemented from SearchEnvironment< graphState, graphMove >.
Reimplemented in AbsGraphEnvironment.
Definition at line 341 of file GraphEnvironment.h.
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 643 of file GraphEnvironment.cpp.
References Colors::black, directed, drawEdgeCosts, DrawLine(), drawNodeLabels, Graphics::Display::DrawText(), Graph::edgeIterNext(), g, SearchEnvironment< graphState, graphMove >::GetColor(), Graph::getEdgeIter(), node::GetLabelF(), node::GetName(), Graph::GetNode(), Graph::GetNumNodes(), integerEdgeCosts, GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, GraphSearchConstants::kZCoordinate, max, nodeScale, Graphics::textAlignCenter, and Graphics::textBaselineMiddle.
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 741 of file GraphEnvironment.cpp.
References Colors::black, Graphics::Display::FillCircle(), Graphics::Display::FrameCircle(), g, SearchEnvironment< graphState, graphMove >::GetColor(), node::GetLabelF(), Graph::GetNode(), Graph::GetNumNodes(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, GraphSearchConstants::kZCoordinate, Graphics::rect::left, max, and nodeScale.
void GraphEnvironment::DrawLERP | ( | Graphics::Display & | disp, |
Graph * | a, | ||
Graph * | b, | ||
float | mix | ||
) | const |
Definition at line 559 of file GraphEnvironment.cpp.
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 |
Definition at line 566 of file GraphEnvironment.cpp.
References Graphics::Display::DrawLine(), Graph::edgeIterNext(), SearchEnvironment< graphState, graphMove >::GetColor(), Graph::getEdgeIter(), node::GetLabelF(), Graph::GetNode(), Graph::GetNumNodes(), GraphSearchConstants::kXCoordinate, and GraphSearchConstants::kYCoordinate.
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 |
Definition at line 610 of file GraphEnvironment.cpp.
References Graph::edgeIterNext(), Graphics::Display::FillCircle(), SearchEnvironment< graphState, graphMove >::GetColor(), Graph::getEdgeIter(), node::GetLabelF(), Graph::GetNode(), Graph::GetNumNodes(), GraphSearchConstants::kXCoordinate, and GraphSearchConstants::kYCoordinate.
|
virtual |
Definition at line 797 of file GraphEnvironment.cpp.
References g, node::GetLabelF(), Graph::GetNode(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, and width.
Referenced by Draw().
|
virtual |
Definition at line 816 of file GraphEnvironment.cpp.
References SearchEnvironment< state, action >::color, directed, Graphics::Display::DrawArrow(), Graphics::Display::DrawLine(), g, Graph::GetNumNodes(), max, nodeScale, and width.
|
virtual |
Definition at line 780 of file GraphEnvironment.cpp.
References Graphics::Display::DrawText(), g, SearchEnvironment< graphState, graphMove >::GetColor(), node::GetLabelF(), Graph::GetNode(), Graph::GetNumNodes(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, GraphSearchConstants::kZCoordinate, max, nodeScale, ONE_OVER_ROOT_TWO, Graphics::textAlignLeft, and Graphics::textBaselineBottom.
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Definition at line 166 of file GraphEnvironment.cpp.
References Graph::FindEdge(), graphMove::from, g, edge::GetWeight(), and graphMove::to.
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Definition at line 173 of file GraphEnvironment.cpp.
References Graph::FindEdge(), g, and edge::GetWeight().
Referenced by MeroB::DoSingleStepA(), MeroB::DoSingleStepB(), MeroB::DoSingleStepBP(), and RoadMap::GCost().
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 136 of file GraphEnvironment.cpp.
Referenced by RoadMap::GetAction().
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Definition at line 198 of file GraphEnvironment.cpp.
References graphMove::from, g, Graph::GetNode(), node::getUniqueID(), and graphMove::to.
Referenced by RoadMap::GetActionHash().
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Reimplemented in TopSpinGraph, and GraphRefinementEnvironment.
Definition at line 105 of file GraphEnvironment.cpp.
References directed, node::edgeIterNext(), node::edgeIterNextOutgoing(), g, node::getEdgeIter(), Graph::GetNode(), and node::getOutgoingEdgeIter().
Referenced by RoadMap::GetActions(), GraphRefinementEnvironment::GetActions(), and TopSpinGraph::GetActions().
|
inline |
Definition at line 338 of file GraphEnvironment.h.
References g.
Graphics::point GraphEnvironment::GetLocation | ( | const graphState & | s | ) | const |
Definition at line 826 of file GraphEnvironment.cpp.
References g, node::GetLabelF(), Graph::GetNode(), GraphSearchConstants::kXCoordinate, and GraphSearchConstants::kYCoordinate.
|
inlinevirtual |
Definition at line 310 of file GraphEnvironment.h.
References g, and Graph::GetNumNodes().
|
inline |
Definition at line 356 of file GraphEnvironment.h.
References nodeScale.
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 59 of file GraphEnvironment.cpp.
References directed, g, Graph::GetNode(), node::GetNumEdges(), and node::getNumOutgoingEdges().
|
inlinevirtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Reimplemented in AbsGraphEnvironment.
Definition at line 305 of file GraphEnvironment.h.
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 192 of file GraphEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Reimplemented in TopSpinGraph.
Definition at line 187 of file GraphEnvironment.cpp.
References g, Graph::GetNode(), and node::getUniqueID().
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Reimplemented in TopSpinGraph, and GraphRefinementEnvironment.
Definition at line 75 of file GraphEnvironment.cpp.
References directed, node::edgeIterNext(), node::edgeIterNextOutgoing(), g, node::getEdgeIter(), Graph::GetNode(), and node::getOutgoingEdgeIter().
Referenced by MeroB::DoSingleStepA(), MeroB::DoSingleStepB(), MeroB::DoSingleStepBP(), AbstractWeightedSearchAlgorithm< state, action, environment >::GetPath(), RoadMap::GetSuccessors(), GraphRefinementEnvironment::GetSuccessors(), and TopSpinGraph::GetSuccessors().
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 419 of file GraphEnvironment.cpp.
References g, SearchEnvironment< graphState, graphMove >::GetColor(), node::GetLabelF(), Graph::GetNode(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, and GraphSearchConstants::kZCoordinate.
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 398 of file GraphEnvironment.cpp.
References DrawText(), g, node::GetLabelF(), Graph::GetNode(), Graph::GetNumNodes(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, GraphSearchConstants::kZCoordinate, and nodeScale.
|
inlinevirtual |
Goal Test if the goal is stored.
Reimplemented from SearchEnvironment< graphState, graphMove >.
Reimplemented in GraphRefinementEnvironment.
Definition at line 348 of file GraphEnvironment.h.
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Reimplemented in TopSpinGraph, and GraphRefinementEnvironment.
Definition at line 182 of file GraphEnvironment.cpp.
Referenced by MeroB::DoSingleStepA(), MeroB::DoSingleStepB(), and MeroB::DoSingleStepBP().
|
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.
|
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().
|
virtual |
Implements SearchEnvironment< graphState, graphMove >.
Definition at line 147 of file GraphEnvironment.cpp.
References Graph::findDirectedEdge(), graphMove::from, g, and graphMove::to.
Referenced by RoadMap::InvertAction().
|
inlinevirtual |
Reimplemented in AbsGraphEnvironment.
Definition at line 342 of file GraphEnvironment.h.
|
virtual |
Definition at line 206 of file GraphEnvironment.cpp.
References drawEdgeCosts, drawNodeLabels, DrawText(), DrawTextCentered(), Graph::edgeIterNext(), g, SearchEnvironment< graphState, graphMove >::GetColor(), Graph::getEdgeIter(), node::GetLabelF(), node::GetName(), Graph::GetNode(), Graph::GetNumNodes(), integerEdgeCosts, GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, GraphSearchConstants::kZCoordinate, m, and Map::OpenGLDraw().
Referenced by RoadMap::OpenGLDraw(), and GraphMapInconsistentHeuristic::OpenGLDraw().
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 313 of file GraphEnvironment.cpp.
References Colors::blue, drawNodeLabels, DrawSquare(), node::edgeIterNext(), g, SearchEnvironment< graphState, graphMove >::GetColor(), node::getEdgeIter(), node::GetLabelF(), node::GetLabelL(), Graph::GetNode(), Graph::GetNumNodes(), Map::GetOpenGLCoord(), GraphSearchConstants::kMapX, GraphSearchConstants::kMapY, GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, GraphSearchConstants::kZCoordinate, m, nodeScale, OutlineRect(), and Colors::red.
|
virtual |
Reimplemented from SearchEnvironment< graphState, graphMove >.
Definition at line 414 of file GraphEnvironment.cpp.
|
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().
|
inline |
Definition at line 303 of file GraphEnvironment.h.
References directed.
Referenced by AbsGraphEnvironment::AbsGraphEnvironment(), AbstractWeightedSearchAlgorithm< state, action, environment >::GetPath(), MyPathfindingKeyHandler(), and RoadMap::RoadMap().
|
inline |
Definition at line 353 of file GraphEnvironment.h.
References drawEdgeCosts.
|
inline |
Definition at line 354 of file GraphEnvironment.h.
References drawNodeLabels.
|
inline |
Definition at line 352 of file GraphEnvironment.h.
References integerEdgeCosts.
|
inline |
Definition at line 355 of file GraphEnvironment.h.
References nodeScale.
|
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.
std::string GraphEnvironment::SVGDraw | ( | ) | const |
Definition at line 484 of file GraphEnvironment.cpp.
References rgbColor::b, Graph::edgeIterNext(), rgbColor::g, g, SearchEnvironment< graphState, graphMove >::GetColor(), Graph::getEdgeIter(), node::GetLabelF(), Graph::GetNode(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, max, min(), and rgbColor::r.
std::string GraphEnvironment::SVGDraw | ( | const graphState & | s | ) | const |
Definition at line 471 of file GraphEnvironment.cpp.
References Colors::black, g, SearchEnvironment< graphState, graphMove >::GetColor(), node::GetLabelF(), Graph::GetNode(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, and SVGDrawCircle().
std::string GraphEnvironment::SVGHeader | ( | ) | const |
Definition at line 447 of file GraphEnvironment.cpp.
std::string GraphEnvironment::SVGLabelState | ( | const graphState & | s, |
const char * | str | ||
) | const |
Definition at line 458 of file GraphEnvironment.cpp.
References Colors::blue, g, node::GetLabelF(), Graph::GetNode(), GraphSearchConstants::kXCoordinate, GraphSearchConstants::kYCoordinate, and SVGDrawText().
|
protected |
Definition at line 358 of file GraphEnvironment.h.
Referenced by Draw(), DrawLine(), GetActions(), GetNumSuccessors(), GetSuccessors(), GraphEnvironment(), SetDirected(), and TopSpinGraph::TopSpinGraph().
|
protected |
Definition at line 362 of file GraphEnvironment.h.
Referenced by Draw(), GraphEnvironment(), OpenGLDraw(), and SetDrawEdgeCosts().
|
protected |
Definition at line 364 of file GraphEnvironment.h.
Referenced by Draw(), GraphEnvironment(), OpenGLDraw(), and SetDrawNodeLabels().
|
protected |
Definition at line 360 of file GraphEnvironment.h.
Referenced by Draw(), DrawLine(), DrawStateLabel(), TopSpinGraph::ExpandNode(), GCost(), GetActionHash(), GetActions(), GetGraph(), GetLocation(), GetMaxHash(), GetNumSuccessors(), TopSpinGraph::GetState(), GetStateHash(), GraphRefinementEnvironment::GetSuccessors(), GetSuccessors(), GLDrawLine(), GLLabelState(), GraphRefinementEnvironment::GoalTest(), InvertAction(), OpenGLDraw(), SVGDraw(), and SVGLabelState().
|
protected |
Definition at line 361 of file GraphEnvironment.h.
Referenced by GraphRefinementEnvironment::HCost(), and HCost().
|
protected |
Definition at line 363 of file GraphEnvironment.h.
Referenced by Draw(), GraphEnvironment(), OpenGLDraw(), and SetIntegerEdgeCosts().
|
protected |
Definition at line 359 of file GraphEnvironment.h.
Referenced by GraphEnvironment(), and OpenGLDraw().
|
protected |
Definition at line 365 of file GraphEnvironment.h.
Referenced by Draw(), DrawLine(), DrawStateLabel(), GetNodeScale(), GLLabelState(), GraphEnvironment(), OpenGLDraw(), and SetNodeScale().