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

GoUctGlobalSearchState< POLICY > Class Template Reference

Global UCT-Search for Go. More...

#include <GoUctGlobalSearch.h>

Inheritance diagram for GoUctGlobalSearchState< POLICY >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GoUctGlobalSearchState (unsigned int threadId, const GoBoard &bd, POLICY *policy, const GoUctGlobalSearchStateParam &param, const GoUctPlayoutPolicyParam &policyParam, const SgBWSet &safe, const SgPointArray< bool > &allSafe)
 Constructor.
 ~GoUctGlobalSearchState ()
SgUctValue Evaluate ()
bool GenerateAllMoves (SgUctValue count, std::vector< SgUctMoveInfo > &moves, SgUctProvenType &provenType)
SgMove GeneratePlayoutMove (bool &skipRaveUpdate)
void ExecutePlayout (SgMove move)
 Implementation of SgUctSearch::ExecutePlayout.
void GameStart ()
void EndPlayout ()
void StartPlayout ()
void StartPlayouts ()
void StartSearch ()
POLICY * Policy ()
void SetPolicy (POLICY *policy)
 Set random policy.
void ClearTerritoryStatistics ()
const GoBoardBoard () const
 Board used during in-tree phase.
const GoUctBoardUctBoard () const
 Board used during playout phase.
bool IsInPlayout () const
std::size_t GameLength () const
 Length of the current game from the root position of the search.
void Dump (std::ostream &out) const
Pure virtual functions of SgUctThreadState

void Execute (SgMove move)
 Implementation of SgUctSearch::Execute.
void TakeBackInTree (std::size_t nuMoves)
void TakeBackPlayout (std::size_t nuMoves)

Public Attributes

const SgBWSetm_safe
const SgPointArray< bool > & m_allSafe
SgPointArray< SgUctStatisticsm_territoryStatistics
 Probabilities that a point belongs to Black in a terminal position.
const unsigned int m_threadId
bool m_isSearchInitialized
bool m_isTreeOutOfMem
SgUctGameInfo m_gameInfo
boost::scoped_array< std::size_t > m_firstPlay
boost::scoped_array< std::size_t > m_firstPlayOpp
std::vector< SgUctMoveInfom_moves
std::vector< SgMovem_excludeMoves
int m_randomizeCounter

Private Member Functions

 GoUctGlobalSearchState (const GoUctGlobalSearchState &search)
 Not implemented.
GoUctGlobalSearchStateoperator= (const GoUctGlobalSearchState &search)
 Not implemented.
bool CheckMercyRule ()
 See SetMercyRule().
template<class BOARD >
SgUctValue EvaluateBoard (const BOARD &bd, float komi)
void GenerateLegalMoves (std::vector< SgUctMoveInfo > &moves)
 Generates all legal moves with no knowledge values.
float GetKomi () const
 Get komi including extra handicap komi points, if used by the rules.

Private Attributes

const GoUctGlobalSearchStateParamm_param
const GoUctPlayoutPolicyParamm_policyParam
bool m_mercyRuleTriggered
 See SetMercyRule().
int m_passMovesPlayoutPhase
 Number of pass moves played in a row in the playout phase.
int m_mercyRuleThreshold
 See SetMercyRule().
int m_stoneDiff
 Difference of stones on board.
int m_initialMoveNumber
 Board move number at root node of search.
GoPointList m_area
 The area in which moves should be generated.
SgUctValue m_mercyRuleResult
 See SetMercyRule().
SgUctValue m_invMaxScore
 Inverse of maximum score one can reach on a board of the current size.
SgRandom m_random
GoUctDefaultPriorKnowledge m_priorKnowledge
boost::scoped_ptr< POLICY > m_policy

Detailed Description

template<class POLICY>
class GoUctGlobalSearchState< POLICY >

Global UCT-Search for Go.

Definition at line 103 of file GoUctGlobalSearch.h.


Constructor & Destructor Documentation

template<class POLICY >
GoUctGlobalSearchState< POLICY >::GoUctGlobalSearchState ( unsigned int  threadId,
const GoBoard bd,
POLICY *  policy,
const GoUctGlobalSearchStateParam param,
const GoUctPlayoutPolicyParam policyParam,
const SgBWSet safe,
const SgPointArray< bool > &  allSafe 
)

Constructor.

Parameters:
threadId The number of the thread. Needed for passing to constructor of SgUctThreadState.
bd The board
policy The random policy (takes ownership). It is possible to set the policy to null at construction time to allowed a multi-step construction; but then a policy has to be set with SetPolicy(), before the search is used.
param Parameters. Stores a reference to the argument.
policyParam Stores a reference to the argument.
safe Safety information. Stores a reference to the argument.
allSafe Safety information. Stores a reference to the argument.

Definition at line 218 of file GoUctGlobalSearch.h.

References GoUctGlobalSearchState< POLICY >::ClearTerritoryStatistics().

template<class POLICY >
GoUctGlobalSearchState< POLICY >::~GoUctGlobalSearchState (  ) 

Definition at line 235 of file GoUctGlobalSearch.h.

template<class POLICY>
GoUctGlobalSearchState< POLICY >::GoUctGlobalSearchState ( const GoUctGlobalSearchState< POLICY > &  search  )  [private]

Not implemented.


Member Function Documentation

const GoBoard & GoUctState::Board (  )  const [inherited]
template<class POLICY >
bool GoUctGlobalSearchState< POLICY >::CheckMercyRule (  )  [private]
template<class POLICY >
void GoUctGlobalSearchState< POLICY >::ClearTerritoryStatistics (  ) 
void GoUctState::Dump ( std::ostream &  out  )  const [inherited]
template<class POLICY >
void GoUctGlobalSearchState< POLICY >::EndPlayout (  )  [virtual]

Reimplemented from SgUctThreadState.

Definition at line 270 of file GoUctGlobalSearch.h.

References GoUctGlobalSearchState< POLICY >::m_policy.

template<class POLICY >
SgUctValue GoUctGlobalSearchState< POLICY >::Evaluate (  )  [virtual]
template<class POLICY >
template<class BOARD >
SgUctValue GoUctGlobalSearchState< POLICY >::EvaluateBoard ( const BOARD &  bd,
float  komi 
) [private]
void GoUctState::Execute ( SgMove  move  )  [virtual, inherited]
template<class POLICY >
void GoUctGlobalSearchState< POLICY >::ExecutePlayout ( SgMove  move  )  [virtual]
std::size_t GoUctState::GameLength (  )  const [inherited]

Length of the current game from the root position of the search.

Definition at line 111 of file GoUctSearch.h.

References GoUctState::m_gameLength.

Referenced by GoUctGlobalSearchState< POLICY >::EvaluateBoard().

template<class POLICY >
void GoUctGlobalSearchState< POLICY >::GameStart (  )  [virtual]
template<class POLICY >
bool GoUctGlobalSearchState< POLICY >::GenerateAllMoves ( SgUctValue  count,
std::vector< SgUctMoveInfo > &  moves,
SgUctProvenType provenType 
) [virtual]
template<class POLICY >
void GoUctGlobalSearchState< POLICY >::GenerateLegalMoves ( std::vector< SgUctMoveInfo > &  moves  )  [private]
template<class POLICY >
SgMove GoUctGlobalSearchState< POLICY >::GeneratePlayoutMove ( bool &  skipRaveUpdate  )  [virtual]
template<class POLICY >
float GoUctGlobalSearchState< POLICY >::GetKomi (  )  const [private]
bool GoUctState::IsInPlayout (  )  const [inherited]
template<class POLICY>
GoUctGlobalSearchState& GoUctGlobalSearchState< POLICY >::operator= ( const GoUctGlobalSearchState< POLICY > &  search  )  [private]

Not implemented.

template<class POLICY >
POLICY * GoUctGlobalSearchState< POLICY >::Policy (  ) 

Definition at line 480 of file GoUctGlobalSearch.h.

References GoUctGlobalSearchState< POLICY >::m_policy.

template<class POLICY >
void GoUctGlobalSearchState< POLICY >::SetPolicy ( POLICY *  policy  ) 

Set random policy.

Sets a new random policy and deletes the old one, if it existed.

Definition at line 486 of file GoUctGlobalSearch.h.

References GoUctGlobalSearchState< POLICY >::m_policy.

template<class POLICY >
void GoUctGlobalSearchState< POLICY >::StartPlayout (  )  [virtual]
template<class POLICY >
void GoUctGlobalSearchState< POLICY >::StartPlayouts (  )  [virtual]

Reimplemented from GoUctState.

Definition at line 503 of file GoUctGlobalSearch.h.

template<class POLICY >
void GoUctGlobalSearchState< POLICY >::StartSearch (  )  [virtual]
void GoUctState::TakeBackInTree ( std::size_t  nuMoves  )  [virtual, inherited]

Implements SgUctThreadState.

Definition at line 159 of file GoUctSearch.cpp.

References GoUctState::m_bd, and GoBoard::Undo().

void GoUctState::TakeBackPlayout ( std::size_t  nuMoves  )  [virtual, inherited]

Implements SgUctThreadState.

Definition at line 165 of file GoUctSearch.cpp.

References GoUctState::m_gameLength.

const GoUctBoard & GoUctState::UctBoard (  )  const [inherited]

Member Data Documentation

template<class POLICY>
const SgPointArray<bool>& GoUctGlobalSearchState< POLICY >::m_allSafe
template<class POLICY>
GoPointList GoUctGlobalSearchState< POLICY >::m_area [private]

The area in which moves should be generated.

Definition at line 185 of file GoUctGlobalSearch.h.

template<class POLICY>
int GoUctGlobalSearchState< POLICY >::m_initialMoveNumber [private]

Board move number at root node of search.

Definition at line 182 of file GoUctGlobalSearch.h.

Referenced by GoUctGlobalSearchState< POLICY >::GenerateLegalMoves(), and GoUctGlobalSearchState< POLICY >::StartSearch().

template<class POLICY>
SgUctValue GoUctGlobalSearchState< POLICY >::m_invMaxScore [private]

Inverse of maximum score one can reach on a board of the current size.

Definition at line 192 of file GoUctGlobalSearch.h.

Referenced by GoUctGlobalSearchState< POLICY >::EvaluateBoard(), and GoUctGlobalSearchState< POLICY >::StartSearch().

template<class POLICY>
SgUctValue GoUctGlobalSearchState< POLICY >::m_mercyRuleResult [private]
template<class POLICY>
int GoUctGlobalSearchState< POLICY >::m_mercyRuleThreshold [private]
template<class POLICY>
bool GoUctGlobalSearchState< POLICY >::m_mercyRuleTriggered [private]
template<class POLICY>
const GoUctGlobalSearchStateParam& GoUctGlobalSearchState< POLICY >::m_param [private]
template<class POLICY>
int GoUctGlobalSearchState< POLICY >::m_passMovesPlayoutPhase [private]
template<class POLICY>
boost::scoped_ptr<POLICY> GoUctGlobalSearchState< POLICY >::m_policy [private]
template<class POLICY>
const GoUctPlayoutPolicyParam& GoUctGlobalSearchState< POLICY >::m_policyParam [private]

Definition at line 166 of file GoUctGlobalSearch.h.

template<class POLICY>
GoUctDefaultPriorKnowledge GoUctGlobalSearchState< POLICY >::m_priorKnowledge [private]
template<class POLICY>
SgRandom GoUctGlobalSearchState< POLICY >::m_random [private]
template<class POLICY>
const SgBWSet& GoUctGlobalSearchState< POLICY >::m_safe
template<class POLICY>
int GoUctGlobalSearchState< POLICY >::m_stoneDiff [private]

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


Sun Mar 13 2011 Doxygen 1.7.1