Go to the documentation of this file.
15 return (s1.
s == s2.
s);
20 out << s1.
s <<
"(p: " << s1.
parent <<
")";
46 if (stateID.
parent == stateID.
s)
54 neighbors.push_back({stateID.
parent, n->
getEdge(e)->getTo()});
58 neighbors.push_back({stateID.
parent, n->
getEdge(e)->getFrom()});
67 for (
int x = 0; x < 8; x++)
77 neighbors.push_back({i->first.s, e->
getTo()});
81 neighbors.push_back({i->first.s, e->
getFrom()});
118 uint32_t tmp = a.
from;
148 return state.
s == goal.
s;
170 glBegin(GL_TRIANGLE_FAN);
171 glColor4f(0, 0, 0, 0.01);
172 glVertex3f(-1, -1, 0.01);
173 glVertex3f(1, -1, 0.01);
174 glVertex3f(1, 1, 0.01);
175 glVertex3f(-1, 1, 0.01);
192 glColor4f(r,
g, b, t);
196 glColor3f(1.0, 0.0, 0.0);
207 glVertex3f(x, y, z+off);
214 glVertex3f(x, y, z+off);
222 glColor4f(0.0, 0.0, 0.0, 1.0);
226 sprintf(label,
"%1.2f", e->GetWeight());
240 DrawText(x/2, y/2, z/2-0.003, 0.2, label);
247 glColor4f(0.0, 0.0, 0.0, 1.0);
266 glColor4f(r, gr, b, t);
270 GLdouble x, y, z, rad;
281 glColor4f(0, 0, 0, t);
298 glColor4f(r,
g, b, t);
324 std::vector<graphState> thePath;
347 if (
fgreater(currentBound, 2*maxEdge))
356 for (
int startEdge = 0; startEdge < searchStartNode->
GetNumEdges(); startEdge++)
361 if (e->
getFrom() == searchStart)
373 for (
int z = 0; z < canonicalNode->
GetNumEdges(); z++)
404 for (
int x = 0; x < 8; x++)
void OutlineRect(GLdouble left, GLdouble top, GLdouble right, GLdouble bottom, double zz)
void DrawSquare(GLdouble xx, GLdouble yy, GLdouble zz, GLdouble rad)
unsigned int getFrom() const
uint64_t GetActionHash(graphMove act) const
unsigned int getTo() const
edge * FindEdge(unsigned int from, unsigned int to)
Finds an edge between nodes with ids from and to, no matter which direction.
void SetStopAfterGoal(bool val)
uint64_t GetStateHash(const canGraphState &state) const
bool GetOpenListGCost(const state &val, double &gCost) const
bool InvertAction(graphMove &a) const
double GCost(const canGraphState &state1, const canGraphState &state2) const
std::vector< edge * >::const_iterator edge_iterator
state CheckNextNode()
Returns the next state on the open list (but doesn't pop it off the queue).
unsigned int GetNumOpenItems()
node * GetNode(unsigned long num)
edge * getEdge(unsigned int which)
edge * edgeIterNext(edge_iterator &) const
void GetActions(const canGraphState &stateID, std::vector< graphMove > &actions) const
void ApplyAction(canGraphState &s, graphMove a) const
const state & GetParent(const state &s)
edge_iterator getEdgeIter() const
void DrawTextCentered(double x, double y, double z, double scale, const char *str)
bool operator==(const canGraphState &s1, const canGraphState &s2)
void DrawText(double x, double y, double z, double scale, const char *str)
A templated version of A*, based on HOG genericAStar.
graphMove GetAction(const canGraphState &s1, const canGraphState &s2) const
virtual rgbColor GetColor() const
void GetSuccessors(const canGraphState &stateID, std::vector< canGraphState > &neighbors) const
bool GoalTest(const canGraphState &state, const canGraphState &goal) const
void GLDrawLine(const canGraphState &x, const canGraphState &y) const
bool fgreater(double a, double b)
CanonicalGraphEnvironment(Graph *g)
double GetLabelF(unsigned int index) const
bool InitializeSearch(environment *env, const state &from, const state &to, std::vector< state > &thePath)
Initialize the A* search.
unsigned int GetNum() const
bool GetClosedItem(const state &s, AStarOpenClosedDataWithF< state > &)
double HCost(const canGraphState &state1, const canGraphState &state2) const
Heuristic value between two arbitrary nodes.
std::unordered_map< canGraphState, uint8_t > canonicalOrdering
std::ostream & operator<<(std::ostream &out, const canGraphState &s1)
~CanonicalGraphEnvironment()
uint64_t GetMaxHash() const
edge * findDirectedEdge(unsigned int from, unsigned int to)
bool DoSingleSearchStep(std::vector< state > &thePath)
Expand a single node.
Nodes to be stored within a Graph.
Edge class for connections between node in a Graph.
const char * GetName() const