詰探索局面表 – 並列でも共有する部分 More...
#include <dfpn.h>
Classes | |
struct | List |
struct | Table |
Public Member Functions | |
DfpnTable (Player attack) | |
DfpnTable () | |
~DfpnTable () | |
template<Player Attack> | |
const DfpnRecord | probe (const HashKey &key, PieceStand white) const |
const DfpnRecord | probe (const HashKey &key, PieceStand white) const |
size_t | estimateNodeCount (const HashKey &key, bool dominance_max=false) const |
template<Player Attack> | |
const DfpnRecord | findProofOracle (const HashKey &key, PieceStand white, Move last_move=Move()) const |
const DfpnRecord | findProofOracle (const HashKey &key, PieceStand white, Move last_move=Move()) const |
template<Player Attack> | |
void | showProofOracles (const HashKey &key, PieceStand white, Move last_move=Move()) const |
size_t | size () const |
void | showStats () const |
void | setAttack (Player) |
void | setWorking (const HashKey &key, const DfpnRecord &value, int thread_id) |
void | leaveWorking (const HashKey &key, int thread_id) |
void | store (const HashKey &key, DfpnRecord &value, int leaving_thread_id=-1) |
void | addDag (const HashKey &key, DfpnRecord &value) |
void | clear () |
size_t | totalSize () |
Player | attack () const |
void | setMaxDepth (int) |
int | maxDepth () const |
void | testTable () |
size_t | smallTreeGC (size_t threshold=10) |
void | setGrowthLimit (size_t new_limit) |
set the maximum size of table (otherwise infinity). More... | |
size_t | growthLimit () const |
bool | runGC () |
template<osl::Player Attack> | |
osl::checkmate::DfpnTable::List * | find (const HashKey &key, int subindex) |
template<osl::Player Attack> | |
const osl::checkmate::DfpnTable::List * | find (const HashKey &key, int subindex) const |
template<osl::Player Attack> | |
const osl::checkmate::DfpnRecord | probe (const HashKey &key, PieceStand white_stand) const |
template<osl::Player Attack> | |
const osl::checkmate::DfpnRecord | findProofOracle (const HashKey &key, PieceStand white_stand, Move last_move) const |
Private Member Functions | |
template<Player Attack> | |
List * | find (const HashKey &key, int subindex) |
template<Player Attack> | |
const List * | find (const HashKey &key, int subindex) const |
const List * | find (const HashKey &key, int subindex) const |
Static Private Member Functions | |
static int | keyToIndex (const HashKey &key) |
Private Attributes | |
boost::scoped_array< Table > | table |
size_t | total_size |
int | dfpn_max_depth |
size_t | growth_limit |
size_t | gc_threshold |
Static Private Attributes | |
static const int | DIVSIZE =1 |
osl::checkmate::DfpnTable::DfpnTable | ( | Player | attack | ) |
Definition at line 893 of file dfpn.cc.
References DfpnTable(), and setAttack().
osl::checkmate::DfpnTable::DfpnTable | ( | ) |
Definition at line 902 of file dfpn.cc.
References ~DfpnTable().
Referenced by DfpnTable(), and osl::checkmate::DfpnTable::Table::Table().
osl::checkmate::DfpnTable::~DfpnTable | ( | ) |
void osl::checkmate::DfpnTable::addDag | ( | const HashKey & | key, |
DfpnRecord & | value | ||
) |
Definition at line 1098 of file dfpn.cc.
References osl::checkmate::DfpnTable::List::addDag(), osl::BLACK, osl::hash::HashKey128::blackStand(), osl::hash::HashKey128::boardKey(), osl::checkmate::ProofDisproof::isLoopDetection(), keyToIndex(), osl::checkmate::DfpnRecordBase::proof_disproof, SCOPED_LOCK, setWorking(), osl::checkmate::DfpnRecord::stands, and table.
Referenced by osl::checkmate::Dfpn::findDagSource(), and store().
osl::Player osl::checkmate::DfpnTable::attack | ( | ) | const |
Definition at line 950 of file dfpn.cc.
Referenced by osl::checkmate::Dfpn::analyze(), osl::checkmate::Dfpn::currentTable(), find(), findProofOracle(), probe(), setAttack(), osl::checkmate::Dfpn::setIllegal(), and totalSize().
void osl::checkmate::DfpnTable::clear | ( | ) |
Definition at line 1157 of file dfpn.cc.
References DIVSIZE, SCOPED_LOCK, table, testTable(), and total_size.
Referenced by osl::checkmate::Dfpn::currentTable(), and leaveWorking().
size_t osl::checkmate::DfpnTable::estimateNodeCount | ( | const HashKey & | key, |
bool | dominance_max = false |
||
) | const |
Definition at line 1061 of file dfpn.cc.
References osl::checkmate::DfpnTable::List::estimateNodeCount(), find(), keyToIndex(), SCOPED_LOCK, and store().
Referenced by showProofOracles().
|
private |
|
private |
osl::checkmate::DfpnTable::List* osl::checkmate::DfpnTable::find | ( | const HashKey & | key, |
int | subindex | ||
) |
const osl::checkmate::DfpnTable::List* osl::checkmate::DfpnTable::find | ( | const HashKey & | key, |
int | subindex | ||
) | const |
const DfpnRecord osl::checkmate::DfpnTable::findProofOracle | ( | const HashKey & | key, |
PieceStand | white, | ||
Move | last_move = Move() |
||
) | const |
Referenced by findProofOracle(), probe(), and osl::checkmate::Dfpn::proofOracleAttack().
const osl::checkmate::DfpnRecord osl::checkmate::DfpnTable::findProofOracle | ( | const HashKey & | key, |
PieceStand | white, | ||
Move | last_move = Move() |
||
) | const |
Definition at line 1036 of file dfpn.cc.
References attack(), osl::BLACK, showProofOracles(), and table.
const osl::checkmate::DfpnRecord osl::checkmate::DfpnTable::findProofOracle | ( | const HashKey & | key, |
PieceStand | white_stand, | ||
Move | last_move | ||
) | const |
Definition at line 1024 of file dfpn.cc.
References findProofOracle(), osl::checkmate::DfpnTable::List::findProofOracle(), keyToIndex(), and SCOPED_LOCK.
|
inline |
Definition at line 73 of file dfpn.h.
References DIVSIZE, growth_limit, and runGC().
Referenced by osl::checkmate::Dfpn::attack(), and osl::checkmate::Dfpn::setTable().
|
inlinestaticprivate |
Definition at line 90 of file dfpn.h.
References DIVSIZE, find(), and osl::hash::HashKey128::signature().
Referenced by addDag(), estimateNodeCount(), findProofOracle(), leaveWorking(), probe(), setWorking(), showProofOracles(), and store().
void osl::checkmate::DfpnTable::leaveWorking | ( | const HashKey & | key, |
int | thread_id | ||
) |
Definition at line 1140 of file dfpn.cc.
References osl::hash::HashKey128::blackStand(), osl::hash::HashKey128::boardKey(), clear(), keyToIndex(), osl::checkmate::DfpnTable::List::leaveWorking(), SCOPED_LOCK, and table.
Referenced by osl::checkmate::Dfpn::attack(), osl::checkmate::Dfpn::defense(), osl::checkmate::Dfpn::hasCheckmateMove(), setWorking(), and osl::checkmate::Dfpn::tryProofMain().
int osl::checkmate::DfpnTable::maxDepth | ( | ) | const |
Definition at line 936 of file dfpn.cc.
References dfpn_max_depth, and setAttack().
Referenced by osl::checkmate::ProofTreeDepthDfpn::andNode(), osl::checkmate::ProofTreeDepthDfpn::Table::maxDepth(), osl::checkmate::ProofTreeDepthDfpn::orNode(), osl::checkmate::ProofTreeDepthDfpn::retrievePV(), setMaxDepth(), and totalSize().
const DfpnRecord osl::checkmate::DfpnTable::probe | ( | const HashKey & | key, |
PieceStand | white | ||
) | const |
const osl::checkmate::DfpnRecord osl::checkmate::DfpnTable::probe | ( | const HashKey & | key, |
PieceStand | white | ||
) | const |
Definition at line 1015 of file dfpn.cc.
References attack(), osl::BLACK, findProofOracle(), and table.
const osl::checkmate::DfpnRecord osl::checkmate::DfpnTable::probe | ( | const HashKey & | key, |
PieceStand | white_stand | ||
) | const |
Definition at line 1002 of file dfpn.cc.
References keyToIndex(), probe(), osl::checkmate::DfpnTable::List::probe(), and SCOPED_LOCK.
bool osl::checkmate::DfpnTable::runGC | ( | ) |
Definition at line 1217 of file dfpn.cc.
References gc_threshold, growth_limit, osl::OslConfig::memoryUseRatio(), size(), smallTreeGC(), and total_size.
Referenced by osl::checkmate::Dfpn::attack(), growthLimit(), and smallTreeGC().
void osl::checkmate::DfpnTable::setAttack | ( | Player | a | ) |
Definition at line 942 of file dfpn.cc.
References attack(), DIVSIZE, size(), and table.
Referenced by DfpnTable(), and maxDepth().
void osl::checkmate::DfpnTable::setGrowthLimit | ( | size_t | new_limit | ) |
set the maximum size of table (otherwise infinity).
this is one of preconditions to enable GC inside dfpn.
Definition at line 912 of file dfpn.cc.
References DIVSIZE, growth_limit, showStats(), and table.
Referenced by totalSize(), and ~DfpnTable().
void osl::checkmate::DfpnTable::setMaxDepth | ( | int | new_depth | ) |
Definition at line 931 of file dfpn.cc.
References dfpn_max_depth, and maxDepth().
Referenced by osl::checkmate::Dfpn::setTable(), showStats(), and totalSize().
void osl::checkmate::DfpnTable::setWorking | ( | const HashKey & | key, |
const DfpnRecord & | value, | ||
int | thread_id | ||
) |
Definition at line 1117 of file dfpn.cc.
References osl::BLACK, osl::hash::HashKey128::blackStand(), osl::hash::HashKey128::boardKey(), keyToIndex(), leaveWorking(), SCOPED_LOCK, osl::checkmate::DfpnTable::List::setWorking(), osl::checkmate::DfpnRecord::stands, table, and total_size.
Referenced by addDag(), osl::checkmate::Dfpn::attack(), and osl::checkmate::Dfpn::defense().
void osl::checkmate::DfpnTable::showProofOracles | ( | const HashKey & | key, |
PieceStand | white, | ||
Move | last_move = Move() |
||
) | const |
Definition at line 1047 of file dfpn.cc.
References estimateNodeCount(), keyToIndex(), SCOPED_LOCK, and osl::checkmate::DfpnTable::List::showProofOracles().
Referenced by findProofOracle(), and osl::checkmate::Dfpn::proofOracleAttack().
void osl::checkmate::DfpnTable::showStats | ( | ) | const |
Definition at line 921 of file dfpn.cc.
References DIVSIZE, setMaxDepth(), size(), table, and total_size.
Referenced by setGrowthLimit().
size_t osl::checkmate::DfpnTable::size | ( | ) | const |
Definition at line 1251 of file dfpn.cc.
References total_size.
Referenced by osl::checkmate::Dfpn::Tree::dump(), runGC(), setAttack(), and showStats().
size_t osl::checkmate::DfpnTable::smallTreeGC | ( | size_t | threshold = 10 | ) |
Definition at line 1191 of file dfpn.cc.
References DIVSIZE, runGC(), SCOPED_LOCK, table, and total_size.
Referenced by runGC(), testTable(), and totalSize().
void osl::checkmate::DfpnTable::store | ( | const HashKey & | key, |
DfpnRecord & | value, | ||
int | leaving_thread_id = -1 |
||
) |
Definition at line 1074 of file dfpn.cc.
References addDag(), osl::BLACK, osl::hash::HashKey128::blackStand(), osl::hash::HashKey128::boardKey(), osl::checkmate::ProofDisproof::isLoopDetection(), keyToIndex(), osl::checkmate::DfpnRecordBase::proof_disproof, SCOPED_LOCK, osl::checkmate::DfpnRecord::stands, osl::checkmate::DfpnTable::List::store(), table, and total_size.
Referenced by osl::checkmate::ProofTreeDepthDfpn::andNode(), osl::checkmate::Dfpn::attack(), osl::checkmate::Dfpn::defense(), estimateNodeCount(), osl::checkmate::ProofTreeDepthDfpn::orNode(), osl::checkmate::Dfpn::proofOracleAttack(), osl::checkmate::Dfpn::proofOracleDefense(), osl::checkmate::Dfpn::setIllegal(), and osl::checkmate::Dfpn::tryProofMain().
void osl::checkmate::DfpnTable::testTable | ( | ) |
Definition at line 1169 of file dfpn.cc.
References DIVSIZE, SCOPED_LOCK, smallTreeGC(), and table.
Referenced by clear(), and totalSize().
|
inline |
Definition at line 63 of file dfpn.h.
References attack(), maxDepth(), setGrowthLimit(), setMaxDepth(), smallTreeGC(), testTable(), threshold, and total_size.
|
private |
Definition at line 35 of file dfpn.h.
Referenced by maxDepth(), and setMaxDepth().
|
staticprivate |
Definition at line 88 of file dfpn.h.
Referenced by clear(), growthLimit(), keyToIndex(), setAttack(), setGrowthLimit(), showStats(), smallTreeGC(), and testTable().
|
private |
|
private |
Definition at line 36 of file dfpn.h.
Referenced by growthLimit(), runGC(), and setGrowthLimit().
|
private |
Definition at line 32 of file dfpn.h.
Referenced by addDag(), attack(), clear(), osl::checkmate::Dfpn::currentTable(), find(), findProofOracle(), leaveWorking(), osl::checkmate::ProofTreeDepthDfpn::orNode(), probe(), setAttack(), setGrowthLimit(), setWorking(), showStats(), smallTreeGC(), store(), and testTable().
|
private |
Definition at line 34 of file dfpn.h.
Referenced by clear(), runGC(), setWorking(), showStats(), size(), smallTreeGC(), store(), and totalSize().