1 #ifndef MCMCPROPOSAL_H_
2 #define MCMCPROPOSAL_H_
7 #include <boost/property_tree/ptree.hpp>
12 #include <parcer/Communicator.h>
23 namespace SamplingAlgorithms {
36 class MCMCProposal :
public std::enable_shared_from_this<MCMCProposal> {
40 std::shared_ptr<AbstractSamplingProblem>
const& probIn);
49 static std::shared_ptr<MCMCProposal>
Construct(boost::property_tree::ptree
const& pt,
50 std::shared_ptr<AbstractSamplingProblem>
const& probIn);
53 typedef std::function<std::shared_ptr<MCMCProposal>(boost::property_tree::ptree,std::shared_ptr<AbstractSamplingProblem>)>
MCMCProposalConstructor;
63 virtual void Adapt(
unsigned int const t, std::vector<std::shared_ptr<SamplingState>>
const& state) {};
65 virtual std::shared_ptr<SamplingState>
Sample(std::shared_ptr<SamplingState>
const& currentState) = 0;
67 virtual double LogDensity(std::shared_ptr<SamplingState>
const& currState,
68 std::shared_ptr<SamplingState>
const& propState) = 0;
81 std::shared_ptr<AbstractSamplingProblem>
prob;
84 std::shared_ptr<parcer::Communicator>
comm;
90 #define REGISTER_MCMC_PROPOSAL(NAME) static auto reg ##NAME \
91 = muq::SamplingAlgorithms::MCMCProposal::GetMCMCProposalMap()->insert(std::make_pair(#NAME, muq::Utilities::shared_factory<NAME>()));
virtual void Adapt(unsigned int const t, std::vector< std::shared_ptr< SamplingState >> const &state)
Adapt the proposal after each step.
virtual ~MCMCProposal()=default
virtual std::shared_ptr< SamplingState > Sample(std::shared_ptr< SamplingState > const ¤tState)=0
static std::shared_ptr< MCMCProposalMap > GetMCMCProposalMap()
std::shared_ptr< parcer::Communicator > comm
std::function< std::shared_ptr< MCMCProposal >boost::property_tree::ptree, std::shared_ptr< AbstractSamplingProblem >)> MCMCProposalConstructor
void SetCommunicator(std::shared_ptr< parcer::Communicator > newcomm)
std::shared_ptr< AbstractSamplingProblem > prob
virtual void SetBlockInd(int newBlockInd)
virtual double LogDensity(std::shared_ptr< SamplingState > const &currState, std::shared_ptr< SamplingState > const &propState)=0
static std::shared_ptr< MCMCProposal > Construct(boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > const &probIn)
Static constructor for the transition kernel.
MCMCProposal(boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > const &probIn)
virtual int GetBlockInd() const
std::map< std::string, MCMCProposalConstructor > MCMCProposalMap