HOG2
|
#include <BurnedPancakePuzzle.h>
Public Member Functions | |
BurnedPancakePuzzle (unsigned s) | |
BurnedPancakePuzzle (unsigned size, const std::vector< unsigned > op_order) | |
~BurnedPancakePuzzle () | |
void | GetSuccessors (const BurnedPancakePuzzleState &state, std::vector< BurnedPancakePuzzleState > &neighbors) const |
void | GetActions (const BurnedPancakePuzzleState &state, std::vector< unsigned > &actions) const |
unsigned | GetAction (const BurnedPancakePuzzleState &s1, const BurnedPancakePuzzleState &s2) const |
void | ApplyAction (BurnedPancakePuzzleState &s, unsigned a) const |
bool | InvertAction (unsigned &a) const |
virtual uint64_t | GetStateHash (const BurnedPancakePuzzleState &s) const |
double | HCost (const BurnedPancakePuzzleState &state1, const BurnedPancakePuzzleState &state2) const |
Heuristic value between two arbitrary nodes. More... | |
double | Memory_Free_HCost (const BurnedPancakePuzzleState &state1, const std::vector< int > &goal_locs) const |
double | HCost (const BurnedPancakePuzzleState &state1) const |
Heuristic value between node and the stored goal. More... | |
double | GCost (const BurnedPancakePuzzleState &, const BurnedPancakePuzzleState &) const |
double | GCost (const BurnedPancakePuzzleState &, const unsigned &) const |
bool | GoalTest (const BurnedPancakePuzzleState &state, const BurnedPancakePuzzleState &goal) const |
bool | GoalTest (const BurnedPancakePuzzleState &s) const |
Goal Test if the goal is stored. More... | |
uint64_t | GetActionHash (unsigned act) const |
void | StoreGoal (BurnedPancakePuzzleState &) |
Stores the goal for use by single-state HCost. More... | |
std::vector< unsigned > | Get_Op_Order () |
BurnedPancakePuzzleState | Get_Goal () |
Returns stored goal state if it is stored. More... | |
void | ClearGoal () |
Clears the goal from memory. More... | |
bool | IsGoalStored () const |
void | Change_Op_Order (const std::vector< unsigned > op_order) |
Changes the ordering of operators to the new inputted order. More... | |
void | OpenGLDraw () const |
void | OpenGLDraw (const BurnedPancakePuzzleState &) const |
void | OpenGLDraw (const BurnedPancakePuzzleState &, const unsigned &) const |
void | OpenGLDraw (const BurnedPancakePuzzleState &, const BurnedPancakePuzzleState &, float) const |
Draw the transition at some percentage 0...1 between two states. More... | |
void | Set_Use_Memory_Free_Heuristic (bool to_use) |
Public Member Functions inherited from SearchEnvironment< BurnedPancakePuzzleState, unsigned > | |
virtual | ~SearchEnvironment () |
virtual int | GetNumSuccessors (const BurnedPancakePuzzleState &stateID) const |
virtual void | UndoAction (BurnedPancakePuzzleState &s, unsigned a) const |
virtual void | GetNextState (const BurnedPancakePuzzleState &s1, unsigned a, BurnedPancakePuzzleState &s2) const |
virtual bool | IsGoalStored () const |
Returns true if the goal is stored and false otherwise. More... | |
virtual double | HCost (const BurnedPancakePuzzleState &node1, const BurnedPancakePuzzleState &node2, double parentHCost) const |
virtual uint64_t | GetMaxHash () const |
virtual void | GetStateFromHash (uint64_t parent, BurnedPancakePuzzleState &s) const |
virtual double | GetPathLength (std::vector< BurnedPancakePuzzleState > &neighbors) |
virtual double | GetPathLength (const BurnedPancakePuzzleState &start, std::vector< unsigned > &neighbors) |
virtual OccupancyInterface< BurnedPancakePuzzleState, unsigned > * | GetOccupancyInfo () |
virtual void | SetOccupancyInfo (OccupancyInterface< BurnedPancakePuzzleState, unsigned > *) |
virtual void | OpenGLDraw () const |
virtual void | GLLabelState (const BurnedPancakePuzzleState &, const char *) const |
virtual void | GLDrawLine (const BurnedPancakePuzzleState &x, const BurnedPancakePuzzleState &y) const |
virtual void | GLDrawPath (const std::vector< BurnedPancakePuzzleState > &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 BurnedPancakePuzzleState &) const |
virtual void | DrawLine (Graphics::Display &display, const BurnedPancakePuzzleState &x, const BurnedPancakePuzzleState &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< BurnedPancakePuzzleState > | |
Heuristic () | |
virtual | ~Heuristic () |
Static Public Member Functions | |
static std::vector< unsigned > | Get_Puzzle_Order (int64_t order_num, unsigned num_pancakes) |
Returns a possible ordering of the operators. More... | |
Private Member Functions | |
uint64_t | Factorial (int val) const |
Private Attributes | |
std::vector< unsigned > | operators |
bool | goal_stored |
bool | use_memory_free |
BurnedPancakePuzzleState | goal |
std::vector< int > | goal_locations |
unsigned | size |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< BurnedPancakePuzzleState > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Protected Attributes inherited from SearchEnvironment< BurnedPancakePuzzleState, unsigned > | |
bool | bValidSearchGoal |
BurnedPancakePuzzleState | searchGoal |
rgbColor | color |
GLfloat | transparency |
Definition at line 41 of file BurnedPancakePuzzle.h.
BurnedPancakePuzzle::BurnedPancakePuzzle | ( | unsigned | s | ) |
Definition at line 4 of file BurnedPancakePuzzle.cpp.
References goal_stored, operators, size, and use_memory_free.
BurnedPancakePuzzle::BurnedPancakePuzzle | ( | unsigned | size, |
const std::vector< unsigned > | op_order | ||
) |
Definition at line 17 of file BurnedPancakePuzzle.cpp.
References Change_Op_Order(), goal_stored, size, and use_memory_free.
BurnedPancakePuzzle::~BurnedPancakePuzzle | ( | ) |
Definition at line 27 of file BurnedPancakePuzzle.cpp.
References ClearGoal().
|
virtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 122 of file BurnedPancakePuzzle.cpp.
References BurnedPancakePuzzleState::puzzle, and size.
Referenced by SFBDPancakeEnvironment::ApplyAction(), GetAction(), GetSuccessors(), and SFBDPancakeEnvironment::MeasureLocalHeuristic().
void BurnedPancakePuzzle::Change_Op_Order | ( | const std::vector< unsigned > | op_order | ) |
Changes the ordering of operators to the new inputted order.
Definition at line 314 of file BurnedPancakePuzzle.cpp.
References operators, and size.
Referenced by BurnedPancakePuzzle().
|
inlinevirtual |
Clears the goal from memory.
Reimplemented from SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 81 of file BurnedPancakePuzzle.h.
Referenced by ~BurnedPancakePuzzle().
|
inlineprivate |
Definition at line 133 of file BurnedPancakePuzzle.h.
Referenced by GetStateHash().
|
inlinevirtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 59 of file BurnedPancakePuzzle.h.
|
inlinevirtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 60 of file BurnedPancakePuzzle.h.
|
inline |
Returns stored goal state if it is stored.
Definition at line 73 of file BurnedPancakePuzzle.h.
References goal, and goal_stored.
|
inline |
Definition at line 70 of file BurnedPancakePuzzle.h.
References operators.
|
static |
Returns a possible ordering of the operators.
The orders are in a "lexicographic" with the original ordering being 2, 3, ..., num_pancakes. This is therefore the order returned with a call of order_num=0. The default ordering used when a BurnedPancakePuzzle environment is created is num_pancakes, ..., 2 which is returned with a call of num_pancakes! -1.
|
virtual |
Reimplemented from SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 97 of file BurnedPancakePuzzle.cpp.
References ApplyAction(), InvertAction(), operators, BurnedPancakePuzzleState::puzzle, and size.
|
virtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 295 of file BurnedPancakePuzzle.cpp.
|
virtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 86 of file BurnedPancakePuzzle.cpp.
References operators.
Referenced by SFBDPancakeEnvironment::MeasureLocalHeuristic().
|
virtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 473 of file BurnedPancakePuzzle.cpp.
References Factorial(), and BurnedPancakePuzzleState::puzzle.
Referenced by SFBDPancakeEnvironment::GetStateHash().
|
virtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 73 of file BurnedPancakePuzzle.cpp.
References ApplyAction(), and operators.
|
virtual |
Goal Test if the goal is stored.
Reimplemented from SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 280 of file BurnedPancakePuzzle.cpp.
References goal, goal_stored, BurnedPancakePuzzleState::puzzle, and size.
|
virtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 275 of file BurnedPancakePuzzle.cpp.
|
virtual |
Heuristic value between node and the stored goal.
Asserts that the goal is stored
Reimplemented from SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 150 of file BurnedPancakePuzzle.cpp.
References goal, goal_locations, goal_stored, max, Memory_Free_HCost(), BurnedPancakePuzzleState::puzzle, size, and use_memory_free.
|
virtual |
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 192 of file BurnedPancakePuzzle.cpp.
References Memory_Free_HCost(), BurnedPancakePuzzleState::puzzle, size, and use_memory_free.
Referenced by SFBDPancakeEnvironment::HCost(), and SFBDPancakeEnvironment::MeasureLocalHeuristic().
|
virtual |
Implements SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 143 of file BurnedPancakePuzzle.cpp.
References size.
Referenced by GetAction().
|
inline |
Definition at line 83 of file BurnedPancakePuzzle.h.
References goal_stored.
double BurnedPancakePuzzle::Memory_Free_HCost | ( | const BurnedPancakePuzzleState & | state1, |
const std::vector< int > & | goal_locs | ||
) | const |
Definition at line 233 of file BurnedPancakePuzzle.cpp.
References GetDualEntryLoc(), BurnedPancakePuzzleState::puzzle, and size.
Referenced by HCost().
|
inline |
Definition at line 91 of file BurnedPancakePuzzle.h.
|
inlinevirtual |
Reimplemented from SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 92 of file BurnedPancakePuzzle.h.
|
inlinevirtual |
Draw the transition at some percentage 0...1 between two states.
Reimplemented from SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 94 of file BurnedPancakePuzzle.h.
|
inlinevirtual |
Reimplemented from SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 93 of file BurnedPancakePuzzle.h.
|
inline |
Definition at line 120 of file BurnedPancakePuzzle.h.
References use_memory_free.
|
virtual |
Stores the goal for use by single-state HCost.
Reimplemented from SearchEnvironment< BurnedPancakePuzzleState, unsigned >.
Definition at line 300 of file BurnedPancakePuzzle.cpp.
References goal, goal_locations, goal_stored, BurnedPancakePuzzleState::puzzle, and size.
|
private |
Definition at line 128 of file BurnedPancakePuzzle.h.
Referenced by Get_Goal(), GoalTest(), HCost(), and StoreGoal().
|
private |
Definition at line 129 of file BurnedPancakePuzzle.h.
Referenced by HCost(), and StoreGoal().
|
private |
Definition at line 125 of file BurnedPancakePuzzle.h.
Referenced by BurnedPancakePuzzle(), Get_Goal(), GoalTest(), HCost(), IsGoalStored(), and StoreGoal().
|
private |
Definition at line 124 of file BurnedPancakePuzzle.h.
Referenced by BurnedPancakePuzzle(), Change_Op_Order(), Get_Op_Order(), GetAction(), GetActions(), and GetSuccessors().
|
private |
Definition at line 130 of file BurnedPancakePuzzle.h.
Referenced by ApplyAction(), BurnedPancakePuzzle(), Change_Op_Order(), GetAction(), GoalTest(), HCost(), InvertAction(), Memory_Free_HCost(), and StoreGoal().
|
private |
Definition at line 126 of file BurnedPancakePuzzle.h.
Referenced by BurnedPancakePuzzle(), HCost(), and Set_Use_Memory_Free_Heuristic().