Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

GoUctSearch Class Reference

Base class for UCT searches in Go. More...

#include <GoUctSearch.h>

Inheritance diagram for GoUctSearch:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GoUctSearch (GoBoard &bd, SgUctThreadStateFactory *factory)
 Constructor.
 ~GoUctSearch ()
void SetThreadStateFactory (SgUctThreadStateFactory *factory)
SgUctThreadStateThreadState (int i) const
bool ThreadsCreated () const
void CreateThreads ()
virtual SgUctValue UnknownEval () const =0
virtual void OnEndSearch ()
virtual void OnThreadStartSearch (SgUctThreadState &state)
virtual void OnThreadEndSearch (SgUctThreadState &state)
virtual SgUctValue GamesPlayed () const
void GenerateAllMoves (std::vector< SgUctMoveInfo > &moves)
void PlayGame ()
void StartSearch (const std::vector< SgMove > &rootFilter=std::vector< SgMove >(), SgUctTree *initTree=0)
void EndSearch ()
SgUctValue Search (SgUctValue maxGames, double maxTime, std::vector< SgMove > &sequence, const std::vector< SgMove > &rootFilter=std::vector< SgMove >(), SgUctTree *initTree=0, SgUctEarlyAbortParam *earlyAbort=0)
SgPoint SearchOnePly (SgUctValue maxGames, double maxTime, SgUctValue &value)
const SgUctNodeFindBestChild (const SgUctNode &node, const std::vector< SgMove > *excludeMoves=0) const
void FindBestSequence (std::vector< SgMove > &sequence) const
SgUctValue GetBound (bool useRave, const SgUctNode &node, const SgUctNode &child) const
const SgUctGameInfoLastGameInfo () const
std::string LastGameSummaryLine () const
bool WasEarlyAbort () const
const SgUctTreeTree () const
SgUctTreeGetTempTree ()
float BiasTermConstant () const
void SetBiasTermConstant (float biasTermConstant)
std::vector< SgUctValueKnowledgeThreshold () const
void SetKnowledgeThreshold (const std::vector< SgUctValue > &counts)
std::size_t MaxNodes () const
void SetMaxNodes (std::size_t maxNodes)
unsigned int NumberThreads () const
void SetNumberThreads (unsigned int n)
bool LockFree () const
void SetLockFree (bool enable)
int RandomizeRaveFrequency () const
void SetRandomizeRaveFrequency (int frequency)
bool RaveCheckSame () const
void SetRaveCheckSame (bool enable)
SgUctValue FirstPlayUrgency () const
void SetFirstPlayUrgency (SgUctValue firstPlayUrgency)
bool LogGames () const
void SetLogGames (bool enable)
std::size_t MaxGameLength () const
void SetMaxGameLength (std::size_t maxGameLength)
SgUctValue ExpandThreshold () const
void SetExpandThreshold (SgUctValue expandThreshold)
std::size_t NumberPlayouts () const
void SetNumberPlayouts (std::size_t n)
bool Rave () const
void SetRave (bool enable)
SgUctMoveSelect MoveSelect () const
void SetMoveSelect (SgUctMoveSelect moveSelect)
float RaveWeightInitial () const
void SetRaveWeightInitial (float value)
float RaveWeightFinal () const
void SetRaveWeightFinal (float value)
bool WeightRaveUpdates () const
void SetWeightRaveUpdates (bool enable)
bool VirtualLoss () const
void SetVirtualLoss (bool enable)
bool PruneFullTree () const
void SetPruneFullTree (bool enable)
SgUctValue PruneMinCount () const
void SetPruneMinCount (SgUctValue n)
bool CheckFloatPrecision () const
void SetCheckFloatPrecision (bool enable)
void SetMpiSynchronizer (const SgMpiSynchronizerHandle &synchronizerHandle)
SgMpiSynchronizerHandle MpiSynchronizer ()
const SgMpiSynchronizerHandle MpiSynchronizer () const
const SgUctSearchStatStatistics () const
void WriteStatistics (std::ostream &out) const
Pure virtual functions of SgUctSearch

std::string MoveString (SgMove move) const
SgBlackWhite ToPlay () const
 Color to play at the root node of the last search.
Virtual functions of SgUctSearch

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

GoBoardBoard ()
const GoBoardBoard () const
void SaveGames (const std::string &fileName) const
 See SetKeepGames().
void SaveTree (std::ostream &out, int maxDepth=-1) const
 See GoUctUtil::SaveTree().
void SetToPlay (SgBlackWhite toPlay)
 Set initial color to play.
const GoBoardHistoryBoardHistory () const
 Identifier for the position the last search was performed on.
Go-specific parameters

bool KeepGames () const
 Keep a SGF tree of all games.
void SetKeepGames (bool enable)
 See KeepGames().
GoUctLiveGfx LiveGfx () const
 Output live graphics commands for GoGui.
void SetLiveGfx (GoUctLiveGfx mode)
 See LiveGfx().
SgUctValue LiveGfxInterval () const
 Interval for outputting of live graphics commands for GoGui.
void SetLiveGfxInterval (SgUctValue interval)
 See LiveGfxInterval().

Static Public Member Functions

static SgUctValue InverseEval (SgUctValue eval)
static SgUctValue InverseEstimate (SgUctValue eval)

Protected Member Functions

virtual void DisplayGfx ()

Private Member Functions

 GoUctSearch (const GoUctSearch &search)
 Not implemented.
GoUctSearchoperator= (const GoUctSearch &search)
 Not implemented.

Private Attributes

bool m_keepGames
 See SetKeepGames().
SgUctValue m_liveGfxInterval
 See SetLiveGfxInterval().
volatile SgUctValue m_nextLiveGfx
SgBlackWhite m_toPlay
 Color to play.
SgBWSet m_stones
 Stones of position that the current search tree belongs to.
GoBoardm_bd
SgNodem_root
 See SetKeepGames().
GoUctLiveGfx m_liveGfx
GoBoardHistory m_boardHistory

Detailed Description

Base class for UCT searches in Go.

Definition at line 149 of file GoUctSearch.h.


Constructor & Destructor Documentation

GoUctSearch::GoUctSearch ( GoBoard bd,
SgUctThreadStateFactory factory 
)

Constructor.

Parameters:
bd The board
factory 

Definition at line 172 of file GoUctSearch.cpp.

References SgUctSearch::SetRaveCheckSame(), and SG_BLACK.

GoUctSearch::~GoUctSearch (  ) 

Definition at line 184 of file GoUctSearch.cpp.

References SgNode::DeleteTree(), and m_root.

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

Not implemented.


Member Function Documentation

GoBoard & GoUctSearch::Board (  ) 
const GoBoard & GoUctSearch::Board (  )  const

Definition at line 282 of file GoUctSearch.h.

References m_bd.

const GoBoardHistory & GoUctSearch::BoardHistory (  )  const

Identifier for the position the last search was performed on.

Definition at line 287 of file GoUctSearch.h.

References m_boardHistory.

void GoUctSearch::DisplayGfx (  )  [protected, virtual]
bool GoUctSearch::KeepGames (  )  const

Keep a SGF tree of all games.

This is reset in OnStartSearch() and can be saved with SaveGames().

Definition at line 292 of file GoUctSearch.h.

References m_keepGames.

Referenced by GoUctCommands::CmdParamSearch().

GoUctLiveGfx GoUctSearch::LiveGfx (  )  const

Output live graphics commands for GoGui.

If enabled, LiveGfx commands for GoGui are outputted to the debug stream every n games. Note that GoUctUtil::GoGuiGfx() outputs values as influence data and assumes values in [0:1].

See also:
GoUctLiveGfxMode, LiveGfxInterval()

Definition at line 297 of file GoUctSearch.h.

References m_liveGfx.

Referenced by GoUctCommands::CmdParamSearch().

SgUctValue GoUctSearch::LiveGfxInterval (  )  const

Interval for outputting of live graphics commands for GoGui.

Default is every 5000 games.

See also:
LiveGfx()

Definition at line 302 of file GoUctSearch.h.

References m_liveGfxInterval.

Referenced by GoUctCommands::CmdParamSearch().

std::string GoUctSearch::MoveString ( SgMove  move  )  const [virtual]

Implements SgUctSearch.

Definition at line 191 of file GoUctSearch.cpp.

References SgPointUtil::PointToString().

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

Not implemented.

void GoUctSearch::SaveGames ( const std::string &  fileName  )  const

See SetKeepGames().

Exceptions:
SgException if KeepGames() was false at last invocation of StartSearch()

Definition at line 264 of file GoUctSearch.cpp.

References m_root, and SgUctSearch::MpiSynchronizer().

Referenced by GoUctCommands::CmdSaveGames().

void GoUctSearch::SaveTree ( std::ostream &  out,
int  maxDepth = -1 
) const
void GoUctSearch::SetKeepGames ( bool  enable  ) 

See KeepGames().

Definition at line 307 of file GoUctSearch.h.

References m_keepGames.

Referenced by GoUctCommands::CmdParamSearch().

void GoUctSearch::SetLiveGfx ( GoUctLiveGfx  mode  ) 

See LiveGfx().

Definition at line 312 of file GoUctSearch.h.

References m_liveGfx.

Referenced by GoUctCommands::CmdParamSearch().

void GoUctSearch::SetLiveGfxInterval ( SgUctValue  interval  ) 

See LiveGfxInterval().

Definition at line 317 of file GoUctSearch.h.

References m_liveGfxInterval, and SG_ASSERT.

Referenced by GoUctCommands::CmdParamSearch().

void GoUctSearch::SetToPlay ( SgBlackWhite  toPlay  ) 

Set initial color to play.

Definition at line 323 of file GoUctSearch.h.

References m_bd, m_toPlay, and GoBoard::SetToPlay().

SgBlackWhite GoUctSearch::ToPlay (  )  const

Color to play at the root node of the last search.

Definition at line 282 of file GoUctSearch.cpp.

References m_toPlay.

Referenced by GoUctCommands::CmdGfx(), GoUctGlobalSearch< POLICY, FACTORY >::DisplayGfx(), and GoUctSearchUtil::TrompTaylorPassCheck().


Member Data Documentation

Definition at line 261 of file GoUctSearch.h.

Referenced by Board(), OnStartSearch(), SaveTree(), and SetToPlay().

Definition at line 268 of file GoUctSearch.h.

Referenced by BoardHistory(), and OnStartSearch().

bool GoUctSearch::m_keepGames [private]

See SetKeepGames().

Definition at line 242 of file GoUctSearch.h.

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

Definition at line 266 of file GoUctSearch.h.

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

Definition at line 247 of file GoUctSearch.h.

Referenced by OnSearchIteration(), and OnStartSearch().

See SetKeepGames().

Definition at line 264 of file GoUctSearch.h.

Referenced by OnSearchIteration(), OnStartSearch(), SaveGames(), and ~GoUctSearch().

Stones of position that the current search tree belongs to.

Needed such that the tree can be saved even if the board has changed (e.g. after a move was generated and played).

Definition at line 259 of file GoUctSearch.h.

Referenced by OnStartSearch(), and SaveTree().

Color to play.

Does not use GoBoard::ToPlay(), because the color to play at the root node of the search could be needed after the board has changed (e.g. when saving the tree after a move was generated and played on the board).

Definition at line 254 of file GoUctSearch.h.

Referenced by DisplayGfx(), OnSearchIteration(), OnStartSearch(), SaveTree(), SetToPlay(), and ToPlay().


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


Sun Mar 13 2011 Doxygen 1.7.1