8 namespace pt = boost::property_tree;
13 MIDummyKernel::MIDummyKernel(boost::property_tree::ptree
const& pt,
14 std::shared_ptr<AbstractSamplingProblem> problem,
15 std::shared_ptr<MCMCProposal> proposal,
16 std::shared_ptr<MCMCProposal> coarse_proposal,
17 std::shared_ptr<MIInterpolation> proposalInterpolation,
18 std::shared_ptr<SingleChainMCMC> coarse_chain)
21 coarse_proposal(coarse_proposal),
22 proposalInterpolation(proposalInterpolation),
23 coarse_chain(coarse_chain)
33 std::vector<std::shared_ptr<SamplingState>>
MIDummyKernel::Step(
unsigned int const t, std::shared_ptr<SamplingState> prevState){
40 std::shared_ptr<SamplingState> coarsePrevState;
41 if(prevState->HasMeta(
"coarseSample")) {
42 coarsePrevState =
AnyCast(prevState->meta[
"coarseSample"]);
48 std::shared_ptr<SamplingState> fineProp =
proposal->Sample(prevState);
49 std::shared_ptr<SamplingState> coarseProp =
coarse_proposal->Sample(coarsePrevState);
54 if (
problem->numBlocksQOI > 0) {
55 prop->meta[
"QOI"] =
problem->QOI();
57 return std::vector<std::shared_ptr<SamplingState>>(1, prop);
62 std::stringstream msg;
63 msg << prefix <<
"MI dummy kernel was called " <<
numCalls <<
" times";
65 std::cout << msg.str() << std::endl;
virtual std::vector< std::shared_ptr< SamplingState > > Step(unsigned int const t, std::shared_ptr< SamplingState > prevState) override
std::shared_ptr< MCMCProposal > proposal
std::shared_ptr< MCMCProposal > coarse_proposal
virtual void PostStep(unsigned int const t, std::vector< std::shared_ptr< SamplingState >> const &state) override
Allow the kernel to adapt given a new state.
std::shared_ptr< MIInterpolation > proposalInterpolation
std::shared_ptr< SingleChainMCMC > coarse_chain
Defines the transition kernel used by an MCMC algorithm.
std::shared_ptr< AbstractSamplingProblem > problem
The sampling problem that evaluates/samples the target distribution.
virtual void PrintStatus() const
Class for easily casting boost::any's in assignment operations.