1 #include "AllClassWrappers.h"
15 #include <pybind11/pybind11.h>
16 #include <pybind11/stl.h>
17 #include <pybind11/eigen.h>
18 #include <pybind11/iostream.h>
19 #include <pybind11/numpy.h>
40 py::class_<SingleChainMCMC, std::shared_ptr<SingleChainMCMC>> singleMCMC(m,
"SingleChainMCMC");
47 .def(
"Run", (std::shared_ptr<MarkovChain> (
SingleChainMCMC::*)(std::vector<Eigen::VectorXd>
const&)) &
SingleChainMCMC::Run, py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
54 py::class_<ParallelTempering, std::shared_ptr<ParallelTempering>>(m,
"ParallelTempering")
56 .def(py::init( [](py::dict d, Eigen::VectorXd
const& invTemps, std::vector<std::shared_ptr<TransitionKernel>> kerns) {
return new ParallelTempering(
ConvertDictToPtree(d), invTemps, kerns);}))
57 .def(py::init( [](py::dict d, Eigen::VectorXd
const& invTemps, std::vector<std::vector<std::shared_ptr<TransitionKernel>>> kerns) {
return new ParallelTempering(
ConvertDictToPtree(d), invTemps, kerns);}))
73 py::class_<MIMCMCBox, std::shared_ptr<MIMCMCBox>> multiindexMCMCBox(m,
"MIMCMCBox");
81 py::class_<MIMCMC, std::shared_ptr<MIMCMC>> multiindexMCMC(m,
"MIMCMC");
83 .def(py::init( [](py::dict d, Eigen::VectorXd startingPoint, std::vector<std::shared_ptr<AbstractSamplingProblem>>
const& problems) {
return new MIMCMC(
ConvertDictToPtree(d), startingPoint, problems); }))
84 .def(py::init( [](py::dict d, Eigen::VectorXd startingPoint, std::vector<std::shared_ptr<ModPiece>>
const& models) {
return new MIMCMC(
ConvertDictToPtree(d), startingPoint, models); }))
85 .def(py::init( [](py::dict d, Eigen::VectorXd startingPoint, std::vector<std::shared_ptr<AbstractSamplingProblem>>
const& problems, std::shared_ptr<MultiIndexSet>
const& indices) {
return new MIMCMC(
ConvertDictToPtree(d), startingPoint, problems, indices); }))
86 .def(py::init( [](py::dict d, Eigen::VectorXd startingPoint, std::vector<std::shared_ptr<ModPiece>>
const& models, std::shared_ptr<MultiIndexSet>
const& indices) {
return new MIMCMC(
ConvertDictToPtree(d), startingPoint, models, indices); }))
87 .def(
"Run", &
MIMCMC::Run, py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
93 py::class_<MCMCFactory, std::shared_ptr<MCMCFactory>> fact(m,
"MCMCFactory");
96 py::call_guard<py::scoped_ostream_redirect,py::scoped_estream_redirect>() );
static std::shared_ptr< SingleChainMCMC > CreateSingleChain(boost::property_tree::ptree pt, std::shared_ptr< AbstractSamplingProblem > problem)
std::shared_ptr< SingleChainMCMC > FinestChain()
std::shared_ptr< MultiIndexSet > GetBoxIndices()
std::shared_ptr< MultiIndex > GetHighestIndex()
std::shared_ptr< SingleChainMCMC > GetChain(std::shared_ptr< MultiIndex > index)
std::shared_ptr< MultiIndexSet > GetIndices()
Get set of indices of boxes set up by the method.
virtual std::shared_ptr< MultiIndexEstimator > GetQOIs() const
std::shared_ptr< MIMCMCBox > GetMIMCMCBox(std::shared_ptr< MultiIndex > index)
virtual std::shared_ptr< MultiIndexEstimator > Run()
virtual std::shared_ptr< MultiIndexEstimator > GetSamples() const
Defines an MCMC sampler with multiple chains running on problems with different temperatues.
const unsigned int numTemps
Number of temperatures in the temperature schedule.
std::shared_ptr< MarkovChain > GetQOIs() const
double GetInverseTemp(unsigned int chainInd) const
void SetState(std::vector< std::shared_ptr< SamplingState >> const &x0)
Set the state of the MCMC chain.
void AddNumSamps(unsigned int numNewSamps)
std::vector< std::shared_ptr< TransitionKernel > > const & Kernels(unsigned int chainInd) const
unsigned int NumSamps() const
std::shared_ptr< MarkovChain > Run()
std::shared_ptr< MarkovChain > GetSamples() const
Defines an MCMC sampler with a single chain.
virtual std::shared_ptr< MarkovChain > GetSamples() const
virtual double TotalTime()
virtual unsigned int NumSamps() const
std::shared_ptr< MarkovChain > Run(Args const &... args)
virtual void SetState(std::shared_ptr< SamplingState > const &x0)
Set the state of the MCMC chain.
virtual std::vector< std::shared_ptr< TransitionKernel > > & Kernels()
virtual void AddNumSamps(unsigned int numNewSamps)
std::shared_ptr< MarkovChain > GetQOIs() const
void MCMCWrapper(pybind11::module &m)
boost::property_tree::ptree ConvertDictToPtree(pybind11::dict dict)