HOG2
Public Member Functions | List of all members
NQueens Class Reference

#include <NQueens.h>

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

Public Member Functions

 NQueens ()
 
 ~NQueens ()
 
virtual void GetSuccessors (const NQueenState &nodeID, std::vector< NQueenState > &neighbors) const
 
virtual void GetActions (const NQueenState &nodeID, std::vector< NQueenAction > &actions) const
 
virtual NQueenAction GetAction (const NQueenState &s1, const NQueenState &s2) const
 
virtual void ApplyAction (NQueenState &s, NQueenAction a) const
 
virtual void GetNextState (const NQueenState &, NQueenAction, NQueenState &) const
 
virtual bool InvertAction (NQueenAction &a) const
 
virtual double HCost (const NQueenState &node1, const NQueenState &node2) const
 Heuristic value between two arbitrary nodes. More...
 
virtual double HCost (const NQueenState &node) const
 Heuristic value between node and the stored goal. More...
 
virtual double GCost (const NQueenState &node1, const NQueenState &node2) const
 
virtual double GCost (const NQueenState &node, const NQueenAction &act) const
 
virtual bool GoalTest (const NQueenState &node, const NQueenState &goal) const
 
virtual bool GoalTest (const NQueenState &node) const
 Goal Test if the goal is stored. More...
 
virtual uint64_t GetStateHash (const NQueenState &node) const
 
virtual uint64_t GetActionHash (NQueenAction act) const
 
int NumCollisions (const NQueenState &node) const
 
int NumCollisions (const NQueenState &node, int row) const
 
int NumCollisions (const NQueenState &node, int row, int column) const
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const NQueenState &) const
 
virtual void OpenGLDraw (const NQueenState &, const NQueenState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void OpenGLDraw (const NQueenState &, const NQueenAction &) const
 
void GLLabelState (const NQueenState &s, int x, int y, int number) const
 
void OpenGLDrawBackground (float r, float g, float b)
 
void OpenGLDrawBackground (const NQueenState &, float r, float g, float b, int firstRow, int lastRow)
 
void OpenGLDrawConflicts (const NQueenState &s) const
 
- Public Member Functions inherited from SearchEnvironment< NQueenState, NQueenAction >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const NQueenState &stateID) const
 
virtual void UndoAction (NQueenState &s, NQueenAction a) const
 
virtual void StoreGoal (NQueenState &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 NQueenState &node1, const NQueenState &node2, double parentHCost) const
 
virtual uint64_t GetMaxHash () const
 
virtual void GetStateFromHash (uint64_t parent, NQueenState &s) const
 
virtual double GetPathLength (std::vector< NQueenState > &neighbors)
 
virtual double GetPathLength (const NQueenState &start, std::vector< NQueenAction > &neighbors)
 
virtual OccupancyInterface< NQueenState, NQueenAction > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< NQueenState, NQueenAction > *)
 
virtual void OpenGLDraw () const
 
virtual void GLLabelState (const NQueenState &, const char *) const
 
virtual void GLDrawLine (const NQueenState &x, const NQueenState &y) const
 
virtual void GLDrawPath (const std::vector< NQueenState > &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 NQueenState &) const
 
virtual void DrawLine (Graphics::Display &display, const NQueenState &x, const NQueenState &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< NQueenState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 52 of file NQueens.h.

Constructor & Destructor Documentation

◆ NQueens()

NQueens::NQueens ( )
inline

Definition at line 55 of file NQueens.h.

◆ ~NQueens()

NQueens::~NQueens ( )
inline

Definition at line 56 of file NQueens.h.

Member Function Documentation

◆ ApplyAction()

void NQueens::ApplyAction ( NQueenState s,
NQueenAction  a 
) const
virtual

◆ GCost() [1/2]

virtual double NQueens::GCost ( const NQueenState node,
const NQueenAction act 
) const
inlinevirtual

Implements SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 76 of file NQueens.h.

◆ GCost() [2/2]

virtual double NQueens::GCost ( const NQueenState node1,
const NQueenState node2 
) const
inlinevirtual

Implements SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 75 of file NQueens.h.

◆ GetAction()

NQueenAction NQueens::GetAction ( const NQueenState s1,
const NQueenState s2 
) const
virtual

Reimplemented from SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 35 of file NQueens.cpp.

◆ GetActionHash()

virtual uint64_t NQueens::GetActionHash ( NQueenAction  act) const
inlinevirtual

Implements SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 83 of file NQueens.h.

◆ GetActions()

void NQueens::GetActions ( const NQueenState nodeID,
std::vector< NQueenAction > &  actions 
) const
virtual

◆ GetNextState()

void NQueens::GetNextState ( const NQueenState s,
NQueenAction  a,
NQueenState s2 
) const
virtual

Reimplemented from SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 47 of file NQueens.cpp.

References ApplyAction().

◆ GetStateHash()

virtual uint64_t NQueens::GetStateHash ( const NQueenState node) const
inlinevirtual

Implements SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 82 of file NQueens.h.

◆ GetSuccessors()

void NQueens::GetSuccessors ( const NQueenState nodeID,
std::vector< NQueenState > &  neighbors 
) const
virtual

Implements SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 12 of file NQueens.cpp.

◆ GLLabelState()

void NQueens::GLLabelState ( const NQueenState s,
int  x,
int  y,
int  number 
) const

Definition at line 343 of file NQueens.cpp.

References NQueenState::locs.

Referenced by OpenGLDrawConflicts().

◆ GoalTest() [1/2]

bool NQueens::GoalTest ( const NQueenState node) const
virtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 54 of file NQueens.cpp.

◆ GoalTest() [2/2]

virtual bool NQueens::GoalTest ( const NQueenState node,
const NQueenState goal 
) const
inlinevirtual

Implements SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 77 of file NQueens.h.

References GoalTest().

Referenced by GoalTest().

◆ HCost() [1/2]

virtual double NQueens::HCost ( const NQueenState node) const
inlinevirtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 72 of file NQueens.h.

◆ HCost() [2/2]

virtual double NQueens::HCost ( const NQueenState node1,
const NQueenState node2 
) const
inlinevirtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 68 of file NQueens.h.

◆ InvertAction()

virtual bool NQueens::InvertAction ( NQueenAction a) const
inlinevirtual

Implements SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 65 of file NQueens.h.

◆ NumCollisions() [1/3]

int NQueens::NumCollisions ( const NQueenState node) const

Definition at line 172 of file NQueens.cpp.

Referenced by OpenGLDraw(), and OpenGLDrawConflicts().

◆ NumCollisions() [2/3]

int NQueens::NumCollisions ( const NQueenState node,
int  row 
) const

Definition at line 131 of file NQueens.cpp.

◆ NumCollisions() [3/3]

int NQueens::NumCollisions ( const NQueenState node,
int  row,
int  column 
) const

Definition at line 89 of file NQueens.cpp.

◆ OpenGLDraw() [1/4]

void NQueens::OpenGLDraw ( ) const
virtual

Definition at line 211 of file NQueens.cpp.

◆ OpenGLDraw() [2/4]

void NQueens::OpenGLDraw ( const NQueenState s) const
virtual

Reimplemented from SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 241 of file NQueens.cpp.

References NQueenState::locs, and NumCollisions().

◆ OpenGLDraw() [3/4]

void NQueens::OpenGLDraw ( const NQueenState ,
const NQueenAction  
) const
virtual

Reimplemented from SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 379 of file NQueens.cpp.

◆ OpenGLDraw() [4/4]

void NQueens::OpenGLDraw ( const NQueenState ,
const NQueenState ,
float   
) const
virtual

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

Reimplemented from SearchEnvironment< NQueenState, NQueenAction >.

Definition at line 374 of file NQueens.cpp.

◆ OpenGLDrawBackground() [1/2]

void NQueens::OpenGLDrawBackground ( const NQueenState s,
float  r,
float  g,
float  b,
int  firstRow,
int  lastRow 
)

Definition at line 227 of file NQueens.cpp.

References NQueenState::locs.

◆ OpenGLDrawBackground() [2/2]

void NQueens::OpenGLDrawBackground ( float  r,
float  g,
float  b 
)

Definition at line 216 of file NQueens.cpp.

◆ OpenGLDrawConflicts()

void NQueens::OpenGLDrawConflicts ( const NQueenState s) const

Definition at line 325 of file NQueens.cpp.

References GLLabelState(), NQueenState::locs, and NumCollisions().


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