All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes | List of all members
osl::search::SimpleHashTable Class Reference

基本的な hash table. More...

#include <simpleHashTable.h>

Inheritance diagram for osl::search::SimpleHashTable:
Inheritance graph
[legend]
Collaboration diagram for osl::search::SimpleHashTable:
Collaboration graph
[legend]

Public Member Functions

 SimpleHashTable (size_t capacity=100000, int minimum_record_limit=0, int verbose=0)
 
 ~SimpleHashTable ()
 
void setMinimumRecordLimit (int new_limit)
 
SimpleHashRecordallocate (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

- Private Types inherited from osl::container::GeneralSimpleHashTable< SimpleHashRecord >
typedef hash::HashKey HashKey
 
- Private Member Functions inherited from osl::container::GeneralSimpleHashTable< SimpleHashRecord >
 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...
 

Detailed Description

基本的な hash table.

とりあえず g++ (SGI STL) の hash_map を使って実装

機能:

ある程度基本的な機能を実装したら,自分で実装しなおすほうがbetter。 この hash_map では GCを実装することは困難と思われるため

find, allocate で ポインタを返すため,要素を追加しても,既存の要素の アドレスが変化しないデータ構造を用いる必要がある.

Definition at line 32 of file simpleHashTable.h.

Constructor & Destructor Documentation

osl::search::SimpleHashTable::SimpleHashTable ( size_t  capacity = 100000,
int  minimum_record_limit = 0,
int  verbose = 0 
)
explicit
Parameters
capacity表に保持する最大局面
minimumRecordLimitrecordUpperBound, recordLowerBound において limit がこれ未満のものは登録要求を無視する. 末端の静止探索も記録する場合はマイナスにする

Definition at line 15 of file simpleHashTable.cc.

osl::search::SimpleHashTable::~SimpleHashTable ( )

Definition at line 28 of file simpleHashTable.cc.

References verbose.

Member Function Documentation

osl::search::SimpleHashRecord * osl::search::SimpleHashTable::allocate ( const HashKey key,
int  limit 
)

表を探し,登録されてなければ新規エントリを登録する

Returns
テーブルがいっぱいだったりlimit が小さすぎると0。 そうでなければ内部で確保した場所へのポインタ (間違っても delete しないこと)
Exceptions
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
bool osl::search::SimpleHashTable::isConsistent ( ) const

Definition at line 74 of file simpleHashTable.cc.

bool osl::search::SimpleHashTable::isVerbose ( ) const
inline
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)
Parameters
new_limitrecordUpperBound, 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

Member Data Documentation

int osl::search::SimpleHashTable::minimum_limit
private

Definition at line 35 of file simpleHashTable.h.

int osl::search::SimpleHashTable::verbose
private

Definition at line 36 of file simpleHashTable.h.


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