AlphaBeta の書き直し版 More...
#include <alphaBeta2.h>
Public Types | |
typedef AlphaBeta2Tree< EvalT > | base_t |
typedef base_t::checkmate_t | checkmate_t |
typedef base_t::Window | Window |
![]() | |
enum | { MaxDepth = SearchState2Core::MaxDepth } |
typedef EvalT | eval_t |
typedef AlphaBeta2Common< EvalT > | common_t |
typedef AlphaBeta2Window | Window |
![]() | |
typedef EvalT | eval_t |
typedef RealizationProbability | Probabilities_t |
Public Member Functions | |
AlphaBeta2 (const NumEffectState &s, checkmate_t &checker, SimpleHashTable *t, CountRecorder &) | |
~AlphaBeta2 () | |
template<Player P> | |
int | alphaBetaSearchRoot (Window window, MoveLogProb &best_move, int limit) |
entrance of alpha beta window search. More... | |
int | alphaBetaSearchRoot (Window window, MoveLogProb &best_move, int limit) |
int | alphaBetaSearchRoot (MoveLogProb &best_move, int limit) |
Move | computeBestMoveIteratively (int limit, const int step=100, int initialLimit=600, size_t nodeLimit=1600000, const TimeAssigned &assign=TimeAssigned(MilliSeconds::Interval(60 *1000)), MoveWithComment *additional_info=0) |
entrance of alpha beta iterative search. More... | |
bool | isReasonableMove (Move move, int pawn_sacrifice=1) |
void | setRootIgnoreMoves (const MoveVector *rim, bool prediction) |
void | enableMultiPV (unsigned int width) |
const AlphaBeta2SharedRoot | sharedRootInfo () const |
void | setRoot (int limit) |
void | makeMove (Move) |
![]() | |
bool | stopping () const |
void | testStop () |
size_t | nodeCount () const |
template<Player P> | |
const MoveLogProb | nextMove () |
template<osl::Player P> | |
const osl::MoveLogProb | nextMove () |
![]() | |
SearchBase (CountRecorder &r, SimpleHashTable *t) | |
virtual | ~SearchBase () |
virtual bool | abort (Move) const |
bool | validTableMove (const NumEffectState &state, const MoveLogProb &move, int limit) const |
テーブルの指手の正しさを確かめる More... | |
void | recordWinByCheckmate (Player P, SimpleHashRecord *record, Move check_move) const |
詰将棋の見つけた勝 More... | |
void | recordLoseByCheckmate (Player P, SimpleHashRecord *record) const |
詰将棋の見つけた敗 More... | |
![]() | |
SearchState2 (const NumEffectState &s, checkmate_t &checker) | |
virtual | ~SearchState2 () |
void | setState (const NumEffectState &s) |
state のコピーを行う. More... | |
void | setKillerMove (Move best_move) |
int | curLimit () const |
bool | abort (Move) const |
![]() | |
SearchState2Core (const NumEffectState &s, checkmate_t &checker) | |
virtual | ~SearchState2Core () |
int | curDepth () const |
void | setHistory (const MoveStack &h) |
bool | hasLastRecord (unsigned int n=0) const |
SimpleHashRecord * | lastRecord (unsigned int n=0) |
const SimpleHashRecord * | lastRecord (unsigned int n=0) const |
SimpleHashRecord * | rootRecord () |
void | setCurrentRecord (SimpleHashRecord *r) |
void | setRootRecord (SimpleHashRecord *root) |
void | setKillerMove (Move best_move) |
void | getBigramKillerMoves (MoveVector &moves) const |
void | getKillerMoves (MoveVector &moves) const |
const BigramKillerMove & | bigramKillerMove () const |
void | setBigramKillerMove (const BigramKillerMove &killers) |
HistoryTable & | historyTable () |
const HistoryTable & | historyTable () const |
void | pushPass () |
void | popPass () |
template<Player P, class Function > | |
void | doUndoMoveOrPass (const HashKey &new_hash, Move move, Function &f) |
まともなdoUndo More... | |
void | makeMove (Move move) |
const Move | lastMove (int i=1) const |
const MoveStack & | history () const |
const RecordStack2 & | recordHistory () const |
const PathEncoding & | path () const |
const NumEffectState & | state () const |
const NumEffectState & | rootState () const |
void | restoreRootState () |
const checkmate_t & | checkmateSearcher () const |
const RepetitionCounter & | repetitionCounter () const |
const HashKey & | currentHash () const |
template<Player P, class Function > | |
void | doUndoMoveLight (Move move, Function &f) |
軽量化版 doUndo 千日手情報や, hash を更新しない More... | |
template<Player P> | |
bool | isLosingState (int node_limit) |
template<Player P> | |
bool | isWinningState (int node_limit, Move &checkmate_move, bool parallel=false) |
template<Player P> | |
bool | isWinningStateShort (int depth, Move &checkmate_move) |
FixedDepthSearcher を呼ぶ More... | |
template<Player P> | |
bool | isThreatmateState (int node_limit, Move &threatmate_move, bool=false) |
P の手番でPの玉に詰めろがかかっているかどうか More... | |
template<Player P> | |
bool | isThreatmateStateShort (int depth, Move &threatmate_move) |
bool | abort () const |
bool | tryThreatmate () const |
void | makePV (Move m) |
void | initPV () |
void | makePV (PVVector &parent, Move m, PVVector &pv) const |
int | countCheckAfterThreatmate (Player turn, int depth=1) const |
turn の側が連続王手で詰ろを逃れている回数 More... | |
int | countCheckAfterThreatmateSacrifice (Player turn, int depth=1) const |
![]() | |
SearchTimer () | |
SearchTimer (const SearchTimer &src) | |
virtual | ~SearchTimer () |
void | setTimeAssign (const TimeAssigned &a) |
void | setStartTime (MilliSeconds start) |
void | setStable (bool new_stable) |
bool | isStableNow () const |
bool | hasSchedule () const |
const TimeAssigned & | timeAssigned () const |
const MilliSeconds | startTime () const |
double | elapsed (MilliSeconds now) const |
double | elapsed () const |
void | setNextIterationCoefficient (double new_value) |
void | setNodeCountHardLimit (uint64_t new_value) |
double | nextIterationCoefficient () const |
bool | stopping () const |
void | stopNow () |
SearchTimerCommon::StopReason | stopReason () |
void | throwIfNoMoreTime (uint64_t node_count) |
int | nodeAffordable () const |
void | addMonitor (const boost::shared_ptr< SearchMonitor > &) |
bool | hasMonitor () const |
const vector < boost::shared_ptr < SearchMonitor > > & | monitors () const |
int | lastMemoryUseRatio1000 () const |
Static Public Member Functions | |
static const Window | fullWindow (Player P) |
static void | showNodeDepth (std::ostream &) |
static void | clearNodeDepth () |
![]() | |
static int | rootAlpha (Player P, int last_value, Progress16 progress) |
static int | stableThreshold (Player P, int last_value) |
![]() | |
static void | adjustMemoryUseLimit (double scale=0.9) |
メモリとノード数の関係を調整. More... | |
Private Types | |
enum | PVCheckmateStatus { PVStable, PVThreatmateNotRecord, PVThreatmate, PVCheckmate } |
Private Member Functions | |
PVCheckmateStatus | findCheckmateInPV (int verify_node, CArray< bool, 2 > &king_in_threat) |
Additional Inherited Members | |
![]() | |
volatile bool | stop_tree |
beta cut in parallel search More... | |
![]() | |
static const int | ReSearchLimitMargin = 80 |
再探索や,指手生成でより確率の高い手があったときに無視する範囲 More... | |
![]() | |
enum | NodeType { PvNode = 0, AllNode = 1, CutNode = -1 } |
![]() | |
enum | { MaxDepth = SearchState2Core::MaxDepth } |
enum | MoveType { INITIAL, HASH =INITIAL, TACTICAL, KILLER, PASS, ALL, FINISH } |
typedef FixedCapacityVector < Move, 4 > | killer_t |
![]() | |
AlphaBeta2Tree (const NumEffectState &s, checkmate_t &checker, SimpleHashTable *t, CountRecorder &) | |
AlphaBeta2Tree (const AlphaBeta2Tree &src, AlphaBeta2Parallel< EvalT > *) | |
~AlphaBeta2Tree () | |
void | updateRootPV (Player P, std::ostream &, int, Move) |
void | addMultiPV (Player P, int, Move) |
bool | isStable (Player P, int new_value) const |
void | showFailLow (int result, Move m) const |
template<Player P> | |
int | alphaBetaSearch (const MoveLogProb &move, Window window, bool in_pv) |
alphaBetaSearch (move) More... | |
template<Player P> | |
int | alphaBetaSearchAfterMove (const MoveLogProb &move, Window window, bool in_pv) |
template<Player P> | |
int | quiesce (Window) |
template<Player P> | |
int | quiesceStable (Window) |
template<Player P> | |
int | quiesceExp (Window) |
template<Player P> | |
int | searchAllMoves (SimpleHashRecord *, Window w) |
template<Player P> | |
int | searchAllMoves (Move m, int limit_consumption, SimpleHashRecord *, Window w) |
template<Player P> | |
bool | tryCheckmate (SimpleHashRecord *record, bool in_pv, Move &checkmate_move) |
初めの方で詰みを読む More... | |
template<Player P> | |
bool | tryCheckmateAgain (SimpleHashRecord *record, Move &checkmate_move, int node_count, int best_value) |
負けそうな時にさらに詰みを読む More... | |
template<Player P> | |
void | testThreatmate (SimpleHashRecord *record, bool in_pv) |
詰めろの有無を確認 More... | |
template<Player P> | |
void | examineMovesRoot (const MoveLogProbVector &, size_t, Window, MoveLogProb &, int &) |
alpha値が求まった後で他の手を調べる More... | |
template<Player P> | |
int | quiesceRoot (Window, int depth_left, Move &best_move, DualThreatmateState) |
template<Player P> | |
int | quiesce (Window, int depth_left, DualThreatmateState) |
template<Player P> | |
bool | quiesceWithMove (Move, Window &, int, Move &, int &, const DualThreatmateState &) |
void | updateCheckmateCount () |
bool | tryPass (SimpleHashRecord *record, Player P) const |
MoveGenerator & | makeGenerator () |
![]() | |
static MoveGenerator * | alloc () |
static void | dealloc (MoveGenerator *) |
![]() | |
size_t | node_count |
静止探索も含めたノード数 More... | |
FixedCapacityVector < MoveGenerator *, MaxDepth > | generators |
stat::Average | mpn |
stat::Average | mpn_cut |
stat::Average | alpha_update |
stat::Average | last_alpha_update |
stat::Average | ext |
stat::Average | ext_limit |
boost::shared_ptr < AlphaBeta2Parallel< EvalT > > | shared |
boost::shared_ptr < AlphaBeta2SharedRoot > | shared_root |
![]() | |
static CArray< int, SearchState2Core::MaxDepth > | depth_node_count |
AlphaBeta の書き直し版
Definition at line 284 of file alphaBeta2.h.
typedef AlphaBeta2Tree<EvalT> osl::search::AlphaBeta2< EvalT >::base_t |
Definition at line 288 of file alphaBeta2.h.
typedef base_t::checkmate_t osl::search::AlphaBeta2< EvalT >::checkmate_t |
Definition at line 289 of file alphaBeta2.h.
typedef base_t::Window osl::search::AlphaBeta2< EvalT >::Window |
Definition at line 290 of file alphaBeta2.h.
|
private |
Enumerator | |
---|---|
PVStable | |
PVThreatmateNotRecord | |
PVThreatmate | |
PVCheckmate |
Definition at line 344 of file alphaBeta2.h.
osl::search::AlphaBeta2< EvalT >::AlphaBeta2 | ( | const NumEffectState & | s, |
checkmate_t & | checker, | ||
SimpleHashTable * | t, | ||
CountRecorder & | r | ||
) |
Definition at line 1650 of file alphaBeta2.cc.
References osl::search::MoveGenerator::initOnce().
osl::search::AlphaBeta2< EvalT >::~AlphaBeta2 | ( | ) |
Definition at line 1659 of file alphaBeta2.cc.
int osl::search::AlphaBeta2< EvalT >::alphaBetaSearchRoot | ( | Window | window, |
MoveLogProb & | best_move, | ||
int | limit | ||
) |
entrance of alpha beta window search.
see http://www.logos.t.u-tokyo.ac.jp/~gekisashi/algorithm/re_search.html. rootDepth, curLimit are initialized here.
Definition at line 2071 of file alphaBeta2.cc.
References osl::search::SimpleHashTable::allocate(), osl::search::AlphaBeta2Window::alpha(), osl::alt(), osl::search::SimpleHashRecord::bestMove(), osl::search::QuiescenceRecord::bestMove(), osl::search::AlphaBeta2Window::beta(), osl::eval::betterThan(), osl::search::QuiescenceRecord::checkmateNodesLeft(), count, osl::eval::delta(), osl::container::GeneralSimpleHashTable< Record >::find(), osl::Move::from(), osl::search::MoveGenerator::generateAll(), osl::search::SimpleHashRecord::hasGreaterLowerBound(), osl::search::SimpleHashRecord::hasUpperBound(), osl::search::SearchTable::HistorySpecialDepth, osl::search::MoveGenerator::init(), osl::Move::INVALID(), osl::Move::isDrop(), osl::move_classifier::KingOpenMove< P >::isMember(), osl::Move::isNormal(), osl::search::DualThreatmateState::isThreatmate(), osl::search::SimpleHashTable::isVerbose(), osl::KING, osl::OslConfig::lock_io, osl::eval::max(), osl::eval::min(), osl::MoveLogProb::move(), osl::Move::move, moves, osl::newPtypeO(), osl::PieceStand::order, osl::Move::PASS(), osl::PAWN, osl::Move::ptype(), osl::search::SimpleHashRecord::qrecord, osl::search::SimpleHashRecord::resetValue(), result, osl::OslConfig::searchExactValueInOneReply(), osl::search::SimpleHashRecord::setInCheck(), osl::search::SimpleHashRecord::setLowerBound(), osl::search::DualThreatmateState::setThreatmate(), osl::search::SimpleHashRecord::threatmate(), osl::Move::to(), osl::search::SimpleHashRecord::upperBound(), osl::OslConfig::usiOutputPawnValue(), osl::MoveLogProb::validMove(), and osl::search::SimpleHashTable::verboseLevel().
|
inline |
Definition at line 309 of file alphaBeta2.h.
References osl::BLACK, limit, and osl::search::SearchState2Core::state().
int osl::search::AlphaBeta2< EvalT >::alphaBetaSearchRoot | ( | MoveLogProb & | best_move, |
int | limit | ||
) |
Definition at line 1748 of file alphaBeta2.cc.
|
static |
Definition at line 2532 of file alphaBeta2.cc.
osl::Move osl::search::AlphaBeta2< EvalT >::computeBestMoveIteratively | ( | int | limit, |
const int | step = 100 , |
||
int | initialLimit = 600 , |
||
size_t | nodeLimit = 1600000 , |
||
const TimeAssigned & | assign = TimeAssigned(MilliSeconds::Interval(60*1000)) , |
||
MoveWithComment * | additional_info = 0 |
||
) |
entrance of alpha beta iterative search.
Definition at line 1757 of file alphaBeta2.cc.
References osl::search::SimpleHashRecord::addNodeCount(), osl::Move::capturePtype(), osl::ctime_r(), osl::search::MoveWithComment::elapsed, osl::container::GeneralSimpleHashTable< Record >::find(), finish, osl::move_generator::LegalMoves::generate(), osl::search::SearchTable::HistorySpecialDepth, osl::Move::INVALID(), osl::isMajor(), osl::isMajorNonPieceOK(), osl::Move::isNormal(), osl::search::SimpleHashTable::isVerbose(), osl::OslConfig::lock_io, osl::search::SimpleHashRecord::lowerBound(), osl::search::SimpleHashRecord::lowerLimit(), osl::eval::max(), osl::OslConfig::memoryUseRatio(), osl::eval::min(), osl::search::MoveWithComment::move, osl::MoveLogProb::move(), osl::search::MoveWithComment::moves, moves, osl::newPtypeO(), osl::search::MoveWithComment::node_count, osl::search::SearchTimerCommon::NoMoreMemory, osl::search::SearchTimerCommon::NoMoreTime, osl::PAWN, osl::search::MoveWithComment::root_limit, osl::record::csa::show(), osl::search::SearchTimerCommon::StopByOutside, osl::Move::to(), osl::search::SimpleHashRecord::upperBound(), osl::OslConfig::usiMode(), osl::search::MoveWithComment::value, osl::search::SimpleHashTable::verboseLevel(), and osl::WHITE.
|
inline |
Definition at line 338 of file alphaBeta2.h.
References osl::search::AlphaBeta2Common< EvalT >::multi_pv, and width.
|
private |
Definition at line 1665 of file alphaBeta2.cc.
References osl::search::SimpleHashTable::allocate(), osl::alt(), osl::search::DualThreatmateState::isThreatmate(), osl::search::SimpleHashTable::isVerbose(), osl::Move::PASS(), osl::PathEncoding::pushMove(), osl::checkmate::DualDfpn::runGC(), osl::search::DualThreatmateState::setThreatmate(), osl::record::csa::show(), and osl::search::SimpleHashRecord::threatmate().
|
inlinestatic |
Definition at line 305 of file alphaBeta2.h.
References osl::alt(), and osl::search::FixedEval::winThreshold().
bool osl::search::AlphaBeta2< EvalT >::isReasonableMove | ( | Move | move, |
int | pawn_sacrifice = 1 |
||
) |
Definition at line 2491 of file alphaBeta2.cc.
void osl::search::AlphaBeta2< EvalT >::makeMove | ( | Move | move) |
Definition at line 2475 of file alphaBeta2.cc.
References osl::search::SimpleHashTable::allocate(), osl::search::SearchState2Core::makeMove(), and osl::search::SimpleHashRecord::setInCheck().
void osl::search::AlphaBeta2< EvalT >::setRoot | ( | int | limit) |
Definition at line 2465 of file alphaBeta2.cc.
References osl::search::SimpleHashTable::allocate(), osl::eval::max(), and osl::search::SearchState2::setRoot().
|
inline |
Definition at line 329 of file alphaBeta2.h.
References osl::search::AlphaBeta2Common< EvalT >::prediction_for_speculative_search, and osl::search::AlphaBeta2Common< EvalT >::root_ignore_moves.
|
inline |
Definition at line 339 of file alphaBeta2.h.
References osl::search::AlphaBeta2Tree< EvalT >::shared_root.
Referenced by osl::game_playing::AlphaBeta2OpenMidEndingEvalPlayer::analyzeWithSeconds().
|
static |
Definition at line 2498 of file alphaBeta2.cc.
References osl::eval::max(), and max_depth.