Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

WolveSearch Class Reference

Performs an AlphaBeta search using Resistance for evaluations. More...

#include <WolvePlayer.hpp>

Inheritance diagram for WolveSearch:
HexAbSearch

List of all members.

Public Member Functions

 WolveSearch ()
virtual ~WolveSearch ()
bitset_t RootMovesToConsider () const
 Moves to consider in the root state -- this set is used instead of the GenerateMoves() since it could have more knowledge.
void SetRootMovesToConsider (const bitset_t &consider)
 See RootMovesToConsider().
void SetTT (SearchTT *tt)
 Sets the transposition table to be used during search.
bool GuiFx () const
 Writes progress of search in guifx format after each root move completes.
void SetGuiFx (bool flag)
 Sets whether guifx output should be dumped.
HexEval Search (HexBoard &brd, HexColor color, const std::vector< int > &plywidth, const std::vector< int > &depths_to_search, int timelimit, std::vector< HexPoint > &PV)
 Runs the AlphaBeta search.
std::string DumpStats ()
 Output stats from search.
Virtual methods from HexAbSearch.

virtual HexEval Evaluate ()
 Evaluates leaf position.
virtual void GenerateMoves (std::vector< HexPoint > &moves)
 Generates moves for this position.
virtual void ExecuteMove (HexPoint move)
 Plays the given move.
virtual void UndoMove (HexPoint move)
 Undoes the given move.
virtual void EnteredNewState ()
 Hook function called upon entering new position.
virtual void OnStartSearch ()
 Hook function called at the very start of the search.
virtual void OnSearchComplete ()
 Hook function called after the search has completed.
virtual void AfterStateSearched ()
 Hook function called after a states moves have been searched.
Parameters

bool BackupIceInfo () const
 Whether the backed-up ice info is used to reduce the moves to consider after a state has been searched.
void SetBackupIceInfo (bool enable)
 BackupIceInfo().

Protected Attributes

HexBoardm_brd
 The board we are playing on.
HexColor m_toplay
 Color of player to move next.
SearchTTm_tt
 Transposition table to use during search, if any.
bool m_use_guifx
int m_current_depth
 Number of moves from the root.
PointSequence m_sequence
 Sequences of moves to the current state.
HexPoint m_tt_bestmove
 If current state exists in TT, but TT state was not deep enough, this will hold the best move for that state; otherwise it will be INVALID_MOVE.
bool m_tt_info_available

Private Member Functions

void ComputeResistance (Resistance &resist)
 Computes the evaluation on the no_fillin_board (if it exists) using the ConductanceGraph from m_brd.

Private Attributes

std::vector< bitset_tm_consider
 Consider sets for each depth.
bitset_t m_rootMTC
 See RootMovesToConsider().
TransTable< VariationInfom_varTT
 Variation TT.
bool m_backup_ice_info
 See BackupIceInfo().

Detailed Description

Performs an AlphaBeta search using Resistance for evaluations.

Todo:
Switch to SgSearch instead of HexAbSearch?

Definition at line 80 of file WolvePlayer.hpp.


Constructor & Destructor Documentation

WolveSearch::WolveSearch (  ) 

Definition at line 89 of file WolvePlayer.cpp.

WolveSearch::~WolveSearch (  )  [virtual]

Definition at line 95 of file WolvePlayer.cpp.


Member Function Documentation

void WolveSearch::AfterStateSearched (  )  [virtual]

Hook function called after a states moves have been searched.

Default implementation does nothing.

Reimplemented from HexAbSearch.

Definition at line 179 of file WolvePlayer.cpp.

References SequenceHash::Hash(), hash_t, m_backup_ice_info, HexAbSearch::m_brd, m_consider, HexAbSearch::m_current_depth, HexAbSearch::m_sequence, HexAbSearch::m_toplay, m_varTT, EndgameUtils::MovesToConsider(), and TransTable< T >::Put().

bool WolveSearch::BackupIceInfo (  )  const [inline]

Whether the backed-up ice info is used to reduce the moves to consider after a state has been searched.

This is useful if using iterative deepening, since the next time the state is visited a smaller number of moves need to be considered.

Definition at line 164 of file WolvePlayer.hpp.

References m_backup_ice_info.

Referenced by WolveEngine::WolveParam().

void WolveSearch::ComputeResistance ( Resistance resist  )  [private]

Computes the evaluation on the no_fillin_board (if it exists) using the ConductanceGraph from m_brd.

Computes resistance on game board using vcs from filled-in board.

Definition at line 199 of file WolvePlayer.cpp.

References ResistanceUtil::AddAdjacencies(), BLACK_AND_WHITE, GroupBuilder::Build(), Resistance::Evaluate(), HexBoard::GetPosition(), HexBoard::Height(), HexAbSearch::m_brd, and HexBoard::Width().

Referenced by Evaluate(), and GenerateMoves().

std::string HexAbSearch::DumpStats (  )  [inherited]

Output stats from search.

Definition at line 379 of file HexAbSearch.cpp.

References HexAbSearch::Statistics::Dump(), HexAbSearch::m_eval, and HexAbSearch::m_statistics.

Referenced by WolvePlayer::Search().

void WolveSearch::EnteredNewState (  )  [virtual]

Hook function called upon entering new position.

Default implementation does nothing.

Reimplemented from HexAbSearch.

Definition at line 105 of file WolvePlayer.cpp.

HexEval WolveSearch::Evaluate (  )  [virtual]

Evaluates leaf position.

Implements HexAbSearch.

Definition at line 109 of file WolvePlayer.cpp.

References BLACK, ComputeResistance(), HexEval, LogFine(), HexAbSearch::m_toplay, and Resistance::Score().

void WolveSearch::ExecuteMove ( HexPoint  move  )  [virtual]

Plays the given move.

Implements HexAbSearch.

Definition at line 168 of file WolvePlayer.cpp.

References HexAbSearch::m_brd, HexAbSearch::m_toplay, and HexBoard::PlayMove().

void WolveSearch::GenerateMoves ( std::vector< HexPoint > &  moves  )  [virtual]
bool HexAbSearch::GuiFx (  )  const [inline, inherited]

Writes progress of search in guifx format after each root move completes.

Off by default.

Definition at line 200 of file HexAbSearch.hpp.

References HexAbSearch::m_use_guifx.

Referenced by WolveEngine::WolveParam().

void WolveSearch::OnSearchComplete (  )  [virtual]

Hook function called after the search has completed.

Default implementation does nothing.

Reimplemented from HexAbSearch.

Definition at line 193 of file WolvePlayer.cpp.

void WolveSearch::OnStartSearch (  )  [virtual]

Hook function called at the very start of the search.

Default implementation does nothing.

Reimplemented from HexAbSearch.

Definition at line 99 of file WolvePlayer.cpp.

References TransTable< T >::Clear(), m_consider, and m_varTT.

bitset_t WolveSearch::RootMovesToConsider (  )  const [inline]

Moves to consider in the root state -- this set is used instead of the GenerateMoves() since it could have more knowledge.

Definition at line 154 of file WolvePlayer.hpp.

References m_rootMTC.

HexEval HexAbSearch::Search ( HexBoard brd,
HexColor  color,
const std::vector< int > &  plywidth,
const std::vector< int > &  depths_to_search,
int  timelimit,
std::vector< HexPoint > &  PV 
) [inherited]

Runs the AlphaBeta search.

Parameters:
brd board to play one.
color color to play.
plywidth depth of the search set to plywidth.size() and plywidth[j] top moves are explored.
depths_to_search successive depths to search (like in ID).
timelimit amount of time in which to finish search.
PV the principal variation will be stored here.
Returns:
the evaluation of the PV.

If search is aborted by the user or the timelimit is reached, then the last valid result from interative deepening is returned. If the first iteration has not completed, then a score of -EVAL_INFINITY and a PV containing only INVALID_POINT are returned.

Definition at line 95 of file HexAbSearch.cpp.

References HexAbSearch::Statistics::elapsed_time, EVAL_INFINITY, Get(), IMMEDIATE_LOSS, IMMEDIATE_WIN, INVALID_POINT, LogInfo(), HexAbSearch::m_aborted, HexAbSearch::m_brd, HexAbSearch::m_current_depth, HexAbSearch::m_eval, HexAbSearch::m_sequence, HexAbSearch::m_statistics, HexAbSearch::m_toplay, HexAbSearch::OnSearchComplete(), HexAbSearch::OnStartSearch(), HexAbSearch::Statistics::pv, HexAbSearch::SearchState(), UNUSED(), and HexAbSearch::Statistics::value.

Referenced by WolvePlayer::Search().

void WolveSearch::SetBackupIceInfo ( bool  enable  )  [inline]

BackupIceInfo().

Definition at line 169 of file WolvePlayer.hpp.

References m_backup_ice_info.

Referenced by WolveEngine::WolveParam().

void HexAbSearch::SetGuiFx ( bool  flag  )  [inline, inherited]

Sets whether guifx output should be dumped.

See also:
GuiFX().

Definition at line 195 of file HexAbSearch.hpp.

References HexAbSearch::m_use_guifx.

Referenced by WolveEngine::WolveParam().

void WolveSearch::SetRootMovesToConsider ( const bitset_t consider  )  [inline]

See RootMovesToConsider().

Definition at line 159 of file WolvePlayer.hpp.

References m_rootMTC.

Referenced by WolvePlayer::Search().

void HexAbSearch::SetTT ( SearchTT tt  )  [inline, inherited]

Sets the transposition table to be used during search.

Definition at line 190 of file HexAbSearch.hpp.

References HexAbSearch::m_tt.

Referenced by WolvePlayer::WolvePlayer().

void WolveSearch::UndoMove ( HexPoint  move  )  [virtual]

Undoes the given move.

Implements HexAbSearch.

Definition at line 173 of file WolvePlayer.cpp.

References HexAbSearch::m_brd, HexBoard::UndoMove(), and UNUSED().


Member Data Documentation

See BackupIceInfo().

Definition at line 151 of file WolvePlayer.hpp.

Referenced by AfterStateSearched(), BackupIceInfo(), and SetBackupIceInfo().

HexBoard* HexAbSearch::m_brd [protected, inherited]
std::vector<bitset_t> WolveSearch::m_consider [private]

Consider sets for each depth.

Definition at line 142 of file WolvePlayer.hpp.

Referenced by AfterStateSearched(), GenerateMoves(), and OnStartSearch().

int HexAbSearch::m_current_depth [protected, inherited]

Number of moves from the root.

Definition at line 124 of file HexAbSearch.hpp.

Referenced by AfterStateSearched(), HexAbSearch::CheckTerminalState(), GenerateMoves(), HexAbSearch::Search(), and HexAbSearch::SearchState().

PointSequence HexAbSearch::m_sequence [protected, inherited]

Sequences of moves to the current state.

Definition at line 127 of file HexAbSearch.hpp.

Referenced by AfterStateSearched(), GenerateMoves(), HexAbSearch::Search(), and HexAbSearch::SearchState().

HexColor HexAbSearch::m_toplay [protected, inherited]
SearchTT* HexAbSearch::m_tt [protected, inherited]

Transposition table to use during search, if any.

Definition at line 118 of file HexAbSearch.hpp.

Referenced by HexAbSearch::SearchState(), and HexAbSearch::SetTT().

HexPoint HexAbSearch::m_tt_bestmove [protected, inherited]

If current state exists in TT, but TT state was not deep enough, this will hold the best move for that state; otherwise it will be INVALID_MOVE.

Could be used in GenerateMoves() to improve move ordering when using iterative deepening.

Definition at line 133 of file HexAbSearch.hpp.

Referenced by GenerateMoves(), and HexAbSearch::SearchState().

bool HexAbSearch::m_tt_info_available [protected, inherited]

Definition at line 134 of file HexAbSearch.hpp.

Referenced by HexAbSearch::SearchState().

bool HexAbSearch::m_use_guifx [protected, inherited]
See also:
GuiFx().

Definition at line 121 of file HexAbSearch.hpp.

Referenced by HexAbSearch::GuiFx(), HexAbSearch::SearchState(), and HexAbSearch::SetGuiFx().

Variation TT.

Definition at line 148 of file WolvePlayer.hpp.

Referenced by AfterStateSearched(), GenerateMoves(), and OnStartSearch().


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


6 Jan 2011 Doxygen 1.6.3