HOG2
|
#include <TopSpinGraph.h>
Public Member Functions | |
TopSpinGraph (int m, int k, TopSpinGraphHeuristic *tsh) | |
TopSpinGraph (int m, int k) | |
~TopSpinGraph () | |
void | GetSuccessors (const graphState &stateID, std::vector< graphState > &neighbors) const |
void | GetActions (const graphState &stateID, std::vector< graphMove > &actions) const |
bool | GoalTest (const graphState &state, const graphState &goal) const |
virtual bool | GoalTest (graphState &) const |
graphState | Dual (graphState s) |
graphState | GetState (const std::vector< int > &configuration) const |
graphState | GetState (const std::vector< int > &configuration, int zeroLoc) const |
std::vector< int > & | GetState (graphState g) const |
uint64_t | GetStateHash (const graphState &state) const |
uint64_t | GetStateHash (const std::vector< int > &config) const |
uint64_t | GetStateHash (const int *config, int config_size) const |
uint64_t | GetPDBHash (const std::vector< int > &config, int pdb_size) const |
uint64_t | GetPDBHash (const graphState &state, int pdb_size) const |
uint64_t | GetPDBSize (int puzzle_size, int pdb_size) const |
Public Member Functions inherited from GraphEnvironment | |
GraphEnvironment (Graph *g, GraphHeuristic *gh=0) | |
GraphEnvironment (Map *m, Graph *g, GraphHeuristic *gh=0) | |
virtual | ~GraphEnvironment () |
virtual int | GetNumSuccessors (const graphState &stateID) 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 uint64_t | GetMaxHash () 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 () |
Private Types | |
typedef std::unordered_map< uint64_t, unsigned long, Hash64 > | TopSpinHashTable |
Private Member Functions | |
void | ExpandNode (const graphState &stateID) const |
void | Flip (std::vector< int > &arrangement, int index, int radius) const |
Private Attributes | |
Graph * | g2 |
TopSpinHashTable | hashTable |
std::vector< TopSpinGraphData > | data |
int | length |
int | flipSize |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< graphState > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Protected Attributes inherited from GraphEnvironment | |
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 |
Definition at line 43 of file TopSpinGraph.h.
|
private |
Definition at line 65 of file TopSpinGraph.h.
TopSpinGraph::TopSpinGraph | ( | int | m, |
int | k, | ||
TopSpinGraphHeuristic * | tsh | ||
) |
Definition at line 15 of file TopSpinGraph.cpp.
References GraphEnvironment::directed, flipSize, GetState(), and length.
TopSpinGraph::TopSpinGraph | ( | int | m, |
int | k | ||
) |
Definition at line 28 of file TopSpinGraph.cpp.
References GraphEnvironment::directed, flipSize, GetState(), and length.
TopSpinGraph::~TopSpinGraph | ( | ) |
Definition at line 41 of file TopSpinGraph.cpp.
graphState TopSpinGraph::Dual | ( | graphState | s | ) |
Definition at line 149 of file TopSpinGraph.cpp.
References data, and GetState().
Referenced by TopSpinGraphHeuristic::HCost().
|
private |
Definition at line 113 of file TopSpinGraph.cpp.
References Graph::AddEdge(), data, Graph::FindEdge(), Flip(), flipSize, GraphEnvironment::g, g2, GetState(), and length.
Referenced by GetActions(), and GetSuccessors().
|
private |
Definition at line 129 of file TopSpinGraph.cpp.
Referenced by ExpandNode().
|
virtual |
Reimplemented from GraphEnvironment.
Definition at line 55 of file TopSpinGraph.cpp.
References data, ExpandNode(), and GraphEnvironment::GetActions().
uint64_t TopSpinGraph::GetPDBHash | ( | const graphState & | state, |
int | pdb_size | ||
) | const |
Definition at line 201 of file TopSpinGraph.cpp.
References GetPDBHash(), and GetState().
uint64_t TopSpinGraph::GetPDBHash | ( | const std::vector< int > & | config, |
int | pdb_size | ||
) | const |
Definition at line 206 of file TopSpinGraph.cpp.
Referenced by GetPDBHash(), and TopSpinGraphHeuristic::HCost().
uint64_t TopSpinGraph::GetPDBSize | ( | int | puzzle_size, |
int | pdb_size | ||
) | const |
Definition at line 238 of file TopSpinGraph.cpp.
Referenced by TopSpinGraphHeuristic::TopSpinGraphHeuristic().
graphState TopSpinGraph::GetState | ( | const std::vector< int > & | configuration | ) | const |
Definition at line 75 of file TopSpinGraph.cpp.
Referenced by Dual(), ExpandNode(), GetPDBHash(), and TopSpinGraph().
graphState TopSpinGraph::GetState | ( | const std::vector< int > & | configuration, |
int | zeroLoc | ||
) | const |
Definition at line 89 of file TopSpinGraph.cpp.
References Graph::AddNode(), data, GraphEnvironment::g, g2, node::GetNum(), GetStateHash(), and hashTable.
std::vector< int > & TopSpinGraph::GetState | ( | graphState | g | ) | const |
Definition at line 70 of file TopSpinGraph.cpp.
References data.
|
virtual |
Reimplemented from GraphEnvironment.
Definition at line 142 of file TopSpinGraph.cpp.
References data.
Referenced by GetState(), and GetStateHash().
uint64_t TopSpinGraph::GetStateHash | ( | const int * | config, |
int | config_size | ||
) | const |
Definition at line 167 of file TopSpinGraph.cpp.
uint64_t TopSpinGraph::GetStateHash | ( | const std::vector< int > & | config | ) | const |
Definition at line 162 of file TopSpinGraph.cpp.
References GetStateHash().
|
virtual |
Reimplemented from GraphEnvironment.
Definition at line 45 of file TopSpinGraph.cpp.
References data, ExpandNode(), and GraphEnvironment::GetSuccessors().
|
virtual |
Reimplemented from GraphEnvironment.
Definition at line 65 of file TopSpinGraph.cpp.
|
inlinevirtual |
Definition at line 51 of file TopSpinGraph.h.
|
mutableprivate |
Definition at line 72 of file TopSpinGraph.h.
Referenced by Dual(), ExpandNode(), GetActions(), GetState(), GetStateHash(), and GetSuccessors().
|
private |
Definition at line 73 of file TopSpinGraph.h.
Referenced by ExpandNode(), and TopSpinGraph().
|
mutableprivate |
Definition at line 70 of file TopSpinGraph.h.
Referenced by ExpandNode(), and GetState().
|
mutableprivate |
Definition at line 71 of file TopSpinGraph.h.
Referenced by GetState().
|
private |
Definition at line 73 of file TopSpinGraph.h.
Referenced by ExpandNode(), and TopSpinGraph().