MUQ  0.4.3
MIKernel.h
Go to the documentation of this file.
1 #ifndef MIKERNEL_H_
2 #define MIKERNEL_H_
3 
5 
7 
9 
11 
12 namespace muq {
13  namespace SamplingAlgorithms {
14 
19  class MIKernel : public TransitionKernel {
20  public:
21 
22  MIKernel(boost::property_tree::ptree const& pt,
23  std::shared_ptr<AbstractSamplingProblem> problem,
24  std::shared_ptr<AbstractSamplingProblem> coarse_problem,
25  std::shared_ptr<MCMCProposal> proposal,
26  std::shared_ptr<MCMCProposal> coarse_proposal,
27  std::shared_ptr<MIInterpolation> proposalInterpolation,
28  std::shared_ptr<SingleChainMCMC> coarse_chain);
29 
30  ~MIKernel();
31 
32  virtual std::shared_ptr<MCMCProposal> Proposal(){return proposal;};
33 
34  virtual void PostStep(unsigned int const t, std::vector<std::shared_ptr<SamplingState>> const& state) override;
35 
36  virtual void PrintStatus(std::string prefix) const override;
37 
38  virtual std::vector<std::shared_ptr<SamplingState>> Step(unsigned int const t, std::shared_ptr<SamplingState> prevState) override;
39 
40  virtual double AcceptanceRate() const{return double(numAccepts)/double(numCalls);};
41 
42  protected:
43  std::shared_ptr<AbstractSamplingProblem> coarse_problem;
44  std::shared_ptr<MCMCProposal> proposal;
45  std::shared_ptr<MCMCProposal> coarse_proposal;
46  std::shared_ptr<MIInterpolation> proposalInterpolation;
47  std::shared_ptr<SingleChainMCMC> coarse_chain;
48 
49  unsigned int numCalls = 0;
50  unsigned int numAccepts = 0;
51 
52  };
53  } // namespace SamplingAlgorithms
54 } // namespace muq
55 
56 #endif
MCMC kernel for Multiindex methods.
Definition: MIKernel.h:19
std::shared_ptr< AbstractSamplingProblem > coarse_problem
Definition: MIKernel.h:40
std::shared_ptr< SingleChainMCMC > coarse_chain
Definition: MIKernel.h:47
virtual std::shared_ptr< MCMCProposal > Proposal()
Definition: MIKernel.h:32
std::shared_ptr< MCMCProposal > proposal
Definition: MIKernel.h:44
std::shared_ptr< MIInterpolation > proposalInterpolation
Definition: MIKernel.h:46
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.
Definition: MIKernel.cpp:31
virtual double AcceptanceRate() const
Definition: MIKernel.h:40
std::shared_ptr< MCMCProposal > coarse_proposal
Definition: MIKernel.h:45
MIKernel(boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > problem, std::shared_ptr< AbstractSamplingProblem > coarse_problem, std::shared_ptr< MCMCProposal > proposal, std::shared_ptr< MCMCProposal > coarse_proposal, std::shared_ptr< MIInterpolation > proposalInterpolation, std::shared_ptr< SingleChainMCMC > coarse_chain)
Definition: MIKernel.cpp:14
virtual std::vector< std::shared_ptr< SamplingState > > Step(unsigned int const t, std::shared_ptr< SamplingState > prevState) override
Definition: MIKernel.cpp:35
Defines the transition kernel used by an MCMC algorithm.
std::shared_ptr< AbstractSamplingProblem > problem
The sampling problem that evaluates/samples the target distribution.