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

GoUctCommands Class Reference

GTP commands for GoUctPlayer. More...

#include <GoUctCommands.h>

List of all members.

Public Member Functions

 GoUctCommands (const GoBoard &bd, GoPlayer *&player)
 Constructor.
void AddGoGuiAnalyzeCommands (GtpCommand &cmd)
void Register (GtpEngine &engine)
Command Callbacks

void CmdBounds (GtpCommand &cmd)
 Show UCT bounds of moves in root node.
void CmdDefaultPolicy (GtpCommand &cmd)
void CmdEstimatorStat (GtpCommand &cmd)
 Compute estimator statistics.
void CmdFinalScore (GtpCommand &)
 Return final score.
void CmdFinalStatusList (GtpCommand &)
 Return final status of stones.
void CmdGfx (GtpCommand &cmd)
 Show move values and sample numbers of last search.
void CmdMaxMemory (GtpCommand &cmd)
 Computes the maximum number of nodes in search tree given the maximum allowed memory for the tree.
void CmdMoves (GtpCommand &cmd)
 Return a list of all moves that the search would generate in the current position.
void CmdParamGlobalSearch (GtpCommand &cmd)
 Get and set GoUctGlobalSearch parameters.
void CmdParamPolicy (GtpCommand &cmd)
 Get and set GoUctPlayoutPolicy parameters.
void CmdParamPlayer (GtpCommand &cmd)
 Get and set GoUctPlayer parameters.
void CmdParamRootFilter (GtpCommand &cmd)
 Get and set GoUctDefaultRootFilter parameters.
void CmdParamSearch (GtpCommand &cmd)
 Get and set SgUctSearch and GoUctSearch parameters.
void CmdPatterns (GtpCommand &cmd)
 Show matching patterns.
void CmdPolicyMoves (GtpCommand &cmd)
 Return equivalent best moves in playout policy.
void CmdPriorKnowledge (GtpCommand &cmd)
 Show prior knowledge.
void CmdRaveValues (GtpCommand &cmd)
 Show RAVE values of last search at root position.
void CmdRootFilter (GtpCommand &cmd)
 Return filtered root moves.
void CmdSaveGames (GtpCommand &cmd)
 Save all random games.
void CmdSaveTree (GtpCommand &cmd)
 Save the UCT tree in SGF format.
void CmdScore (GtpCommand &cmd)
 Count the score using the scoring function of UCT.
void CmdSequence (GtpCommand &cmd)
 Show the best sequence from last search.
void CmdStatPlayer (GtpCommand &cmd)
 Write statistics of GoUctPlayer.
void CmdStatPlayerClear (GtpCommand &cmd)
 Clear statistics of GoUctPlayer.
void CmdStatPolicy (GtpCommand &cmd)
 Write statistics of playout policy.
void CmdStatPolicyClear (GtpCommand &cmd)
 Clear statistics of GoUctPlayoutPolicy Arguments: none
Only the statistics of the first thread's policy used.
void CmdStatSearch (GtpCommand &cmd)
 Write statistics of search and tree.
void CmdStatTerritory (GtpCommand &cmd)
 Write average point status.
void CmdValue (GtpCommand &cmd)
 Return value of root node from last search.
void CmdValueBlack (GtpCommand &cmd)
 Return value of root node from last search, from Black's point of view.

Private Member Functions

SgPointSet DoFinalStatusSearch ()
 Do a small search with territory statistics enabled to determine what blocks are dead for the final_status_list and final_score commands.
GoUctGlobalSearch
< GoUctPlayoutPolicy
< GoUctBoard >
, GoUctPlayoutPolicyFactory
< GoUctBoard > > & 
GlobalSearch ()
GoUctPlayer< GoUctGlobalSearch
< GoUctPlayoutPolicy
< GoUctBoard >
, GoUctPlayoutPolicyFactory
< GoUctBoard >
>, GoUctGlobalSearchState
< GoUctPlayoutPolicy
< GoUctBoard > > > & 
Player ()
GoUctPlayoutPolicy< GoUctBoard > & Policy (unsigned int threadId)
void Register (GtpEngine &e, const std::string &command, GtpCallback< GoUctCommands >::Method method)
GoUctSearchSearch ()
GoUctGlobalSearchState
< GoUctPlayoutPolicy
< GoUctBoard > > & 
ThreadState (unsigned int threadId)
 Return state of first thread, if search is of type GoUctGlobalSearch.

Private Attributes

const GoBoardm_bd
GoPlayer *& m_player

Detailed Description

GTP commands for GoUctPlayer.

Some of the commands are also usable for other players, as long as they use a subclass of GoUctSearch (and implement GoUctObjectWithSearch).

Definition at line 24 of file GoUctCommands.h.


Constructor & Destructor Documentation

GoUctCommands::GoUctCommands ( const GoBoard bd,
GoPlayer *&  player 
)

Constructor.

Parameters:
bd The game board.
player Reference to pointer to current player, this player can be null or a different player, but those commands of this class that need a GoUctPlayer will fail, if the current player is not GoUctPlayer.

Definition at line 165 of file GoUctCommands.cpp.


Member Function Documentation

void GoUctCommands::AddGoGuiAnalyzeCommands ( GtpCommand cmd  ) 

Definition at line 171 of file GoUctCommands.cpp.

void GoUctCommands::CmdBounds ( GtpCommand cmd  ) 

Show UCT bounds of moves in root node.

This command is compatible with the GoGui analyze command type "gfx". Move bounds are shown as labels on the board, the pass move bound is shown as text in the status line.

See also:
SgUctSearch::GetBound

Definition at line 205 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), SgUctSearch::GetBound(), SgUctNode::Move(), SgUctSearch::Rave(), SgUctTree::Root(), Search(), SG_PASS, and SgUctSearch::Tree().

Referenced by Register().

void GoUctCommands::CmdDefaultPolicy ( GtpCommand cmd  ) 
void GoUctCommands::CmdEstimatorStat ( GtpCommand cmd  ) 

Compute estimator statistics.

Arguments: trueValueMaxGames maxGames stepSize fileName

See also:
GoUctEstimatorStat::Compute()

Definition at line 248 of file GoUctCommands.cpp.

References GtpCommand::Arg(), GtpCommand::CheckNuArg(), GoUctEstimatorStat::Compute(), and Search().

Referenced by Register().

void GoUctCommands::CmdFinalScore ( GtpCommand cmd  ) 

Return final score.

Does a small search and uses the territory statistics to determine the status of blocks.

Definition at line 262 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), DoFinalStatusSearch(), m_bd, GoBoardUtil::ScorePosition(), and GoUtil::ScoreToString().

Referenced by Register().

void GoUctCommands::CmdFinalStatusList ( GtpCommand cmd  ) 

Return final status of stones.

Does a small search and uses the territory statistics to determine the status of blocks. The engine cannot detect seki, so according to the GTP standard, all stones that are not dead are reported as alive, the response to seki is an empty list.
Arguments: alive|seki|dead

Definition at line 278 of file GoUctCommands.cpp.

References GtpCommand::Arg(), SgPointSet::Contains(), DoFinalStatusSearch(), and m_bd.

Referenced by Register().

void GoUctCommands::CmdGfx ( GtpCommand cmd  ) 

Show move values and sample numbers of last search.

Arguments: none

See also:
GoUctSearch::GoGuiGfx()

Definition at line 308 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), GoUctUtil::GfxBestMove(), GoUctUtil::GfxCounts(), GoUctUtil::GfxMoveValues(), GoUctUtil::GfxStatus(), Search(), GoUctSearch::ToPlay(), and SgUctSearch::Tree().

Referenced by Register().

void GoUctCommands::CmdMaxMemory ( GtpCommand cmd  ) 

Computes the maximum number of nodes in search tree given the maximum allowed memory for the tree.

Assumes two trees. Returns current memory usage if no arguments. Arguments: max memory for trees

Definition at line 323 of file GoUctCommands.cpp.

References GtpCommand::ArgMin(), GtpCommand::CheckNuArgLessEqual(), SgUctSearch::MaxNodes(), GtpCommand::NuArg(), Search(), and SgUctSearch::SetMaxNodes().

Referenced by Register().

void GoUctCommands::CmdMoves ( GtpCommand cmd  ) 

Return a list of all moves that the search would generate in the current position.

Arguments: none

See also:
SgUctSearch::GenerateAllMoves()

Definition at line 339 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), SgUctSearch::GenerateAllMoves(), and Search().

Referenced by Register().

void GoUctCommands::CmdParamGlobalSearch ( GtpCommand cmd  ) 
void GoUctCommands::CmdParamPlayer ( GtpCommand cmd  ) 

Get and set GoUctPlayer parameters.

This command is compatible with the GoGui analyze command type "param".

Parameters:

Definition at line 417 of file GoUctCommands.cpp.

References GtpCommand::Arg(), GtpCommand::ArgMin(), GtpCommand::ArgMinMax(), GoUctPlayer< SEARCH, THREAD >::AutoParam(), GtpCommand::CheckNuArgLessEqual(), GoUctPlayer< SEARCH, THREAD >::EarlyPass(), GoUctPlayer< SEARCH, THREAD >::EnablePonder(), GoUctPlayer< SEARCH, THREAD >::ForcedOpeningMoves(), GoUctPlayer< SEARCH, THREAD >::IgnoreClock(), GoUctPlayer< SEARCH, THREAD >::MaxGames(), GoUctPlayer< SEARCH, THREAD >::MaxPonderTime(), GtpCommand::NuArg(), Player(), GoUctPlayer< SEARCH, THREAD >::ResignMinGames(), GoUctPlayer< SEARCH, THREAD >::ResignThreshold(), GoUctPlayer< SEARCH, THREAD >::ReuseSubtree(), GoUctPlayer< SEARCH, THREAD >::SearchMode(), GoUctPlayer< SEARCH, THREAD >::SetAutoParam(), GoUctPlayer< SEARCH, THREAD >::SetEarlyPass(), GoUctPlayer< SEARCH, THREAD >::SetEnablePonder(), GoUctPlayer< SEARCH, THREAD >::SetForcedOpeningMoves(), GoUctPlayer< SEARCH, THREAD >::SetIgnoreClock(), GoUctPlayer< SEARCH, THREAD >::SetMaxGames(), GoUctPlayer< SEARCH, THREAD >::SetMaxPonderTime(), GoUctPlayer< SEARCH, THREAD >::SetResignMinGames(), GoUctPlayer< SEARCH, THREAD >::SetResignThreshold(), GoUctPlayer< SEARCH, THREAD >::SetReuseSubtree(), GoUctPlayer< SEARCH, THREAD >::SetSearchMode(), GoUctPlayer< SEARCH, THREAD >::SetUseRootFilter(), and GoUctPlayer< SEARCH, THREAD >::UseRootFilter().

Referenced by Register().

void GoUctCommands::CmdParamPolicy ( GtpCommand cmd  ) 
void GoUctCommands::CmdParamRootFilter ( GtpCommand cmd  ) 

Get and set GoUctDefaultRootFilter parameters.

This command is compatible with the GoGui analyze command type "param".

Parameters:

Definition at line 516 of file GoUctCommands.cpp.

References GtpCommand::Arg(), GoUctDefaultRootFilter::CheckLadders(), GtpCommand::CheckNuArgLessEqual(), GtpCommand::NuArg(), Player(), and GoUctDefaultRootFilter::SetCheckLadders().

Referenced by Register().

void GoUctCommands::CmdParamSearch ( GtpCommand cmd  ) 

Get and set SgUctSearch and GoUctSearch parameters.

This command is compatible with the GoGui analyze command type "param".

Parameters:

Definition at line 565 of file GoUctCommands.cpp.

References GtpCommand::Arg(), GtpCommand::ArgMin(), SgUctSearch::BiasTermConstant(), SgUctSearch::CheckFloatPrecision(), GtpCommand::CheckNuArgLessEqual(), SgUctSearch::ExpandThreshold(), SgUctSearch::FirstPlayUrgency(), GoUctSearch::KeepGames(), SgUctSearch::KnowledgeThreshold(), GoUctSearch::LiveGfx(), GoUctSearch::LiveGfxInterval(), SgUctSearch::LockFree(), SgUctSearch::LogGames(), SgUctSearch::MaxNodes(), SgUctSearch::MoveSelect(), GtpCommand::NuArg(), SgUctSearch::NumberPlayouts(), SgUctSearch::NumberThreads(), SgUctSearch::PruneFullTree(), SgUctSearch::PruneMinCount(), SgUctSearch::RandomizeRaveFrequency(), SgUctSearch::Rave(), SgUctSearch::RaveWeightFinal(), SgUctSearch::RaveWeightInitial(), Search(), SgUctSearch::SetBiasTermConstant(), SgUctSearch::SetCheckFloatPrecision(), SgUctSearch::SetExpandThreshold(), SgUctSearch::SetFirstPlayUrgency(), GoUctSearch::SetKeepGames(), SgUctSearch::SetKnowledgeThreshold(), GoUctSearch::SetLiveGfx(), GoUctSearch::SetLiveGfxInterval(), SgUctSearch::SetLockFree(), SgUctSearch::SetLogGames(), SgUctSearch::SetMaxNodes(), SgUctSearch::SetMoveSelect(), SgUctSearch::SetNumberPlayouts(), SgUctSearch::SetNumberThreads(), SgUctSearch::SetPruneFullTree(), SgUctSearch::SetPruneMinCount(), SgUctSearch::SetRandomizeRaveFrequency(), SgUctSearch::SetRave(), SgUctSearch::SetRaveWeightFinal(), SgUctSearch::SetRaveWeightInitial(), SgUctSearch::SetVirtualLoss(), SgUctSearch::SetWeightRaveUpdates(), SgUctSearch::VirtualLoss(), and SgUctSearch::WeightRaveUpdates().

Referenced by Register().

void GoUctCommands::CmdPatterns ( GtpCommand cmd  ) 

Show matching patterns.

Returns: List of points for matching patterns

See also:
GoUctPatterns

Definition at line 660 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), GoBoard::IsEmpty(), m_bd, and GoUctPatterns< BOARD >::MatchAny().

Referenced by Register().

void GoUctCommands::CmdPolicyMoves ( GtpCommand cmd  ) 
void GoUctCommands::CmdPriorKnowledge ( GtpCommand cmd  ) 

Show prior knowledge.

The response is compatible to the GoGui analyze command type gfx and shows the prior knowledge values as influence and the counts as labels.

Definition at line 694 of file GoUctCommands.cpp.

References GtpCommand::ArgMin(), GtpCommand::CheckNuArgLessEqual(), GoUctGlobalSearchState< POLICY >::GenerateAllMoves(), SgUctSearch::InverseEval(), m_bd, GtpCommand::NuArg(), SG_BLACK, GoUctGlobalSearchState< POLICY >::StartSearch(), ThreadState(), and GoBoard::ToPlay().

Referenced by Register().

void GoUctCommands::CmdRaveValues ( GtpCommand cmd  ) 

Show RAVE values of last search at root position.

This command is compatible to the GoGui analyze command type sboard. The values are scaled to [-1,+1] from Black's point of view.

See also:
SgUctSearch::Rave

Definition at line 736 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), SgUctNode::HasRaveValue(), m_bd, SgUctNode::Move(), SgUctSearch::Rave(), SgUctNode::RaveValue(), SgUctTree::Root(), Search(), SG_PASS, GoBoard::Size(), and SgUctSearch::Tree().

Referenced by Register().

void GoUctCommands::CmdRootFilter ( GtpCommand cmd  ) 

Return filtered root moves.

See also:
GoUctRootFilter::Get()

Definition at line 760 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), Get(), and Player().

Referenced by Register().

void GoUctCommands::CmdSaveGames ( GtpCommand cmd  ) 

Save all random games.

Arguments: filename

See also:
GoUctSearch::SaveGames()

Definition at line 791 of file GoUctCommands.cpp.

References GtpCommand::Arg(), GoUctSearch::SaveGames(), Search(), and SgException::what().

Referenced by Register().

void GoUctCommands::CmdSaveTree ( GtpCommand cmd  ) 

Save the UCT tree in SGF format.

Arguments: filename [max_depth]
max_depth is an optional argument to cut the tree at a certain depth (the root node has depth 0). If it is not used, the full tree will be saved.

See also:
GoUctSearch::SaveTree()

Definition at line 772 of file GoUctCommands.cpp.

References GtpCommand::Arg(), GtpCommand::ArgMin(), GtpCommand::CheckNuArgLessEqual(), GtpCommand::NuArg(), GoUctSearch::SaveTree(), and Search().

Referenced by Register().

void GoUctCommands::CmdScore ( GtpCommand cmd  ) 

Count the score using the scoring function of UCT.

Arguments: none
Returns: Score (Win/Loss)

See also:
GoBoardUtil::ScoreSimpleEndPosition()

Definition at line 808 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), GoRules::Komi(), m_bd, GoBoard::Rules(), GoBoardUtil::ScoreSimpleEndPosition(), GoKomi::ToFloat(), and SgException::what().

Referenced by Register().

void GoUctCommands::CmdSequence ( GtpCommand cmd  ) 

Show the best sequence from last search.

This command is compatible with the GoGui analyze command type "gfx" (There is no "var" command type supported in GoGui 1.1, which allows to specify the first color to move within the response, and this command returns the sequence of the last search, which is unrelated to the current color to play on the board.)
Arguments: none

Definition at line 829 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), GoUctUtil::GfxSequence(), and Search().

Referenced by Register().

void GoUctCommands::CmdStatPlayer ( GtpCommand cmd  ) 

Write statistics of GoUctPlayer.

Arguments: none

See also:
GoUctPlayer::Statistics

Definition at line 838 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), and Player().

Referenced by Register().

void GoUctCommands::CmdStatPlayerClear ( GtpCommand cmd  ) 

Clear statistics of GoUctPlayer.

Arguments: none

See also:
GoUctPlayer::Statistics

Definition at line 847 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), and Player().

Referenced by Register().

void GoUctCommands::CmdStatPolicy ( GtpCommand cmd  ) 

Write statistics of playout policy.

Arguments: none
Needs enabling the statistics with uct_param_policy statistics_enabled Only the statistics of the first thread's policy used.

See also:
GoUctPlayoutPolicyStat

Definition at line 859 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), Player(), Policy(), SG_BLACK, SG_WHITE, and SgWarning().

Referenced by Register().

void GoUctCommands::CmdStatPolicyClear ( GtpCommand cmd  ) 

Clear statistics of GoUctPlayoutPolicy Arguments: none
Only the statistics of the first thread's policy used.

See also:
GoUctPlayoutPolicyStat

Definition at line 874 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), and Policy().

Referenced by Register().

void GoUctCommands::CmdStatSearch ( GtpCommand cmd  ) 

Write statistics of search and tree.

Arguments: none

See also:
SgUctSearch::WriteStatistics()

Definition at line 883 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), SgUctTreeStatistics::Compute(), Search(), SgUctSearch::Tree(), and SgUctSearch::WriteStatistics().

Referenced by Register().

void GoUctCommands::CmdStatTerritory ( GtpCommand cmd  ) 

Write average point status.

This command is compatible with the GoGui analyze type dboard.
Statistics are only collected, if enabled with uct_param_global_search territory_statistics 1.
Arguments: none

See also:
GoUctGlobalSearchState::m_territoryStatistics

Definition at line 901 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), m_bd, GoBoard::Size(), and ThreadState().

Referenced by Register().

void GoUctCommands::CmdValue ( GtpCommand cmd  ) 

Return value of root node from last search.

Arguments: none

Definition at line 919 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), SgUctNode::Mean(), SgUctTree::Root(), Search(), and SgUctSearch::Tree().

Referenced by Register().

void GoUctCommands::CmdValueBlack ( GtpCommand cmd  ) 

Return value of root node from last search, from Black's point of view.

Arguments: none

Definition at line 927 of file GoUctCommands.cpp.

References GtpCommand::CheckArgNone(), SgUctSearch::InverseEval(), SgUctNode::Mean(), SgUctTree::Root(), Search(), SG_WHITE, and SgUctSearch::Tree().

Referenced by Register().

SgPointSet GoUctCommands::DoFinalStatusSearch (  )  [private]
GoUctGlobalSearch< GoUctPlayoutPolicy< GoUctBoard >, GoUctPlayoutPolicyFactory< GoUctBoard > > & GoUctCommands::GlobalSearch (  )  [private]

Definition at line 1014 of file GoUctCommands.cpp.

References Player().

Referenced by CmdParamGlobalSearch(), and DoFinalStatusSearch().

GoUctPlayerType & GoUctCommands::Player (  )  [private]
GoUctPlayoutPolicy< GoUctBoard > & GoUctCommands::Policy ( unsigned int  threadId  )  [private]

Definition at line 1034 of file GoUctCommands.cpp.

References ThreadState().

Referenced by CmdStatPolicy(), and CmdStatPolicyClear().

void GoUctCommands::Register ( GtpEngine e,
const std::string &  command,
GtpCallback< GoUctCommands >::Method  method 
) [private]

Definition at line 1079 of file GoUctCommands.cpp.

References GtpEngine::Register().

void GoUctCommands::Register ( GtpEngine engine  ) 
GoUctSearch & GoUctCommands::Search (  )  [private]
GoUctGlobalSearchState< GoUctPlayoutPolicy< GoUctBoard > > & GoUctCommands::ThreadState ( unsigned int  threadId  )  [private]

Return state of first thread, if search is of type GoUctGlobalSearch.

Exceptions:
GtpFailure,if search is a different subclass or threads are not yet created.

Definition at line 1103 of file GoUctCommands.cpp.

References SgUctSearch::CreateThreads(), Search(), SgUctSearch::ThreadsCreated(), and SgUctSearch::ThreadState().

Referenced by CmdPriorKnowledge(), CmdStatTerritory(), DoFinalStatusSearch(), and Policy().


Member Data Documentation

const GoBoard& GoUctCommands::m_bd [private]

Definition at line 108 of file GoUctCommands.h.

Referenced by DoFinalStatusSearch(), and Player().


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


Sun Mar 13 2011 Doxygen 1.7.1