dualDfpn.h
Go to the documentation of this file.
/* dualDfpn.h
*/
#ifndef OSL_DUALDFPN_H
#define OSL_DUALDFPN_H
#include "osl/numEffectState.h"
#include "osl/checkmate/proofDisproof.h"
#include "osl/hashKey.h"
#include "osl/pathEncoding.h"
#include "osl/container/moveStack.h"
#include <memory>
#include <cstddef>
#include <limits>
#ifdef OSL_SMP
# ifndef OSL_DFPN_SMP
# define OSL_DFPN_SMP
# endif
#endif
namespace osl
{
class RepetitionCounter;
namespace checkmate
{
class Dfpn;
class DfpnTable;
class DualDfpn
{
struct Shared;
struct Local;
struct OraclePool;
std::shared_ptr<Shared> shared;
std::unique_ptr<Local> local;
public:
explicit DualDfpn(uint64_t ignored=std::numeric_limits<uint64_t>::max());
DualDfpn(const DualDfpn& src);
~DualDfpn();
void setRootPlayer(Player);
template <Player P>
ProofDisproof findProof(int node_limit, const NumEffectState& state,
const HashKey& key, const PathEncoding& path,
Move& best_move, Move last_move=Move::INVALID());
template <Player P>
bool isWinningState(int node_limit, const NumEffectState& state,
const HashKey& key, const PathEncoding& path,
Move& best_move, Move last_move=Move::INVALID())
{
return findProof(node_limit, state, key, path, best_move, last_move)
.isCheckmateSuccess();
}
bool isWinningState(int node_limit, const NumEffectState& state,
const HashKey& key, const PathEncoding& path,
Move& best_move, Move last_move=Move::INVALID());
ProofDisproof findProof(int node_limit, const NumEffectState& state,
const HashKey& key, const PathEncoding& path,
Move& best_move, Move last_move=Move::INVALID());
#ifdef OSL_DFPN_SMP
template <Player P>
bool isWinningStateParallel(int node_limit, const NumEffectState& state,
const HashKey& key, const PathEncoding& path,
Move& best_move, Move last_move=Move::INVALID());
bool isWinningStateParallel(int node_limit, const NumEffectState& state,
const HashKey& key, const PathEncoding& path,
Move& best_move, Move last_move=Move::INVALID());
#endif
template <Player P>
bool isLosingState(int node_limit, const NumEffectState& state,
const HashKey& key, const PathEncoding& path,
Move last_move=Move::INVALID());
bool isLosingState(int node_limit, const NumEffectState& state,
const HashKey& key, const PathEncoding& path,
Move last_move=Move::INVALID());
void runGC(bool verbose=false, size_t memory_use_ratio_1000=0);
// debug
void setVerbose(int level=1);
int distance(Player attack, const HashKey& key);
size_t mainNodeCount() const;
size_t totalNodeCount() const;
void writeRootHistory(const RepetitionCounter& counter,
const MoveStack& moves,
const SimpleState& state, Player attack);
const DfpnTable& table(Player) const;
private:
Dfpn& prepareDfpn(Player attack);
Dfpn& prepareDfpnSmall(Player attack);
};
}
using checkmate::DualDfpn;
}
#endif /* OSL_DUALDFPN_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::Move::INVALID
static const Move INVALID()
Definition basic_type.h:1095
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::RepetitionCounter
千日手の検出.
Definition repetitionCounter.h:21
osl::SimpleState
Definition simpleState.h:35
osl::checkmate::DfpnTable
詰探索局面表 – 並列でも共有する部分
Definition dfpn.h:30
osl::checkmate::Dfpn
詰探索
Definition dfpn.h:107
osl::checkmate::DualDfpn::runGC
void runGC(bool verbose=false, size_t memory_use_ratio_1000=0)
Definition dualDfpn.cc:301
osl::checkmate::DualDfpn::isLosingState
bool isLosingState(int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move last_move=Move::INVALID())
Definition dualDfpn.cc:551
osl::checkmate::DualDfpn::prepareDfpn
Dfpn & prepareDfpn(Player attack)
Definition dualDfpn.cc:281
osl::checkmate::DualDfpn::setVerbose
void setVerbose(int level=1)
Definition dualDfpn.cc:609
osl::checkmate::DualDfpn::isWinningState
bool isWinningState(int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move=Move::INVALID())
詰みを発見.
Definition dualDfpn.h:51
osl::checkmate::DualDfpn::totalNodeCount
size_t totalNodeCount() const
Definition dualDfpn.cc:631
osl::checkmate::DualDfpn::~DualDfpn
~DualDfpn()
Definition dualDfpn.cc:276
osl::checkmate::DualDfpn::prepareDfpnSmall
Dfpn & prepareDfpnSmall(Player attack)
Definition dualDfpn.cc:293
osl::checkmate::DualDfpn::findProof
ProofDisproof findProof(int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move=Move::INVALID())
osl::checkmate::DualDfpn::mainNodeCount
size_t mainNodeCount() const
Definition dualDfpn.cc:621
osl::checkmate::DualDfpn::distance
int distance(Player attack, const HashKey &key)
Definition dualDfpn.cc:614
osl::checkmate::DualDfpn::writeRootHistory
void writeRootHistory(const RepetitionCounter &counter, const MoveStack &moves, const SimpleState &state, Player attack)
Definition dualDfpn.cc:577
osl::checkmate::DualDfpn::shared
std::shared_ptr< Shared > shared
Definition dualDfpn.h:33
osl::checkmate::DualDfpn::setRootPlayer
void setRootPlayer(Player)
Definition dualDfpn.cc:602
osl::checkmate::DualDfpn::table
const DfpnTable & table(Player) const
Definition dualDfpn.cc:640
osl::checkmate::DualDfpn::DualDfpn
DualDfpn(uint64_t ignored=std::numeric_limits< uint64_t >::max())
Definition dualDfpn.cc:264
osl::checkmate::DualDfpn::local
std::unique_ptr< Local > local
Definition dualDfpn.h:34
osl::checkmate::ProofDisproof
証明数(proof number)と反証数(disproof number).
Definition proofDisproof.h:17
osl::checkmate::ProofDisproof::isCheckmateSuccess
bool isCheckmateSuccess() const
Definition proofDisproof.h:86
osl::container::MoveStack
Move のstack.
Definition moveStack.h:15
osl::hash::HashKey
Definition hashKey.h:153
hashKey.h
moveStack.h
PathEncoding
Definition pathEncoding.cc:12
osl::checkmate
Definition king8Info.h:12
osl
Definition additionalEffect.h:6
osl::Player
Player
Definition basic_type.h:8
numEffectState.h
pathEncoding.h
proofDisproof.h