Transposition table. More...
#include <TransTable.hpp>
Classes | |
struct | Statistics |
Public Member Functions | |
TransTable (int bits) | |
Creates table with 2^n slots. | |
~TransTable () | |
Destructor. | |
std::size_t | Bits () const |
Returns lg2 of number of entries. | |
std::size_t | Size () const |
Returns the number of slots in the TT. | |
void | Clear () |
Clears the table. | |
bool | Put (hash_t hash, const T &data) |
Stores data in slot for hash. | |
bool | Get (hash_t hash, T &data) |
Returns true if the slot for hash contains a state with that hash value, data is copied into data if so. | |
std::string | Stats () const |
Returns statistics in string form. | |
Private Member Functions | |
BOOST_CLASS_REQUIRE (T, benzene, TransTableStateConcept) | |
Private Attributes | |
int | m_bits |
std::size_t | m_size |
std::size_t | m_mask |
std::vector< T > | m_data |
std::vector< hash_t > | m_hash |
Statistics | m_stats |
Transposition table.
The state class must meet the requirements of TransTableStateConcept.
Definition at line 39 of file TransTable.hpp.
TransTable< T >::TransTable | ( | int | bits | ) | [inline] |
Creates table with 2^n slots.
Definition at line 106 of file TransTable.hpp.
References TransTable< T >::Clear().
TransTable< T >::~TransTable | ( | ) | [inline] |
Destructor.
Definition at line 118 of file TransTable.hpp.
std::size_t TransTable< T >::Bits | ( | ) | const [inline] |
Returns lg2 of number of entries.
Definition at line 123 of file TransTable.hpp.
References TransTable< T >::m_bits.
TransTable< T >::BOOST_CLASS_REQUIRE | ( | T | , | |
benzene | , | |||
TransTableStateConcept | ||||
) | [private] |
void TransTable< T >::Clear | ( | ) | [inline] |
Clears the table.
Definition at line 135 of file TransTable.hpp.
References TransTable< T >::m_data, TransTable< T >::m_hash, and TransTable< T >::m_size.
Referenced by WolveSearch::OnStartSearch(), and TransTable< T >::TransTable().
bool TransTable< T >::Get | ( | hash_t | hash, | |
T & | data | |||
) | [inline] |
Returns true if the slot for hash contains a state with that hash value, data is copied into data if so.
Otherwise, nothing is copied into data.
Definition at line 160 of file TransTable.hpp.
References TransTable< T >::Statistics::hits, TransTable< T >::m_data, TransTable< T >::m_hash, TransTable< T >::m_mask, TransTable< T >::m_stats, and TransTable< T >::Statistics::reads.
Referenced by WolveSearch::GenerateMoves().
bool TransTable< T >::Put | ( | hash_t | hash, | |
const T & | data | |||
) | [inline] |
Stores data in slot for hash.
New data overwrites old only if "old.ReplaceWith(new)" is true.
Definition at line 145 of file TransTable.hpp.
References TransTable< T >::m_data, TransTable< T >::m_hash, TransTable< T >::m_mask, TransTable< T >::m_stats, TransTable< T >::Statistics::overwrites, and TransTable< T >::Statistics::writes.
Referenced by WolveSearch::AfterStateSearched().
std::size_t TransTable< T >::Size | ( | ) | const [inline] |
Returns the number of slots in the TT.
Definition at line 129 of file TransTable.hpp.
References TransTable< T >::m_size.
std::string TransTable< T >::Stats | ( | ) | const [inline] |
Returns statistics in string form.
Definition at line 175 of file TransTable.hpp.
References TransTable< T >::Statistics::hits, TransTable< T >::m_stats, TransTable< T >::Statistics::overwrites, TransTable< T >::Statistics::reads, and TransTable< T >::Statistics::writes.
Referenced by DfpnSolver::PrintStatistics().
int TransTable< T >::m_bits [private] |
Definition at line 90 of file TransTable.hpp.
Referenced by TransTable< T >::Bits().
std::vector<T> TransTable< T >::m_data [private] |
Definition at line 96 of file TransTable.hpp.
Referenced by TransTable< T >::Clear(), TransTable< T >::Get(), and TransTable< T >::Put().
std::vector<hash_t> TransTable< T >::m_hash [private] |
Definition at line 98 of file TransTable.hpp.
Referenced by TransTable< T >::Clear(), TransTable< T >::Get(), and TransTable< T >::Put().
std::size_t TransTable< T >::m_mask [private] |
Definition at line 94 of file TransTable.hpp.
Referenced by TransTable< T >::Get(), and TransTable< T >::Put().
std::size_t TransTable< T >::m_size [private] |
Definition at line 92 of file TransTable.hpp.
Referenced by TransTable< T >::Clear(), and TransTable< T >::Size().
Statistics TransTable< T >::m_stats [private] |
Definition at line 100 of file TransTable.hpp.
Referenced by TransTable< T >::Get(), TransTable< T >::Put(), and TransTable< T >::Stats().