State 型のキー (7 つの short int を持つクラス) と type の値Score
(3 つの double 型のクラス) で構成される検索結果のキャッシュを実装しました。なんで?
編集:くそー!私のハッシュ関数は
namespace std {
size_t hash<State>::operator()(State const& s) const {
size_t retval = hash<short>()(s.s[0]);
for (int i = 1; i < R; i += 2) { // 1 3 5
int x = (static_cast<int>(s.s[i + 1]) << 16)
+ (static_cast<int>(s.s[i]));
hash_combine(retval, x);
}
}
}
するのを忘れていたreturn retval
ので、すべて衝突していました!unordered_map に、衝突の平均数を報告する hash_function_quality() 関数があればいいのにと思います。