HOG2
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
RubikEdge Class Reference

#include <RubiksCubeEdges.h>

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

Public Member Functions

 RubikEdge ()
 
 ~RubikEdge ()
 
virtual void GetSuccessors (const RubikEdgeState &nodeID, std::vector< RubikEdgeState > &neighbors) const
 
virtual void GetActions (const RubikEdgeState &nodeID, std::vector< RubikEdgeAction > &actions) const
 
virtual RubikEdgeAction GetAction (const RubikEdgeState &s1, const RubikEdgeState &s2) const
 
virtual void ApplyAction (RubikEdgeStateArray &s, RubikEdgeAction a) const
 
virtual void UndoAction (RubikEdgeStateArray &s, RubikEdgeAction a) const
 
virtual void ApplyAction (RubikEdgeStateBits &s, RubikEdgeAction a) const
 
virtual void UndoAction (RubikEdgeStateBits &s, RubikEdgeAction a) const
 
virtual double HCost (const RubikEdgeState &node1, const RubikEdgeState &node2) const
 Heuristic value between two arbitrary nodes. More...
 
virtual double GCost (const RubikEdgeState &node1, const RubikEdgeState &node2) const
 
virtual double GCost (const RubikEdgeState &node, const RubikEdgeAction &act) const
 
virtual bool GoalTest (const RubikEdgeState &node, const RubikEdgeState &goal) const
 
bool GoalTest (const RubikEdgeStateBits &) const
 
bool GoalTest (const RubikEdgeStateArray &) const
 Goal Test if the goal is stored. More...
 
void ApplyMove (RubikEdgeState &s, RubikEdgeMove *a)
 
void UndoMove (RubikEdgeState &s, RubikEdgeMove *a)
 
void unrankPlayer (uint64_t d, RubikEdgeState &s, int who)
 
int64_t getMaxSinglePlayerRank () const
 
int64_t getMaxSinglePlayerRank2 ()
 
int64_t getMaxSinglePlayerRank2 (int64_t firstIndex)
 
RubikEdgeMovegetMoves (RubikEdgeState &)
 
void freeMove (RubikEdgeMove *m)
 
virtual void GetNextState (const RubikEdgeState &, RubikEdgeAction, RubikEdgeState &) const
 
virtual bool InvertAction (RubikEdgeAction &a) const
 
int64_t rankPlayer (RubikEdgeState &s, int who)
 
void rankPlayerFirstTwo (const RubikEdgeState &s, int who, int64_t &rank)
 
void rankPlayerRemaining (const RubikEdgeState &s, int who, int64_t &rank)
 
void rankPlayer (const RubikEdgeState &s, int who, int64_t &index1, int64_t &index2)
 
virtual uint64_t GetStateHash (const RubikEdgeState &node) const
 
virtual uint64_t GetActionHash (RubikEdgeAction act) const
 
virtual void GetStateFromHash (uint64_t hash, RubikEdgeState &node) const
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const RubikEdgeState &) const
 
virtual void OpenGLDraw (const RubikEdgeState &, const RubikEdgeState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void OpenGLDraw (const RubikEdgeState &, const RubikEdgeAction &) const
 
void OpenGLDrawCube (const RubikEdgeState &s, int cube) const
 
- Public Member Functions inherited from SearchEnvironment< RubikEdgeState, RubikEdgeAction >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const RubikEdgeState &stateID) const
 
virtual void StoreGoal (RubikEdgeState &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 double HCost (const RubikEdgeState &node1, const RubikEdgeState &node2, double parentHCost) const
 
virtual double HCost (const RubikEdgeState &node) const
 Heuristic value between node and the stored goal. More...
 
virtual uint64_t GetMaxHash () const
 
virtual double GetPathLength (std::vector< RubikEdgeState > &neighbors)
 
virtual double GetPathLength (const RubikEdgeState &start, std::vector< RubikEdgeAction > &neighbors)
 
virtual OccupancyInterface< RubikEdgeState, RubikEdgeAction > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< RubikEdgeState, RubikEdgeAction > *)
 
virtual void OpenGLDraw () const
 
virtual void GLLabelState (const RubikEdgeState &, const char *) const
 
virtual void GLDrawLine (const RubikEdgeState &x, const RubikEdgeState &y) const
 
virtual void GLDrawPath (const std::vector< RubikEdgeState > &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 RubikEdgeState &) const
 
virtual void DrawLine (Graphics::Display &display, const RubikEdgeState &x, const RubikEdgeState &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< RubikEdgeState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Static Public Member Functions

static void MRUnrank (int n, uint64_t r, uint64_t &perm)
 
static void MRUnrank2 (int n, uint64_t r, uint64_t &perm)
 
static uint64_t MRRank (int n, uint64_t perm, uint64_t dual)
 
static uint64_t MRRank2 (int n, uint64_t perm, uint64_t dual)
 

Private Member Functions

void SetCubeColor (int which, bool face, const RubikEdgeState &) const
 

Private Attributes

int piecesToRank
 
RubikEdgeMove moves [18]
 

Additional Inherited Members

- Public Attributes inherited from Heuristic< RubikEdgeState >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 
- Protected Attributes inherited from SearchEnvironment< RubikEdgeState, RubikEdgeAction >
bool bValidSearchGoal
 
RubikEdgeState searchGoal
 
rgbColor color
 
GLfloat transparency
 

Detailed Description

Definition at line 125 of file RubiksCubeEdges.h.

Constructor & Destructor Documentation

◆ RubikEdge()

RubikEdge::RubikEdge ( )
inline

Definition at line 128 of file RubiksCubeEdges.h.

References RubikEdgeMove::act, moves, RubikEdgeMove::next, and piecesToRank.

◆ ~RubikEdge()

RubikEdge::~RubikEdge ( )
inline

Definition at line 138 of file RubiksCubeEdges.h.

Member Function Documentation

◆ ApplyAction() [1/2]

void RubikEdge::ApplyAction ( RubikEdgeStateArray s,
RubikEdgeAction  a 
) const
virtual

◆ ApplyAction() [2/2]

void RubikEdge::ApplyAction ( RubikEdgeStateBits s,
RubikEdgeAction  a 
) const
virtual

Definition at line 521 of file RubiksCubeEdges.cpp.

◆ ApplyMove()

void RubikEdge::ApplyMove ( RubikEdgeState s,
RubikEdgeMove a 
)

Definition at line 211 of file RubiksCubeEdges.cpp.

References RubikEdgeMove::act, and ApplyAction().

◆ freeMove()

void RubikEdge::freeMove ( RubikEdgeMove m)
inline

Definition at line 168 of file RubiksCubeEdges.h.

◆ GCost() [1/2]

virtual double RubikEdge::GCost ( const RubikEdgeState node,
const RubikEdgeAction act 
) const
inlinevirtual

◆ GCost() [2/2]

virtual double RubikEdge::GCost ( const RubikEdgeState node1,
const RubikEdgeState node2 
) const
inlinevirtual

◆ GetAction()

RubikEdgeAction RubikEdge::GetAction ( const RubikEdgeState s1,
const RubikEdgeState s2 
) const
virtual

Reimplemented from SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 204 of file RubiksCubeEdges.cpp.

◆ GetActionHash()

virtual uint64_t RubikEdge::GetActionHash ( RubikEdgeAction  act) const
inlinevirtual

◆ GetActions()

void RubikEdge::GetActions ( const RubikEdgeState nodeID,
std::vector< RubikEdgeAction > &  actions 
) const
virtual

◆ getMaxSinglePlayerRank()

int64_t RubikEdge::getMaxSinglePlayerRank ( ) const

Definition at line 598 of file RubiksCubeEdges.cpp.

References Factorial().

Referenced by RubiksCube::GetStateFromHash(), and RubiksCube::GetStateHash().

◆ getMaxSinglePlayerRank2() [1/2]

int64_t RubikEdge::getMaxSinglePlayerRank2 ( )

Definition at line 609 of file RubiksCubeEdges.cpp.

◆ getMaxSinglePlayerRank2() [2/2]

int64_t RubikEdge::getMaxSinglePlayerRank2 ( int64_t  firstIndex)

Definition at line 614 of file RubiksCubeEdges.cpp.

References Factorial().

◆ getMoves()

RubikEdgeMove* RubikEdge::getMoves ( RubikEdgeState )
inline

Definition at line 167 of file RubiksCubeEdges.h.

References moves.

◆ GetNextState()

void RubikEdge::GetNextState ( const RubikEdgeState s0,
RubikEdgeAction  a,
RubikEdgeState s1 
) const
virtual

Reimplemented from SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 527 of file RubiksCubeEdges.cpp.

References ApplyAction().

Referenced by GetSuccessors().

◆ GetStateFromHash()

void RubikEdge::GetStateFromHash ( uint64_t  hash,
RubikEdgeState node 
) const
virtual

◆ GetStateHash()

uint64_t RubikEdge::GetStateHash ( const RubikEdgeState node) const
virtual

◆ GetSuccessors()

void RubikEdge::GetSuccessors ( const RubikEdgeState nodeID,
std::vector< RubikEdgeState > &  neighbors 
) const
virtual

◆ GoalTest() [1/3]

virtual bool RubikEdge::GoalTest ( const RubikEdgeState node,
const RubikEdgeState goal 
) const
inlinevirtual

Implements SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 152 of file RubiksCubeEdges.h.

References GoalTest().

Referenced by GoalTest().

◆ GoalTest() [2/3]

bool RubikEdge::GoalTest ( const RubikEdgeStateArray node) const
virtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 553 of file RubiksCubeEdges.cpp.

◆ GoalTest() [3/3]

bool RubikEdge::GoalTest ( const RubikEdgeStateBits b) const

Definition at line 547 of file RubiksCubeEdges.cpp.

References RubikEdgeStateBits::state.

◆ HCost()

virtual double RubikEdge::HCost ( const RubikEdgeState node1,
const RubikEdgeState node2 
) const
inlinevirtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 149 of file RubiksCubeEdges.h.

◆ InvertAction()

bool RubikEdge::InvertAction ( RubikEdgeAction a) const
virtual

◆ MRRank()

uint64_t RubikEdge::MRRank ( int  n,
uint64_t  perm,
uint64_t  dual 
)
static

Definition at line 668 of file RubiksCubeEdges.cpp.

References get(), and swap().

Referenced by GetStateHash(), RubikEdgePDB::GetStateHash(), and rankPlayerRemaining().

◆ MRRank2()

uint64_t RubikEdge::MRRank2 ( int  n,
uint64_t  perm,
uint64_t  dual 
)
static

Definition at line 705 of file RubiksCubeEdges.cpp.

References get(), and swap().

◆ MRUnrank()

void RubikEdge::MRUnrank ( int  n,
uint64_t  r,
uint64_t &  perm 
)
static

Definition at line 747 of file RubiksCubeEdges.cpp.

References swap().

◆ MRUnrank2()

void RubikEdge::MRUnrank2 ( int  n,
uint64_t  r,
uint64_t &  perm 
)
static

Definition at line 758 of file RubiksCubeEdges.cpp.

References swap().

Referenced by GetStateFromHash(), and RubikEdgePDB::GetStateFromHash().

◆ OpenGLDraw() [1/4]

void RubikEdge::OpenGLDraw ( ) const
virtual

◆ OpenGLDraw() [2/4]

void RubikEdge::OpenGLDraw ( const RubikEdgeState s) const
virtual

Reimplemented from SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 839 of file RubiksCubeEdges.cpp.

References OpenGLDrawCube().

◆ OpenGLDraw() [3/4]

void RubikEdge::OpenGLDraw ( const RubikEdgeState ,
const RubikEdgeAction  
) const
virtual

Reimplemented from SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 861 of file RubiksCubeEdges.cpp.

◆ OpenGLDraw() [4/4]

void RubikEdge::OpenGLDraw ( const RubikEdgeState ,
const RubikEdgeState ,
float   
) const
virtual

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

Reimplemented from SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 856 of file RubiksCubeEdges.cpp.

◆ OpenGLDrawCube()

void RubikEdge::OpenGLDrawCube ( const RubikEdgeState s,
int  cube 
) const

Definition at line 866 of file RubiksCubeEdges.cpp.

References SetCubeColor().

Referenced by RubiksCube::OpenGLDraw(), and OpenGLDraw().

◆ rankPlayer() [1/2]

void RubikEdge::rankPlayer ( const RubikEdgeState s,
int  who,
int64_t &  index1,
int64_t &  index2 
)
inline

Definition at line 177 of file RubiksCubeEdges.h.

References rankPlayerFirstTwo(), and rankPlayerRemaining().

◆ rankPlayer() [2/2]

int64_t RubikEdge::rankPlayer ( RubikEdgeState s,
int  who 
)
inline

Definition at line 173 of file RubiksCubeEdges.h.

References GetStateHash().

Referenced by RubiksCube::Edge12PDBDist().

◆ rankPlayerFirstTwo()

void RubikEdge::rankPlayerFirstTwo ( const RubikEdgeState s,
int  who,
int64_t &  rank 
)

Definition at line 619 of file RubiksCubeEdges.cpp.

References RubikEdgeStateArray::GetCubeOrientation().

Referenced by rankPlayer().

◆ rankPlayerRemaining()

void RubikEdge::rankPlayerRemaining ( const RubikEdgeState s,
int  who,
int64_t &  rank 
)

Definition at line 628 of file RubiksCubeEdges.cpp.

References Factorial(), MRRank(), and set().

Referenced by rankPlayer().

◆ SetCubeColor()

void RubikEdge::SetCubeColor ( int  which,
bool  face,
const RubikEdgeState s 
) const
private

◆ UndoAction() [1/2]

void RubikEdge::UndoAction ( RubikEdgeStateArray s,
RubikEdgeAction  a 
) const
virtual

Reimplemented from SearchEnvironment< RubikEdgeState, RubikEdgeAction >.

Definition at line 244 of file RubiksCubeEdges.cpp.

References ApplyAction().

◆ UndoAction() [2/2]

void RubikEdge::UndoAction ( RubikEdgeStateBits s,
RubikEdgeAction  a 
) const
virtual

Definition at line 230 of file RubiksCubeEdges.cpp.

References ApplyAction().

◆ UndoMove()

void RubikEdge::UndoMove ( RubikEdgeState s,
RubikEdgeMove a 
)

Definition at line 216 of file RubiksCubeEdges.cpp.

References RubikEdgeMove::act, and ApplyAction().

◆ unrankPlayer()

void RubikEdge::unrankPlayer ( uint64_t  d,
RubikEdgeState s,
int  who 
)
inline

Definition at line 158 of file RubiksCubeEdges.h.

References d, and GetStateFromHash().

Member Data Documentation

◆ moves

RubikEdgeMove RubikEdge::moves[18]
private

Definition at line 199 of file RubiksCubeEdges.h.

Referenced by getMoves(), and RubikEdge().

◆ piecesToRank

int RubikEdge::piecesToRank
private

Definition at line 196 of file RubiksCubeEdges.h.

Referenced by RubikEdge().


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