HOG2
Public Member Functions | Public Attributes | List of all members
RubiksCube Class Reference

#include <RubiksCube.h>

Inheritance diagram for RubiksCube:
Inheritance graph
[legend]
Collaboration diagram for RubiksCube:
Collaboration graph
[legend]

Public Member Functions

 RubiksCube ()
 
 ~RubiksCube ()
 
std::string GetName ()
 
void SetPruneSuccessors (bool val)
 
virtual void GetSuccessors (const RubiksState &nodeID, std::vector< RubiksState > &neighbors) const
 
virtual void GetActions (const RubiksState &nodeID, std::vector< RubiksAction > &actions) const
 
virtual void GetPrunedActions (const RubiksState &nodeID, RubiksAction lastAction, std::vector< RubiksAction > &actions) const
 
virtual RubiksAction GetAction (const RubiksState &s1, const RubiksState &s2) const
 
virtual void ApplyAction (RubiksState &s, RubiksAction a) const
 
virtual void UndoAction (RubiksState &s, RubiksAction a) const
 
virtual void GetNextState (const RubiksState &, RubiksAction, RubiksState &) const
 
virtual bool InvertAction (RubiksAction &a) const
 
virtual double HCost (const RubiksState &node1, const RubiksState &node2) const
 Heuristic value between two arbitrary nodes. More...
 
virtual double HCost (const RubiksState &node1, const RubiksState &node2, double parentHCost) const
 
int Edge12PDBDist (const RubiksState &s)
 
virtual double HCost (const RubiksState &node) const
 Heuristic value between node and the stored goal. More...
 
virtual double GCost (const RubiksState &node1, const RubiksState &node2) const
 
virtual double GCost (const RubiksState &node, const RubiksAction &act) const
 
virtual bool GoalTest (const RubiksState &node, const RubiksState &goal) const
 
virtual bool GoalTest (const RubiksState &node) const
 Goal Test if the goal is stored. More...
 
virtual uint64_t GetStateHash (const RubiksState &node) const
 
virtual uint64_t GetCornerHash (const RubiksState &node) const
 
virtual uint64_t GetEdgeHash (const RubiksState &node) const
 
virtual uint64_t GetActionHash (RubiksAction act) const
 
virtual void GetStateFromHash (uint64_t hash, RubiksState &node) const
 
virtual void GetStateFromHash (uint64_t cornerHash, uint64_t edgeHash, RubiksState &node) const
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const RubiksState &) const
 
virtual void OpenGLDrawCorners (const RubiksState &) const
 
virtual void OpenGLDrawEdges (const RubiksState &) const
 
virtual void OpenGLDrawEdgeDual (const RubiksState &) const
 
virtual void OpenGLDrawCenters () const
 
virtual void OpenGLDrawCubeBackground () const
 
virtual void OpenGLDraw (const RubiksState &, const RubiksState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void OpenGLDraw (const RubiksState &, const RubiksAction &) const
 
void OpenGLDrawCube (int cube) const
 
void SetFaceColor (int face) const
 
- Public Member Functions inherited from SearchEnvironment< RubiksState, RubiksAction >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const RubiksState &stateID) const
 
virtual void StoreGoal (RubiksState &s)
 Stores the goal for use by single-state HCost. More...
 
virtual void ClearGoal ()
 Clears the goal from memory. More...
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual uint64_t GetMaxHash () const
 
virtual double GetPathLength (std::vector< RubiksState > &neighbors)
 
virtual double GetPathLength (const RubiksState &start, std::vector< RubiksAction > &neighbors)
 
virtual OccupancyInterface< RubiksState, RubiksAction > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< RubiksState, RubiksAction > *)
 
virtual void OpenGLDraw () const
 
virtual void GLLabelState (const RubiksState &, const char *) const
 
virtual void GLDrawLine (const RubiksState &x, const RubiksState &y) const
 
virtual void GLDrawPath (const std::vector< RubiksState > &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 RubiksState &) const
 
virtual void DrawLine (Graphics::Display &display, const RubiksState &x, const RubiksState &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< RubiksState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Public Attributes

int compressionFactor
 
bool minCompression
 
bool bloomFilter
 
bool minBloomFilter
 
std::vector< uint64_t > edgeDist
 
std::vector< uint64_t > cornDist
 
std::unordered_map< uint64_t, uint8_t > depthTable
 
BloomFilterdepth8
 
BloomFilterdepth9
 
MinBloomFilterminBloom
 
std::vector< RubiksActionhistory
 
RubiksCorner c
 
RubikEdge e
 
RubikEdgeState dual
 
Rubik7EdgeState e7dual
 
Rubik7Edge e7
 
DiskBitFilef
 
std::vector< bucketInfodata
 
std::vector< bucketDatabuckets
 
bool pruneSuccessors
 
- Public Attributes inherited from Heuristic< RubiksState >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 

Additional Inherited Members

- Protected Attributes inherited from SearchEnvironment< RubiksState, RubiksAction >
bool bValidSearchGoal
 
RubiksState searchGoal
 
rgbColor color
 
GLfloat transparency
 

Detailed Description

Definition at line 106 of file RubiksCube.h.

Constructor & Destructor Documentation

◆ RubiksCube()

RubiksCube::RubiksCube ( )
inline

Definition at line 109 of file RubiksCube.h.

References bloomFilter, buckets, cornDist, data, depth8, depth9, edgeDist, f, minCompression, and pruneSuccessors.

◆ ~RubiksCube()

RubiksCube::~RubiksCube ( )
inline

Definition at line 133 of file RubiksCube.h.

Member Function Documentation

◆ ApplyAction()

void RubiksCube::ApplyAction ( RubiksState s,
RubiksAction  a 
) const
virtual

◆ Edge12PDBDist()

int RubiksCube::Edge12PDBDist ( const RubiksState s)

◆ GCost() [1/2]

virtual double RubiksCube::GCost ( const RubiksState node,
const RubiksAction act 
) const
inlinevirtual

Implements SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 157 of file RubiksCube.h.

◆ GCost() [2/2]

virtual double RubiksCube::GCost ( const RubiksState node1,
const RubiksState node2 
) const
inlinevirtual

Implements SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 156 of file RubiksCube.h.

◆ GetAction()

RubiksAction RubiksCube::GetAction ( const RubiksState s1,
const RubiksState s2 
) const
virtual

Reimplemented from SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 71 of file RubiksCube.cpp.

References GetNextState().

Referenced by OpenGLDraw().

◆ GetActionHash()

virtual uint64_t RubiksCube::GetActionHash ( RubiksAction  act) const
inlinevirtual

Implements SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 167 of file RubiksCube.h.

◆ GetActions()

void RubiksCube::GetActions ( const RubiksState nodeID,
std::vector< RubiksAction > &  actions 
) const
virtual

Implements SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 43 of file RubiksCube.cpp.

References history, and pruneSuccessors.

Referenced by RubiksCubeInstances::GetRandomN().

◆ GetCornerHash()

uint64_t RubiksCube::GetCornerHash ( const RubiksState node) const
virtual

Definition at line 418 of file RubiksCube.cpp.

References c, and RubiksCorner::GetStateHash().

◆ GetEdgeHash()

uint64_t RubiksCube::GetEdgeHash ( const RubiksState node) const
virtual

Definition at line 423 of file RubiksCube.cpp.

References e, and RubikEdge::GetStateHash().

◆ GetName()

std::string RubiksCube::GetName ( )
inline

Definition at line 134 of file RubiksCube.h.

◆ GetNextState()

void RubiksCube::GetNextState ( const RubiksState s1,
RubiksAction  a,
RubiksState s2 
) const
virtual

Reimplemented from SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 109 of file RubiksCube.cpp.

References ApplyAction().

Referenced by GetAction(), and GetSuccessors().

◆ GetPrunedActions()

void RubiksCube::GetPrunedActions ( const RubiksState nodeID,
RubiksAction  lastAction,
std::vector< RubiksAction > &  actions 
) const
virtual

Definition at line 24 of file RubiksCube.cpp.

◆ GetStateFromHash() [1/2]

void RubiksCube::GetStateFromHash ( uint64_t  cornerHash,
uint64_t  edgeHash,
RubiksState node 
) const
virtual

Definition at line 428 of file RubiksCube.cpp.

References c, e, RubiksCorner::GetStateFromHash(), and RubikEdge::GetStateFromHash().

◆ GetStateFromHash() [2/2]

void RubiksCube::GetStateFromHash ( uint64_t  hash,
RubiksState node 
) const
virtual

◆ GetStateHash()

uint64_t RubiksCube::GetStateHash ( const RubiksState node) const
virtual

◆ GetSuccessors()

void RubiksCube::GetSuccessors ( const RubiksState nodeID,
std::vector< RubiksState > &  neighbors 
) const
virtual

Implements SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 15 of file RubiksCube.cpp.

References GetNextState().

◆ GoalTest() [1/2]

bool RubiksCube::GoalTest ( const RubiksState node) const
virtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 404 of file RubiksCube.cpp.

◆ GoalTest() [2/2]

bool RubiksCube::GoalTest ( const RubiksState node,
const RubiksState goal 
) const
virtual

◆ HCost() [1/3]

double RubiksCube::HCost ( const RubiksState node) const
virtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 392 of file RubiksCube.cpp.

References HCost().

◆ HCost() [2/3]

double RubiksCube::HCost ( const RubiksState node1,
const RubiksState node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 290 of file RubiksCube.cpp.

Referenced by HCost().

◆ HCost() [3/3]

double RubiksCube::HCost ( const RubiksState node1,
const RubiksState node2,
double  parentHCost 
) const
virtual

Reimplemented from SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 153 of file RubiksCube.cpp.

References HCost().

◆ InvertAction()

bool RubiksCube::InvertAction ( RubiksAction a) const
virtual

Implements SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 115 of file RubiksCube.cpp.

Referenced by UndoAction().

◆ OpenGLDraw() [1/4]

void RubiksCube::OpenGLDraw ( ) const
virtual

Definition at line 440 of file RubiksCube.cpp.

Referenced by RubikPDB::OpenGLDraw().

◆ OpenGLDraw() [2/4]

void RubiksCube::OpenGLDraw ( const RubiksState s) const
virtual

◆ OpenGLDraw() [3/4]

void RubiksCube::OpenGLDraw ( const RubiksState ,
const RubiksAction  
) const
virtual

Reimplemented from SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 808 of file RubiksCube.cpp.

◆ OpenGLDraw() [4/4]

void RubiksCube::OpenGLDraw ( const RubiksState s1,
const RubiksState s2,
float  t 
) const
virtual

Draw the transition at some percentage 0...1 between two states.

Reimplemented from SearchEnvironment< RubiksState, RubiksAction >.

Definition at line 650 of file RubiksCube.cpp.

References c, RubiksState::corner, e, RubiksState::edge, GetAction(), RubiksCorner::OpenGLDrawCube(), RubikEdge::OpenGLDrawCube(), and OpenGLDrawCube().

◆ OpenGLDrawCenters()

void RubiksCube::OpenGLDrawCenters ( ) const
virtual

Definition at line 522 of file RubiksCube.cpp.

References OpenGLDrawCube().

Referenced by OpenGLDraw(), OpenGLDrawCorners(), OpenGLDrawEdgeDual(), and OpenGLDrawEdges().

◆ OpenGLDrawCorners()

void RubiksCube::OpenGLDrawCorners ( const RubiksState s) const
virtual

◆ OpenGLDrawCube()

void RubiksCube::OpenGLDrawCube ( int  cube) const

Definition at line 534 of file RubiksCube.cpp.

References SetFaceColor().

Referenced by OpenGLDraw(), and OpenGLDrawCenters().

◆ OpenGLDrawCubeBackground()

void RubiksCube::OpenGLDrawCubeBackground ( ) const
virtual

Definition at line 476 of file RubiksCube.cpp.

Referenced by OpenGLDraw(), OpenGLDrawCorners(), OpenGLDrawEdgeDual(), and OpenGLDrawEdges().

◆ OpenGLDrawEdgeDual()

void RubiksCube::OpenGLDrawEdgeDual ( const RubiksState s) const
virtual

◆ OpenGLDrawEdges()

void RubiksCube::OpenGLDrawEdges ( const RubiksState s) const
virtual

◆ SetFaceColor()

void RubiksCube::SetFaceColor ( int  face) const

Definition at line 633 of file RubiksCube.cpp.

Referenced by OpenGLDrawCube().

◆ SetPruneSuccessors()

void RubiksCube::SetPruneSuccessors ( bool  val)
inline

Definition at line 135 of file RubiksCube.h.

References history, and pruneSuccessors.

Referenced by RubiksCubeInstances::GetRandomN().

◆ UndoAction()

void RubiksCube::UndoAction ( RubiksState s,
RubiksAction  a 
) const
virtual

Member Data Documentation

◆ bloomFilter

bool RubiksCube::bloomFilter

Definition at line 189 of file RubiksCube.h.

Referenced by RubiksCube().

◆ buckets

std::vector<bucketData> RubiksCube::buckets

Definition at line 213 of file RubiksCube.h.

Referenced by RubiksCube().

◆ c

RubiksCorner RubiksCube::c

◆ compressionFactor

int RubiksCube::compressionFactor

Definition at line 187 of file RubiksCube.h.

◆ cornDist

std::vector<uint64_t> RubiksCube::cornDist

Definition at line 192 of file RubiksCube.h.

Referenced by RubiksCube().

◆ data

std::vector<bucketInfo> RubiksCube::data

Definition at line 212 of file RubiksCube.h.

Referenced by Edge12PDBDist(), and RubiksCube().

◆ depth8

BloomFilter* RubiksCube::depth8

Definition at line 194 of file RubiksCube.h.

Referenced by RubiksCube().

◆ depth9

BloomFilter * RubiksCube::depth9

Definition at line 194 of file RubiksCube.h.

Referenced by RubiksCube().

◆ depthTable

std::unordered_map<uint64_t, uint8_t> RubiksCube::depthTable

Definition at line 193 of file RubiksCube.h.

◆ dual

RubikEdgeState RubiksCube::dual
mutable

Definition at line 202 of file RubiksCube.h.

Referenced by OpenGLDrawEdgeDual().

◆ e

RubikEdge RubiksCube::e

◆ e7

Rubik7Edge RubiksCube::e7

Definition at line 204 of file RubiksCube.h.

◆ e7dual

Rubik7EdgeState RubiksCube::e7dual
mutable

Definition at line 203 of file RubiksCube.h.

◆ edgeDist

std::vector<uint64_t> RubiksCube::edgeDist

Definition at line 191 of file RubiksCube.h.

Referenced by RubiksCube().

◆ f

DiskBitFile* RubiksCube::f

Definition at line 211 of file RubiksCube.h.

Referenced by Edge12PDBDist(), and RubiksCube().

◆ history

std::vector<RubiksAction> RubiksCube::history
mutable

Definition at line 199 of file RubiksCube.h.

Referenced by ApplyAction(), GetActions(), SetPruneSuccessors(), and UndoAction().

◆ minBloom

MinBloomFilter* RubiksCube::minBloom

Definition at line 195 of file RubiksCube.h.

◆ minBloomFilter

bool RubiksCube::minBloomFilter

Definition at line 190 of file RubiksCube.h.

◆ minCompression

bool RubiksCube::minCompression

Definition at line 188 of file RubiksCube.h.

Referenced by RubiksCube().

◆ pruneSuccessors

bool RubiksCube::pruneSuccessors

Definition at line 215 of file RubiksCube.h.

Referenced by ApplyAction(), GetActions(), RubiksCube(), SetPruneSuccessors(), and UndoAction().


The documentation for this class was generated from the following files: