Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

GoUctDefaultPriorKnowledge.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 /** @file GoUctDefaultPriorKnowledge.h */
00003 //----------------------------------------------------------------------------
00004 
00005 #ifndef GOUCT_DEFAULTPRIORKNOWLEDGE_H
00006 #define GOUCT_DEFAULTPRIORKNOWLEDGE_H
00007 
00008 #include "GoUctPlayoutPolicy.h"
00009 #include "SgUctSearch.h"
00010 
00011 //----------------------------------------------------------------------------
00012 
00013 /** Base knowledge class. */
00014 class GoUctKnowledge
00015 {
00016 public:
00017     GoUctKnowledge(const GoBoard& bd);
00018 
00019     virtual ~GoUctKnowledge();
00020 
00021     virtual void ProcessPosition(std::vector<SgUctMoveInfo>& moves)=0;
00022 
00023 protected:
00024     const GoBoard& m_bd;
00025 
00026     SgArray<SgStatisticsBase<SgUctValue,SgUctValue>,SG_PASS+1> m_values;
00027 
00028     void Add(SgPoint p, SgUctValue value, SgUctValue count);
00029 
00030     void Initialize(SgPoint p, SgUctValue value, SgUctValue count);
00031 
00032     void ClearValues();
00033 
00034     void TransferValues(std::vector<SgUctMoveInfo>& outmoves) const;
00035 };
00036 
00037 //----------------------------------------------------------------------------
00038 
00039 /** Default prior knowledge heuristic.
00040     Mainly uses GoUctPlayoutPolicy to generate prior knowledge. */
00041 class GoUctDefaultPriorKnowledge 
00042 : public GoUctKnowledge
00043 {
00044 public:
00045     GoUctDefaultPriorKnowledge(const GoBoard& bd,
00046                                const GoUctPlayoutPolicyParam& param);
00047 
00048     void ProcessPosition(std::vector<SgUctMoveInfo>& moves);
00049 
00050     bool FindGlobalPatternAndAtariMoves(SgPointSet& pattern,
00051                                         SgPointSet& atari,
00052                                         GoPointList& empty) const;
00053 private:
00054 
00055     GoUctPlayoutPolicy<GoBoard> m_policy;
00056 
00057     void AddLocalityBonus(GoPointList& emptyPoints, bool isSmallBoard);
00058 
00059 };
00060 
00061 //----------------------------------------------------------------------------
00062 
00063 #endif // GOUCT_DEFAULTPRIORKNOWLEDGE_H


Sun Mar 13 2011 Doxygen 1.7.1