16 #include <boost/property_tree/ptree.hpp>
18 namespace pt = boost::property_tree;
23 #include "ParallelProblem.h"
26 int main(
int argc,
char **argv){
28 MPI_Init(&argc, &argv);
32 pt.put(
"NumSamples", 1e3);
33 pt.put(
"NumInitialSamples", 1e3);
34 pt.put(
"GreedyTargetVariance", 0.05);
35 pt.put(
"verbosity", 1);
36 pt.put(
"MLMCMC.Subsampling_0", 8);
37 pt.put(
"MLMCMC.Subsampling_1", 4);
38 pt.put(
"MLMCMC.Subsampling_2", 2);
39 pt.put(
"MLMCMC.Subsampling_3", 0);
41 auto localFactory = std::make_shared<MyMIComponentFactory>(pt);
43 std::cout << std::endl <<
"*************** greedy multillevel chain" << std::endl << std::endl;
45 auto comm = std::make_shared<parcer::Communicator>();
46 localFactory->SetComm(comm);
47 auto componentFactory = std::make_shared<ParallelMIComponentFactory>(comm, comm, localFactory);
49 if (comm->GetRank() == 0) {
52 std::cout <<
"mean QOI: " << greedymlmcmc.
GetQOIs()->Mean().transpose() << std::endl;
56 if (comm->GetRank() == 0) {
57 std::cout << std::endl <<
"*************** single chain reference" << std::endl << std::endl;
59 SLMCMC slmcmc (pt, componentFactory);
61 componentFactory->finalize();
62 std::cout <<
"mean QOI: " << slmcmc.
GetQOIs()->Mean().transpose() << std::endl;
int main(int argc, char **argv)
Greedy Multilevel MCMC method.
virtual std::shared_ptr< MultiIndexEstimator > GetQOIs() const
virtual std::shared_ptr< MultiIndexEstimator > Run()
Single-level MCMC for multiindex sampling problems.
virtual std::shared_ptr< MarkovChain > GetQOIs() const
virtual std::shared_ptr< MarkovChain > Run()