基本的な hash table. More...
#include <simpleHashTable.h>
Public Member Functions | |
SimpleHashTable (size_t capacity=100000, int minimum_record_limit=0, int verbose=0) | |
~SimpleHashTable () | |
void | setMinimumRecordLimit (int new_limit) |
SimpleHashRecord * | allocate (const HashKey &key, int limit) |
表を探し,登録されてなければ新規エントリを登録する More... | |
int | minimumRecordLimit () const |
void | setVerbose (int verbose=1) |
int | verboseLevel () const |
bool | isVerbose () const |
bool | isConsistent () const |
int | divSize () const |
void | getPV (const HashKey &, MoveVector &, size_t *quiesce_start=0) const |
uint64_t | memoryUse () const |
Private Attributes | |
int | minimum_limit |
int | verbose |
Additional Inherited Members | |
![]() | |
typedef hash::HashKey | HashKey |
![]() | |
GeneralSimpleHashTable (size_t capacity=100000) | |
~GeneralSimpleHashTable () | |
void | clear () |
SimpleHashRecord * | allocate (const HashKey &key) |
表を探し,登録されてなければ新規エントリを登録する More... | |
SimpleHashRecord * | find (const HashKey &key) |
表を探す.新たに登録する事はない More... | |
const SimpleHashRecord * | find (const HashKey &key) const |
size_t | size () const |
size_t | capacity () const |
int | numCacheHit () const |
int | numRecordAfterFull () const |
bool | isVerbose () const |
int | divSize () const |
lock contention を下げるために分割した大きさ More... | |
基本的な hash table.
とりあえず g++ (SGI STL) の hash_map を使って実装
機能:
ある程度基本的な機能を実装したら,自分で実装しなおすほうがbetter。 この hash_map では GCを実装することは困難と思われるため
find, allocate で ポインタを返すため,要素を追加しても,既存の要素の アドレスが変化しないデータ構造を用いる必要がある.
Definition at line 32 of file simpleHashTable.h.
|
explicit |
capacity | 表に保持する最大局面 |
minimumRecordLimit | recordUpperBound, recordLowerBound において limit がこれ未満のものは登録要求を無視する. 末端の静止探索も記録する場合はマイナスにする |
Definition at line 15 of file simpleHashTable.cc.
osl::search::SimpleHashTable::~SimpleHashTable | ( | ) |
Definition at line 28 of file simpleHashTable.cc.
References verbose.
osl::search::SimpleHashRecord * osl::search::SimpleHashTable::allocate | ( | const HashKey & | key, |
int | limit | ||
) |
表を探し,登録されてなければ新規エントリを登録する
TableFull |
Definition at line 60 of file simpleHashTable.cc.
References osl::find().
Referenced by osl::game_playing::HistoryToTable::adjustDominance(), osl::search::AlphaBeta2< EvalT >::alphaBetaSearchRoot(), osl::search::AlphaBeta2< EvalT >::findCheckmateInPV(), osl::search::AlphaBeta2< EvalT >::makeMove(), osl::search::qallocate(), qsearch(), osl::game_playing::HistoryToTable::setPV(), and osl::search::AlphaBeta2< EvalT >::setRoot().
int osl::search::SimpleHashTable::divSize | ( | ) | const |
Definition at line 80 of file simpleHashTable.cc.
void osl::search::SimpleHashTable::getPV | ( | const HashKey & | root, |
MoveVector & | out, | ||
size_t * | quiesce_start = 0 |
||
) | const |
Definition at line 87 of file simpleHashTable.cc.
References osl::search::SimpleHashRecord::bestMove(), osl::search::QuiescenceRecord::bestMove(), osl::Move::isInvalid(), osl::MoveLogProb::move(), osl::hash::HashKey::newHashWithMove(), osl::search::SimpleHashRecord::qrecord, and osl::hash::HashKey128::size().
bool osl::search::SimpleHashTable::isConsistent | ( | ) | const |
Definition at line 74 of file simpleHashTable.cc.
|
inline |
Definition at line 79 of file simpleHashTable.h.
References verboseLevel().
Referenced by osl::search::AlphaBeta2Tree< EvalT >::addMultiPV(), osl::search::AlphaBeta2< EvalT >::alphaBetaSearchRoot(), osl::search::AlphaBeta2< EvalT >::computeBestMoveIteratively(), osl::search::AlphaBeta2Tree< EvalT >::examineMovesRoot(), osl::search::AlphaBeta2< EvalT >::findCheckmateInPV(), osl::game_playing::HistoryToTable::setPV(), and osl::search::AlphaBeta2Tree< EvalT >::updateRootPV().
uint64_t osl::search::SimpleHashTable::memoryUse | ( | ) | const |
Definition at line 22 of file simpleHashTable.cc.
int osl::search::SimpleHashTable::minimumRecordLimit | ( | ) | const |
Definition at line 53 of file simpleHashTable.cc.
void osl::search::SimpleHashTable::setMinimumRecordLimit | ( | int | new_limit) |
new_limit | recordUpperBound, recordLowerBound において limit がこれ未満のものは登録要求を無視する |
Definition at line 47 of file simpleHashTable.cc.
void osl::search::SimpleHashTable::setVerbose | ( | int | verbose = 1 ) |
Definition at line 41 of file simpleHashTable.cc.
References verbose.
int osl::search::SimpleHashTable::verboseLevel | ( | ) | const |
Definition at line 68 of file simpleHashTable.cc.
References verbose.
Referenced by osl::search::AlphaBeta2< EvalT >::alphaBetaSearchRoot(), osl::search::AlphaBeta2< EvalT >::computeBestMoveIteratively(), and isVerbose().
|
private |
Definition at line 35 of file simpleHashTable.h.
|
private |
Definition at line 36 of file simpleHashTable.h.