Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

HexUctSearch Class Reference

Monte-Carlo search using UCT for Hex. More...

#include <HexUctSearch.hpp>

List of all members.

Public Member Functions

 HexUctSearch (SgUctThreadStateFactory *factory, int maxMoves=0)
 Constructor.
 ~HexUctSearch ()
Pure virtual functions of SgUctSearch

std::string MoveString (SgMove move) const
SgUctValue UnknownEval () const
SgUctValue InverseEval (SgUctValue eval) const
Virtual functions of SgUctSearch

void OnSearchIteration (SgUctValue gameNumber, const unsigned int threadId, const SgUctGameInfo &info)
void OnStartSearch ()
Hex-specific functions

void SetBoard (HexBoard &board)
HexBoardBoard ()
const HexBoardBoard () const
void SetSharedData (HexUctSharedData &data)
HexUctSharedDataSharedData ()
const HexUctSharedDataSharedData () const
void SaveGames (const std::string &fileName) const
void AppendGame (const std::vector< SgMove > &sequence)
 Merges last game into the tree of games.
void SaveTree (std::ostream &out, int maxDepth) const
const StoneBoardLastPositionSearched () const
 Returns the position the previous search was run on.
Hex-specific parameters

void SetKeepGames (bool enable)
 Keep a SGF tree of all games.
bool KeepGames () const
void SetLiveGfx (bool enable)
 Enable output of live graphics commands for HexGui.
bool LiveGfx () const
void SetLiveGfxInterval (int interval)
 Set interval for outputting of live graphics commands for HexGui.
int LiveGfxInterval () const
int TreeUpdateRadius () const
 Pattern-check radius to use during in-tree phase.
void SetTreeUpdateRadius (int radius)
 See TreeUpdateRadius().
int PlayoutUpdateRadius () const
 Pattern-check radius to use during playout phase.
void SetPlayoutUpdateRadius (int radius)
 See PlayoutUpdateRadius().

Protected Attributes

bool m_keepGames
bool m_liveGfx
int m_liveGfxInterval
int m_treeUpdateRadius
int m_playoutUpdateRadius
HexBoardm_brd
 Nothing is done to this board.
HexUctSharedData m_shared_data
 Data among threads.
StoneBoard m_lastPositionSearched
SgNode * m_root
SgUctValue m_nextLiveGfx

Private Member Functions

 HexUctSearch (const HexUctSearch &search)
 Not implemented.
HexUctSearchoperator= (const HexUctSearch &search)
 Not implemented.

Detailed Description

Monte-Carlo search using UCT for Hex.

Definition at line 40 of file HexUctSearch.hpp.


Constructor & Destructor Documentation

HexUctSearch::HexUctSearch ( SgUctThreadStateFactory *  factory,
int  maxMoves = 0 
)

Constructor.

Parameters:
factory Creates HexUctState instances for each thread.
maxMoves Maximum move number.

Definition at line 50 of file HexUctSearch.cpp.

HexUctSearch::~HexUctSearch (  ) 

Definition at line 79 of file HexUctSearch.cpp.

References m_root.

HexUctSearch::HexUctSearch ( const HexUctSearch search  )  [private]

Not implemented.


Member Function Documentation

void HexUctSearch::AppendGame ( const std::vector< SgMove > &  sequence  ) 

Merges last game into the tree of games.

Definition at line 87 of file HexUctSearch.cpp.

References HexSgUtil::AddMoveToNode(), HexBoard::Height(), HexAssert, m_brd, m_root, m_shared_data, HexUctSharedData::root_to_play, and HexSgUtil::SgPointToHexPoint().

Referenced by OnSearchIteration().

const HexBoard & HexUctSearch::Board (  )  const [inline]

Definition at line 211 of file HexUctSearch.hpp.

References m_brd.

HexBoard & HexUctSearch::Board (  )  [inline]

Definition at line 206 of file HexUctSearch.hpp.

References m_brd.

Referenced by HexUctState::StartSearch().

SgUctValue HexUctSearch::InverseEval ( SgUctValue  eval  )  const

Definition at line 197 of file HexUctSearch.cpp.

bool HexUctSearch::KeepGames (  )  const [inline]
See also:
SetKeepGames()

Definition at line 216 of file HexUctSearch.hpp.

References m_keepGames.

Referenced by MoHexEngine::MoHexParam().

const StoneBoard & HexUctSearch::LastPositionSearched (  )  const [inline]

Returns the position the previous search was run on.

Definition at line 282 of file HexUctSearch.hpp.

References m_lastPositionSearched.

bool HexUctSearch::LiveGfx (  )  const [inline]
See also:
SetLiveGfx()

Definition at line 221 of file HexUctSearch.hpp.

References m_liveGfx.

Referenced by MoHexPlayer::CopySettingsFrom(), and MoHexEngine::MoHexParam().

int HexUctSearch::LiveGfxInterval (  )  const [inline]
See also:
SetLiveGfxInterval()

Definition at line 226 of file HexUctSearch.hpp.

References m_liveGfxInterval.

Referenced by MoHexPlayer::CopySettingsFrom(), and MoHexEngine::MoHexParam().

std::string HexUctSearch::MoveString ( SgMove  move  )  const

Definition at line 202 of file HexUctSearch.cpp.

References HexPointUtil::ToString().

void HexUctSearch::OnSearchIteration ( SgUctValue  gameNumber,
const unsigned int  threadId,
const SgUctGameInfo &  info 
)
void HexUctSearch::OnStartSearch (  ) 
HexUctSearch& HexUctSearch::operator= ( const HexUctSearch search  )  [private]

Not implemented.

int HexUctSearch::PlayoutUpdateRadius (  )  const [inline]

Pattern-check radius to use during playout phase.

Definition at line 257 of file HexUctSearch.hpp.

References m_playoutUpdateRadius.

Referenced by MoHexPlayer::CopySettingsFrom(), HexThreadStateFactory::Create(), and MoHexEngine::MoHexParam().

void HexUctSearch::SaveGames ( const std::string &  fileName  )  const
See also:
SetKeepGames()
Exceptions:
SgException if KeepGames() was false at last invocation of StartSearch()

Definition at line 150 of file HexUctSearch.cpp.

References HexBoard::Height(), m_brd, m_root, and HexSgUtil::WriteSgf().

Referenced by MoHexEngine::SaveGames().

void HexUctSearch::SaveTree ( std::ostream &  out,
int  maxDepth 
) const
void HexUctSearch::SetBoard ( HexBoard board  )  [inline]

Definition at line 201 of file HexUctSearch.hpp.

References m_brd.

Referenced by MoHexPlayer::Search().

void HexUctSearch::SetKeepGames ( bool  enable  )  [inline]

Keep a SGF tree of all games.

Games are cleared in each OnStartSearch(). Games can be saved with SaveGames().

Definition at line 231 of file HexUctSearch.hpp.

References m_keepGames.

Referenced by MoHexEngine::MoHexParam().

void HexUctSearch::SetLiveGfx ( bool  enable  )  [inline]

Enable output of live graphics commands for HexGui.

See also:
GoGuiGfx(), SetLiveGfxInterval()

Definition at line 236 of file HexUctSearch.hpp.

References m_liveGfx.

Referenced by MoHexPlayer::CopySettingsFrom(), and MoHexEngine::MoHexParam().

void HexUctSearch::SetLiveGfxInterval ( int  interval  )  [inline]

Set interval for outputting of live graphics commands for HexGui.

See also:
SetLiveGfx()

Definition at line 241 of file HexUctSearch.hpp.

References m_liveGfxInterval.

Referenced by MoHexPlayer::CopySettingsFrom(), and MoHexEngine::MoHexParam().

void HexUctSearch::SetPlayoutUpdateRadius ( int  radius  )  [inline]
void HexUctSearch::SetSharedData ( HexUctSharedData data  )  [inline]

Definition at line 267 of file HexUctSearch.hpp.

References m_shared_data.

Referenced by MoHexPlayer::Search().

void HexUctSearch::SetTreeUpdateRadius ( int  radius  )  [inline]
const HexUctSharedData & HexUctSearch::SharedData (  )  const [inline]

Definition at line 277 of file HexUctSearch.hpp.

References m_shared_data.

HexUctSharedData & HexUctSearch::SharedData (  )  [inline]

Definition at line 272 of file HexUctSearch.hpp.

References m_shared_data.

Referenced by MoHexPlayer::Search(), and HexUctState::StartSearch().

int HexUctSearch::TreeUpdateRadius (  )  const [inline]

Pattern-check radius to use during in-tree phase.

Definition at line 247 of file HexUctSearch.hpp.

References m_treeUpdateRadius.

Referenced by MoHexPlayer::CopySettingsFrom(), HexThreadStateFactory::Create(), MoHexEngine::MoHexParam(), and MoHexPlayer::Search().

SgUctValue HexUctSearch::UnknownEval (  )  const

Definition at line 190 of file HexUctSearch.cpp.


Member Data Documentation

Nothing is done to this board.

We do not own this pointer. Threads will synchronise with this board at the start of the search.

Definition at line 176 of file HexUctSearch.hpp.

Referenced by AppendGame(), Board(), OnStartSearch(), SaveGames(), and SetBoard().

bool HexUctSearch::m_keepGames [protected]
See also:
SetKeepGames()

Definition at line 157 of file HexUctSearch.hpp.

Referenced by KeepGames(), OnStartSearch(), and SetKeepGames().

Definition at line 181 of file HexUctSearch.hpp.

Referenced by LastPositionSearched(), OnStartSearch(), and SaveTree().

bool HexUctSearch::m_liveGfx [protected]
See also:
SetLiveGfx()

Definition at line 160 of file HexUctSearch.hpp.

Referenced by LiveGfx(), OnSearchIteration(), and SetLiveGfx().

SgUctValue HexUctSearch::m_nextLiveGfx [protected]

Definition at line 190 of file HexUctSearch.hpp.

Referenced by OnSearchIteration(), and OnStartSearch().

See also:
PlayoutUpdateRadius()

Definition at line 169 of file HexUctSearch.hpp.

Referenced by PlayoutUpdateRadius(), and SetPlayoutUpdateRadius().

SgNode* HexUctSearch::m_root [protected]
See also:
SetKeepGames(). Should be non-null only if KeepGames() is true.

Definition at line 188 of file HexUctSearch.hpp.

Referenced by AppendGame(), OnSearchIteration(), OnStartSearch(), SaveGames(), and ~HexUctSearch().

Data among threads.

Definition at line 179 of file HexUctSearch.hpp.

Referenced by AppendGame(), OnSearchIteration(), OnStartSearch(), SaveTree(), SetSharedData(), and SharedData().

See also:
TreeUpdateRadius()

Definition at line 166 of file HexUctSearch.hpp.

Referenced by SetTreeUpdateRadius(), and TreeUpdateRadius().


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


6 Jan 2011 Doxygen 1.6.3