Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

HexUctState Class Reference

Thread state for HexUctSearch. More...

#include <HexUctState.hpp>

List of all members.

Classes

class  AssertionHandler
 Assertion handler to dump the state of a HexUctState. More...

Public Member Functions

 HexUctState (const unsigned int threadId, HexUctSearch &sch, int treeUpdateRadius, int playoutUpdateRadius)
 Constructor.
virtual ~HexUctState ()
const StoneBoardBoard () const
const PatternStateGetPatternState () const
HexUctSearchPolicyPolicy ()
bool IsInPlayout () const
std::string Dump () const
void SetPolicy (HexUctSearchPolicy *policy)
 Sets policy (takes control of pointer) and deletes the old one, if it existed.
HexPoint GetLastMovePlayed () const
HexColor GetColorToPlay () const
Pure virtual functions of SgUctThreadState

SgUctValue Evaluate ()
void Execute (SgMove move)
void ExecutePlayout (SgMove move)
bool GenerateAllMoves (SgUctValue count, std::vector< SgMoveInfo > &moves, SgProvenNodeType &provenType)
SgMove GeneratePlayoutMove (bool &skipRaveUpdate)
void StartSearch ()
void TakeBackInTree (std::size_t nuMoves)
void TakeBackPlayout (std::size_t nuMoves)
SgBlackWhite ToPlay () const
Virtual functions of SgUctThreadState

void GameStart ()
void StartPlayouts ()
virtual void StartPlayout ()
virtual void EndPlayout ()

Private Member Functions

bitset_t ComputeKnowledge (SgProvenNodeType &provenType)
 Computes moves to consider and stores fillin in the shared data.
void ExecuteTreeMove (HexPoint move)
void ExecuteRolloutMove (HexPoint move)
void ExecutePlainMove (HexPoint cell, int updateRadius)

Private Attributes

AssertionHandler m_assertionHandler
boost::scoped_ptr< StoneBoardm_bd
boost::scoped_ptr< PatternStatem_pastate
 Board used during search.
boost::scoped_ptr< HexBoardm_vc_brd
 Board used to compute knowledge.
boost::scoped_ptr
< HexUctSearchPolicy
m_policy
 Playout policy.
HexUctSharedDatam_shared_data
 Data shared between threads.
HexUctKnowledge m_knowledge
HexUctSearchm_search
 Parent search object.
HexColor m_toPlay
 Color to play next.
int m_treeUpdateRadius
 See HexUctSearch::TreeUpdateRadius().
int m_playoutUpdateRadius
 See HexUctSearch::PlayoutUpdateRadius().
bool m_isInPlayout
 True if in playout phase.
MoveSequence m_game_sequence
 Moves played the game plus moves in tree.
HexPoint m_lastMovePlayed
 Keeps track of last playout move made.
bool m_new_game
 True at the start of a game until the first move is played.

Detailed Description

Thread state for HexUctSearch.

Definition at line 127 of file HexUctState.hpp.


Constructor & Destructor Documentation

HexUctState::HexUctState ( const unsigned int  threadId,
HexUctSearch sch,
int  treeUpdateRadius,
int  playoutUpdateRadius 
)

Constructor.

Parameters:
threadId The number of the thread. Needed for passing to constructor of SgUctThreadState.
sch Parent Search object.
treeUpdateRadius Pattern matching radius in tree.
playoutUpdateRadius Pattern matching radius in playouts.

Definition at line 88 of file HexUctState.cpp.

HexUctState::~HexUctState (  )  [virtual]

Definition at line 107 of file HexUctState.cpp.


Member Function Documentation

const StoneBoard & HexUctState::Board (  )  const [inline]

Definition at line 273 of file HexUctState.hpp.

References m_bd.

bitset_t HexUctState::ComputeKnowledge ( SgProvenNodeType &  provenType  )  [private]
std::string HexUctState::Dump (  )  const

Definition at line 116 of file HexUctState.cpp.

References m_bd, and m_isInPlayout.

Referenced by HexUctState::AssertionHandler::Run().

void HexUctState::EndPlayout (  )  [virtual]

Definition at line 332 of file HexUctState.cpp.

SgUctValue HexUctState::Evaluate (  ) 

Definition at line 126 of file HexUctState.cpp.

References m_bd, and m_toPlay.

void HexUctState::Execute ( SgMove  move  ) 

Definition at line 133 of file HexUctState.cpp.

References ExecuteTreeMove(), and m_toPlay.

void HexUctState::ExecutePlainMove ( HexPoint  cell,
int  updateRadius 
) [private]

Definition at line 172 of file HexUctState.cpp.

References m_bd, m_lastMovePlayed, m_new_game, m_pastate, and m_toPlay.

Referenced by ExecuteRolloutMove(), and ExecuteTreeMove().

void HexUctState::ExecutePlayout ( SgMove  move  ) 

Definition at line 139 of file HexUctState.cpp.

References ExecuteRolloutMove(), and m_toPlay.

void HexUctState::ExecuteRolloutMove ( HexPoint  move  )  [private]

Definition at line 167 of file HexUctState.cpp.

References ExecutePlainMove(), and m_playoutUpdateRadius.

Referenced by ExecutePlayout().

void HexUctState::ExecuteTreeMove ( HexPoint  move  )  [private]
void HexUctState::GameStart (  ) 
bool HexUctState::GenerateAllMoves ( SgUctValue  count,
std::vector< SgMoveInfo > &  moves,
SgProvenNodeType &  provenType 
)
SgMove HexUctState::GeneratePlayoutMove ( bool &  skipRaveUpdate  ) 

Definition at line 247 of file HexUctState.cpp.

References m_bd, m_lastMovePlayed, m_pastate, m_policy, and m_toPlay.

HexColor HexUctState::GetColorToPlay (  )  const [inline]

Definition at line 298 of file HexUctState.hpp.

References m_toPlay.

HexPoint HexUctState::GetLastMovePlayed (  )  const [inline]

Definition at line 293 of file HexUctState.hpp.

References m_lastMovePlayed.

const PatternState & HexUctState::GetPatternState (  )  const [inline]

Definition at line 278 of file HexUctState.hpp.

References m_pastate.

bool HexUctState::IsInPlayout (  )  const [inline]

Definition at line 288 of file HexUctState.hpp.

References m_isInPlayout.

HexUctSearchPolicy * HexUctState::Policy (  )  [inline]

Definition at line 283 of file HexUctState.hpp.

References m_policy.

void HexUctState::SetPolicy ( HexUctSearchPolicy policy  ) 

Sets policy (takes control of pointer) and deletes the old one, if it existed.

Definition at line 111 of file HexUctState.cpp.

References m_policy.

Referenced by HexThreadStateFactory::Create().

void HexUctState::StartPlayout (  )  [virtual]

Definition at line 327 of file HexUctState.cpp.

References m_bd, and m_policy.

void HexUctState::StartPlayouts (  ) 

Playout radius should normally be no bigger than tree radius, but if it is, we need to do an extra update for each playout during the transition from the tree phase to the playout phase.

Definition at line 314 of file HexUctState.cpp.

References m_isInPlayout, m_pastate, m_playoutUpdateRadius, and m_treeUpdateRadius.

void HexUctState::StartSearch (  ) 
void HexUctState::TakeBackInTree ( std::size_t  nuMoves  ) 

Definition at line 283 of file HexUctState.cpp.

void HexUctState::TakeBackPlayout ( std::size_t  nuMoves  ) 

Definition at line 288 of file HexUctState.cpp.

SgBlackWhite HexUctState::ToPlay (  )  const

Definition at line 293 of file HexUctState.cpp.

References m_toPlay, and HexUctUtil::ToSgBlackWhite().


Member Data Documentation

Definition at line 218 of file HexUctState.hpp.

boost::scoped_ptr<StoneBoard> HexUctState::m_bd [private]

Moves played the game plus moves in tree.

Definition at line 252 of file HexUctState.hpp.

Referenced by ComputeKnowledge(), ExecuteTreeMove(), GameStart(), and GenerateAllMoves().

True if in playout phase.

Definition at line 249 of file HexUctState.hpp.

Referenced by Dump(), GameStart(), IsInPlayout(), and StartPlayouts().

Definition at line 234 of file HexUctState.hpp.

Referenced by GenerateAllMoves().

Keeps track of last playout move made.

Used for pattern-generated rollouts when call HexUctSearchPolicy.

Definition at line 257 of file HexUctState.hpp.

Referenced by ExecutePlainMove(), ExecuteTreeMove(), GameStart(), GeneratePlayoutMove(), and GetLastMovePlayed().

bool HexUctState::m_new_game [private]

True at the start of a game until the first move is played.

Definition at line 260 of file HexUctState.hpp.

Referenced by ExecutePlainMove(), GameStart(), and GenerateAllMoves().

boost::scoped_ptr<PatternState> HexUctState::m_pastate [private]

Board used during search.

Definition at line 223 of file HexUctState.hpp.

Referenced by ExecutePlainMove(), ExecuteTreeMove(), GameStart(), GeneratePlayoutMove(), GetPatternState(), StartPlayouts(), and StartSearch().

See HexUctSearch::PlayoutUpdateRadius().

Definition at line 246 of file HexUctState.hpp.

Referenced by ExecuteRolloutMove(), and StartPlayouts().

boost::scoped_ptr<HexUctSearchPolicy> HexUctState::m_policy [private]

Playout policy.

Definition at line 229 of file HexUctState.hpp.

Referenced by ExecuteTreeMove(), GeneratePlayoutMove(), Policy(), SetPolicy(), StartPlayout(), and StartSearch().

Parent search object.

Definition at line 237 of file HexUctState.hpp.

Referenced by StartSearch().

Data shared between threads.

Definition at line 232 of file HexUctState.hpp.

Referenced by ComputeKnowledge(), ExecuteTreeMove(), GameStart(), GenerateAllMoves(), and StartSearch().

boost::scoped_ptr<HexBoard> HexUctState::m_vc_brd [private]

Board used to compute knowledge.

Definition at line 226 of file HexUctState.hpp.

Referenced by ComputeKnowledge(), and StartSearch().


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


6 Jan 2011 Doxygen 1.6.3