MUQ  0.4.3
GreedyMLMCMC.h
Go to the documentation of this file.
1 #ifndef GreedyMLMCMC_H
2 #define GreedyMLMCMC_H
3 
4 #include <boost/property_tree/ptree.hpp>
5 
8 
10 
11 #include "MUQ/Modeling/ModPiece.h"
14 
15 namespace muq {
16  namespace SamplingAlgorithms {
17 
24  class GreedyMLMCMC {
25  public:
26  GreedyMLMCMC (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  GreedyMLMCMC (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  GreedyMLMCMC (boost::property_tree::ptree pt,
37  std::shared_ptr<MIComponentFactory> componentFactory);
38 
39  virtual std::shared_ptr<MultiIndexEstimator> GetSamples() const;
40  virtual std::shared_ptr<MultiIndexEstimator> GetQOIs() const;
41 
42  void Draw(bool drawSamples = true);
43 
44  std::shared_ptr<MIMCMCBox> GetBox(int index);
45  std::vector<std::shared_ptr<MIMCMCBox>> GetBoxes();
46 
47  void WriteToFile(std::string filename);
48 
49  virtual std::shared_ptr<MultiIndexEstimator> Run();
50 
51  protected:
52 
53  private:
54  static std::vector<std::shared_ptr<AbstractSamplingProblem>> CreateProblems(std::vector<std::shared_ptr<muq::Modeling::ModPiece>> const& models);
55  static std::shared_ptr<MultiIndexSet> ProcessMultis(std::shared_ptr<MultiIndexSet> const& multis, unsigned int numLevels);
56 
57 
58  std::shared_ptr<MIComponentFactory> componentFactory;
59  const int numInitialSamples;
60  const double e;
61  const double beta;
62  const int levels;
63  int verbosity;
64  std::vector<std::shared_ptr<MIMCMCBox>> boxes;
65  bool useQOIs; // <- Whether or not the sampling problems have QOIs. If not, the parameters themselves are used for assessing estimator variance.
66  };
67 
68  }
69 }
70 
71 #endif
Greedy Multilevel MCMC method.
Definition: GreedyMLMCMC.h:24
static std::shared_ptr< MultiIndexSet > ProcessMultis(std::shared_ptr< MultiIndexSet > const &multis, unsigned int numLevels)
virtual std::shared_ptr< MultiIndexEstimator > GetQOIs() const
void WriteToFile(std::string filename)
GreedyMLMCMC(boost::property_tree::ptree pt, Eigen::VectorXd const &startPt, std::vector< std::shared_ptr< muq::Modeling::ModPiece >> const &models, std::shared_ptr< MultiIndexSet > const &multis=nullptr)
std::shared_ptr< MIMCMCBox > GetBox(int index)
std::shared_ptr< MIComponentFactory > componentFactory
Definition: GreedyMLMCMC.h:58
virtual std::shared_ptr< MultiIndexEstimator > Run()
std::vector< std::shared_ptr< MIMCMCBox > > GetBoxes()
void Draw(bool drawSamples=true)
virtual std::shared_ptr< MultiIndexEstimator > GetSamples() const
static std::vector< std::shared_ptr< AbstractSamplingProblem > > CreateProblems(std::vector< std::shared_ptr< muq::Modeling::ModPiece >> const &models)
std::vector< std::shared_ptr< MIMCMCBox > > boxes
Definition: GreedyMLMCMC.h:64
GreedyMLMCMC(boost::property_tree::ptree pt, Eigen::VectorXd const &startPt, std::vector< std::shared_ptr< AbstractSamplingProblem >> const &problems, std::shared_ptr< MultiIndexSet > const &multis=nullptr)