#include <GoUctSearch.h>
Inheritance diagram for GoUctSearch:

Definition at line 154 of file GoUctSearch.h.
Public Member Functions | ||||
| GoUctSearch (GoBoard &bd, SgUctThreadStateFactory *factory) | ||||
| Constructor. | ||||
| ~GoUctSearch () | ||||
| void | SetThreadStateFactory (SgUctThreadStateFactory *factory) | |||
| SgUctThreadState & | ThreadState (int i) const | |||
| bool | ThreadsCreated () const | |||
| void | CreateThreads () | |||
| virtual float | UnknownEval () const =0 | |||
| virtual void | OnEndSearch () | |||
| virtual void | OnThreadStartSearch (SgUctThreadState &state) | |||
| virtual void | OnThreadEndSearch (SgUctThreadState &state) | |||
| virtual std::size_t | GamesPlayed () const | |||
| void | GenerateAllMoves (std::vector< SgMoveInfo > &moves) | |||
| void | PlayGame () | |||
| void | StartSearch (const std::vector< SgMove > &rootFilter=std::vector< SgMove >(), SgUctTree *initTree=0) | |||
| void | EndSearch () | |||
| float | Search (std::size_t maxGames, double maxTime, std::vector< SgMove > &sequence, const std::vector< SgMove > &rootFilter=std::vector< SgMove >(), SgUctTree *initTree=0, SgUctEarlyAbortParam *earlyAbort=0) | |||
| SgPoint | SearchOnePly (size_t maxGames, double maxTime, float &value) | |||
| const SgUctNode * | FindBestChild (const SgUctNode &node, const std::vector< SgMove > *excludeMoves=0) const | |||
| void | FindBestSequence (std::vector< SgMove > &sequence) const | |||
| float | GetBound (bool useRave, const SgUctNode &node, const SgUctNode &child) const | |||
| const SgUctGameInfo & | LastGameInfo () const | |||
| std::string | LastGameSummaryLine () const | |||
| bool | WasEarlyAbort () const | |||
| const SgUctTree & | Tree () const | |||
| SgUctTree & | GetTempTree () | |||
| float | BiasTermConstant () const | |||
| void | SetBiasTermConstant (float biasTermConstant) | |||
| std::vector< std::size_t > | KnowledgeThreshold () const | |||
| void | SetKnowledgeThreshold (const std::vector< std::size_t > &counts) | |||
| std::size_t | MaxNodes () const | |||
| void | SetMaxNodes (std::size_t maxNodes) | |||
| std::size_t | NumberThreads () const | |||
| void | SetNumberThreads (std::size_t n) | |||
| bool | LockFree () const | |||
| void | SetLockFree (bool enable) | |||
| int | RandomizeRaveFrequency () const | |||
| void | SetRandomizeRaveFrequency (int frequency) | |||
| bool | RaveCheckSame () const | |||
| void | SetRaveCheckSame (bool enable) | |||
| float | FirstPlayUrgency () const | |||
| void | SetFirstPlayUrgency (float firstPlayUrgency) | |||
| bool | LogGames () const | |||
| void | SetLogGames (bool enable) | |||
| std::size_t | MaxGameLength () const | |||
| void | SetMaxGameLength (std::size_t maxGameLength) | |||
| std::size_t | ExpandThreshold () const | |||
| void | SetExpandThreshold (std::size_t 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) | |||
| std::size_t | PruneMinCount () const | |||
| void | SetPruneMinCount (std::size_t n) | |||
| void | SetMpiSynchronizer (const SgMpiSynchronizerHandle &synchronizerHandle) | |||
| SgMpiSynchronizerHandle | MpiSynchronizer () | |||
| const SgMpiSynchronizerHandle | MpiSynchronizer () const | |||
| const SgUctSearchStat & | Statistics () 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 (std::size_t gameNumber, int threadId, const SgUctGameInfo &info) | |||
| void | OnStartSearch () | |||
Go-specific functions | ||||
| GoBoard & | Board () | |||
| const GoBoard & | Board () 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 GoBoardHistory & | BoardHistory () 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(). | ||||
| int | LiveGfxInterval () const | |||
| Interval for outputting of live graphics commands for GoGui. | ||||
| void | SetLiveGfxInterval (int interval) | |||
| See LiveGfxInterval(). | ||||
Static Public Member Functions | ||||
| static float | InverseEval (float eval) | |||
Private Member Functions | ||||
| GoUctSearch (const GoUctSearch &search) | ||||
| Not implemented. | ||||
| GoUctSearch & | operator= (const GoUctSearch &search) | |||
| Not implemented. | ||||
Private Attributes | ||||
| bool | m_keepGames | |||
| See SetKeepGames(). | ||||
| int | m_liveGfxInterval | |||
| See SetLiveGfxInterval(). | ||||
| SgBlackWhite | m_toPlay | |||
| Color to play. | ||||
| SgBWSet | m_stones | |||
| Stones of position that the current search tree belongs to. | ||||
| GoBoard & | m_bd | |||
| SgNode * | m_root | |||
| See SetKeepGames(). | ||||
| GoUctLiveGfx | m_liveGfx | |||
| GoBoardHistory | m_boardHistory | |||
| GoUctSearch::GoUctSearch | ( | GoBoard & | bd, | |
| SgUctThreadStateFactory * | factory | |||
| ) |
Constructor.
| bd | The board | |
| factory |
Definition at line 173 of file GoUctSearch.cpp.
References SgUctSearch::SetRaveCheckSame().
| GoUctSearch::~GoUctSearch | ( | ) |
| GoUctSearch::GoUctSearch | ( | const GoUctSearch & | search | ) | [private] |
Not implemented.
| const GoBoard & GoUctSearch::Board | ( | ) | const |
| GoBoard & GoUctSearch::Board | ( | ) |
Definition at line 284 of file GoUctSearch.h.
References m_bd.
Referenced by GoUctEstimatorStat::Compute(), GoUctGlobalSearchStateFactory< POLICY, FACTORY >::Create(), GoUctGlobalSearch< POLICY, FACTORY >::OnSearchIteration(), GoUctGlobalSearch< POLICY, FACTORY >::OnStartSearch(), and GoUctSearchUtil::TrompTaylorPassCheck().
| const GoBoardHistory & GoUctSearch::BoardHistory | ( | ) | const |
Identifier for the position the last search was performed on.
Definition at line 294 of file GoUctSearch.h.
References m_boardHistory.
| 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 299 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].
Definition at line 304 of file GoUctSearch.h.
References m_liveGfx.
Referenced by GoUctCommands::CmdParamSearch().
| int GoUctSearch::LiveGfxInterval | ( | ) | const |
Interval for outputting of live graphics commands for GoGui.
Default is every 5000 games.
Definition at line 309 of file GoUctSearch.h.
References m_liveGfxInterval.
Referenced by GoUctCommands::CmdParamSearch(), and GoUctGlobalSearch< POLICY, FACTORY >::OnSearchIteration().
| std::string GoUctSearch::MoveString | ( | SgMove | move | ) | const [virtual] |
Implements SgUctSearch.
Definition at line 192 of file GoUctSearch.cpp.
References SgPointUtil::PointToString().
| void GoUctSearch::OnSearchIteration | ( | std::size_t | gameNumber, | |
| int | threadId, | |||
| const SgUctGameInfo & | info | |||
| ) | [virtual] |
Reimplemented from SgUctSearch.
Reimplemented in GoUctGlobalSearch< POLICY, FACTORY >.
Definition at line 197 of file GoUctSearch.cpp.
References AppendGame(), GoUctUtil::GfxBestMove(), GoUctUtil::GfxCounts(), GoUctUtil::GfxMoveValues(), GoUctUtil::GfxSequence(), GoUctUtil::GfxStatus(), GOUCT_LIVEGFX_COUNTS, GOUCT_LIVEGFX_NONE, GOUCT_LIVEGFX_SEQUENCE, SgUctSearch::LockFree(), m_liveGfx, m_liveGfxInterval, m_root, m_toPlay, SgUctSearch::OnSearchIteration(), SG_ASSERT, SgDebug(), and SgUctSearch::Tree().
Referenced by GoUctGlobalSearch< POLICY, FACTORY >::OnSearchIteration().
| void GoUctSearch::OnStartSearch | ( | ) | [virtual] |
Reimplemented from SgUctSearch.
Reimplemented in GoUctGlobalSearch< POLICY, FACTORY >.
Definition at line 228 of file GoUctSearch.cpp.
References GoBoard::All(), GoNodeUtil::CreateRoot(), SgNode::DeleteTree(), GO_MAX_NUM_MOVES, SgUctSearch::LockFree(), m_bd, m_boardHistory, m_keepGames, m_root, m_stones, m_toPlay, GoBoard::MoveNumber(), SgUctSearch::OnStartSearch(), GoBoardHistory::SetFromBoard(), SgUctSearch::SetMaxGameLength(), SgWarning(), GoBoard::Size(), and GoBoard::ToPlay().
Referenced by GoUctGlobalSearch< POLICY, FACTORY >::OnStartSearch().
| GoUctSearch& GoUctSearch::operator= | ( | const GoUctSearch & | search | ) | [private] |
Not implemented.
| void GoUctSearch::SaveGames | ( | const std::string & | fileName | ) | const |
See SetKeepGames()
| SgException | if KeepGames() was false at last invocation of StartSearch(). |
Definition at line 256 of file GoUctSearch.cpp.
References m_root, and SgUctSearch::MpiSynchronizer().
Referenced by GoUctCommands::CmdSaveGames().
| void GoUctSearch::SaveTree | ( | std::ostream & | out, | |
| int | maxDepth = -1 | |||
| ) | const |
Definition at line 268 of file GoUctSearch.cpp.
References m_bd, m_stones, m_toPlay, GoUctUtil::SaveTree(), GoBoard::Size(), and SgUctSearch::Tree().
Referenced by GoUctCommands::CmdSaveTree().
| void GoUctSearch::SetKeepGames | ( | bool | enable | ) |
See KeepGames().
Definition at line 314 of file GoUctSearch.h.
References m_keepGames.
Referenced by GoUctCommands::CmdParamSearch().
| void GoUctSearch::SetLiveGfx | ( | GoUctLiveGfx | mode | ) |
See LiveGfx().
Definition at line 319 of file GoUctSearch.h.
References m_liveGfx.
Referenced by GoUctCommands::CmdParamSearch().
| void GoUctSearch::SetLiveGfxInterval | ( | int | interval | ) |
See LiveGfxInterval().
Definition at line 324 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 330 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 274 of file GoUctSearch.cpp.
References m_toPlay.
Referenced by GoUctCommands::CmdGfx(), GoUctGlobalSearch< POLICY, FACTORY >::OnSearchIteration(), and GoUctSearchUtil::TrompTaylorPassCheck().
GoBoard& GoUctSearch::m_bd [private] |
Definition at line 268 of file GoUctSearch.h.
Referenced by Board(), OnStartSearch(), SaveTree(), and SetToPlay().
GoBoardHistory GoUctSearch::m_boardHistory [private] |
bool GoUctSearch::m_keepGames [private] |
See SetKeepGames().
Definition at line 249 of file GoUctSearch.h.
Referenced by KeepGames(), OnStartSearch(), and SetKeepGames().
GoUctLiveGfx GoUctSearch::m_liveGfx [private] |
Definition at line 273 of file GoUctSearch.h.
Referenced by LiveGfx(), OnSearchIteration(), and SetLiveGfx().
int GoUctSearch::m_liveGfxInterval [private] |
See SetLiveGfxInterval().
Definition at line 252 of file GoUctSearch.h.
Referenced by LiveGfxInterval(), OnSearchIteration(), and SetLiveGfxInterval().
SgNode* GoUctSearch::m_root [private] |
See SetKeepGames().
Definition at line 271 of file GoUctSearch.h.
Referenced by OnSearchIteration(), OnStartSearch(), SaveGames(), and ~GoUctSearch().
SgBWSet GoUctSearch::m_stones [private] |
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 266 of file GoUctSearch.h.
Referenced by OnStartSearch(), and SaveTree().
SgBlackWhite GoUctSearch::m_toPlay [private] |
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 260 of file GoUctSearch.h.
Referenced by OnSearchIteration(), OnStartSearch(), SaveTree(), SetToPlay(), and ToPlay().