MUQ  0.4.3
MIMCMC.h
Go to the documentation of this file.
1 #ifndef MIMCMC_H
2 #define MIMCMC_H
3 
4 #include <boost/property_tree/ptree.hpp>
5 
9 
10 namespace pt = boost::property_tree;
11 
12 
13 namespace muq {
14  namespace SamplingAlgorithms {
15 
21  class MIMCMC {
22  public:
23  MIMCMC(boost::property_tree::ptree options,
24  std::shared_ptr<MIComponentFactory> const& componentFactory);
25 
26  MIMCMC(boost::property_tree::ptree pt,
27  Eigen::VectorXd const& startPt,
28  std::vector<std::shared_ptr<muq::Modeling::ModPiece>> const& models,
29  std::shared_ptr<MultiIndexSet> const& multis = nullptr);
30 
31  MIMCMC(boost::property_tree::ptree pt,
32  Eigen::VectorXd const& startPt,
33  std::vector<std::shared_ptr<AbstractSamplingProblem>> const& problems,
34  std::shared_ptr<MultiIndexSet> const& multis = nullptr);
35 
36  virtual std::shared_ptr<MultiIndexEstimator> GetSamples() const;
37  virtual std::shared_ptr<MultiIndexEstimator> GetQOIs() const;
38 
46  std::shared_ptr<MIMCMCBox> GetBox(std::shared_ptr<MultiIndex> index);
47 
51  void Draw(bool drawSamples = true);
52 
53  std::shared_ptr<MIMCMCBox> GetMIMCMCBox(std::shared_ptr<MultiIndex> index);
54 
58  std::shared_ptr<MultiIndexSet> GetIndices();
59 
60  virtual std::shared_ptr<MultiIndexEstimator> Run();
61 
65  void WriteToFile(std::string filename);
66 
67  private:
68  pt::ptree pt;
69  std::shared_ptr<MultiIndexSet> gridIndices;
70  std::shared_ptr<MIComponentFactory> componentFactory;
71  std::vector<std::shared_ptr<MIMCMCBox>> boxes;
72 
73  std::string multiindexToConfigString (std::shared_ptr<MultiIndex> index);
74 
75  static std::vector<std::shared_ptr<AbstractSamplingProblem>> CreateProblems(std::vector<std::shared_ptr<muq::Modeling::ModPiece>> const& models);
76  static std::shared_ptr<MultiIndexSet> ProcessMultis(std::shared_ptr<MultiIndexSet> const& multis, unsigned int numLevels);
77  };
78 
79  }
80 }
81 
82 #endif
Multiindex MCMC method.
Definition: MIMCMC.h:21
std::shared_ptr< MIMCMCBox > GetBox(std::shared_ptr< MultiIndex > index)
Access an MIMCMCBox.
Definition: MIMCMC.cpp:37
MIMCMC(boost::property_tree::ptree options, std::shared_ptr< MIComponentFactory > const &componentFactory)
void Draw(bool drawSamples=true)
Draw MI structure (mostly debugging purposes)
Definition: MIMCMC.cpp:92
std::string multiindexToConfigString(std::shared_ptr< MultiIndex > index)
Definition: MIMCMC.cpp:84
std::shared_ptr< MultiIndexSet > GetIndices()
Get set of indices of boxes set up by the method.
Definition: MIMCMC.cpp:79
virtual std::shared_ptr< MultiIndexEstimator > GetQOIs() const
Definition: MIMCMC.cpp:48
std::shared_ptr< MIMCMCBox > GetMIMCMCBox(std::shared_ptr< MultiIndex > index)
Definition: MIMCMC.cpp:64
std::shared_ptr< MultiIndexSet > gridIndices
Definition: MIMCMC.h:69
static std::shared_ptr< MultiIndexSet > ProcessMultis(std::shared_ptr< MultiIndexSet > const &multis, unsigned int numLevels)
Definition: MIMCMC.cpp:105
virtual std::shared_ptr< MultiIndexEstimator > Run()
Definition: MIMCMC.cpp:52
static std::vector< std::shared_ptr< AbstractSamplingProblem > > CreateProblems(std::vector< std::shared_ptr< muq::Modeling::ModPiece >> const &models)
Definition: MIMCMC.cpp:115
void WriteToFile(std::string filename)
Write HDF5 output for the entire MIMCMC method.
Definition: MIMCMC.cpp:72
virtual std::shared_ptr< MultiIndexEstimator > GetSamples() const
Definition: MIMCMC.cpp:45
std::vector< std::shared_ptr< MIMCMCBox > > boxes
Definition: MIMCMC.h:71
std::shared_ptr< MIComponentFactory > componentFactory
Definition: MIMCMC.h:70