MUQ  0.4.3
muq::SamplingAlgorithms::TransitionKernel Class Referenceabstract

Defines the transition kernel used by an MCMC algorithm. More...

#include <TransitionKernel.h>

Inheritance diagram for muq::SamplingAlgorithms::TransitionKernel:

Detailed Description

Defines the transition kernel used by an MCMC algorithm.

Definition at line 35 of file TransitionKernel.h.

Public Types

typedef boost::function< std::shared_ptr< TransitionKernel >boost::property_tree::ptree, std::shared_ptr< AbstractSamplingProblem >)> TransitionKernelConstructor
 
typedef std::map< std::string, TransitionKernelConstructorTransitionKernelMap
 

Public Member Functions

 TransitionKernel (boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > problem)
 
virtual ~TransitionKernel ()=default
 
virtual void SetCommunicator (std::shared_ptr< parcer::Communicator > newcomm)
 
virtual void PreStep (unsigned int const t, std::shared_ptr< SamplingState > state)
 Allow the kernel to preprocess the current step. More...
 
virtual void PostStep (unsigned int const t, std::vector< std::shared_ptr< SamplingState >> const &state)
 Allow the kernel to adapt given a new state. More...
 
virtual std::vector< std::shared_ptr< SamplingState > > Step (unsigned int const t, std::shared_ptr< SamplingState > prevState)=0
 
virtual void PrintStatus () const
 
virtual void PrintStatus (std::string prefix) const
 
virtual void SetBlockInd (int newBlockInd)
 
virtual int GetBlockInd () const
 
virtual std::shared_ptr< AbstractSamplingProblem > const & Problem () const
 

Static Public Member Functions

static std::shared_ptr< TransitionKernelConstruct (boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > problem)
 Static constructor for the transition kernel. More...
 
static std::shared_ptr< TransitionKernelMapGetTransitionKernelMap ()
 

Member Typedef Documentation

◆ TransitionKernelConstructor

typedef boost::function<std::shared_ptr<TransitionKernel>boost::property_tree::ptree, std::shared_ptr<AbstractSamplingProblem>)> muq::SamplingAlgorithms::TransitionKernel::TransitionKernelConstructor

Definition at line 53 of file TransitionKernel.h.

◆ TransitionKernelMap

Constructor & Destructor Documentation

◆ TransitionKernel()

TransitionKernel::TransitionKernel ( boost::property_tree::ptree const &  pt,
std::shared_ptr< AbstractSamplingProblem problem 
)

Definition at line 7 of file TransitionKernel.cpp.

◆ ~TransitionKernel()

virtual muq::SamplingAlgorithms::TransitionKernel::~TransitionKernel ( )
virtualdefault

Member Function Documentation

◆ Construct()

std::shared_ptr< TransitionKernel > TransitionKernel::Construct ( boost::property_tree::ptree const &  pt,
std::shared_ptr< AbstractSamplingProblem problem 
)
static

Static constructor for the transition kernel.

Parameters
[in]ptParameters for the kernel
[in]problemThe sampling problem that evaluates/samples the distribution we are trying to characterize
Returns
The transition kernel

Definition at line 25 of file TransitionKernel.cpp.

References GetTransitionKernelMap(), and problem.

Referenced by muq::SamplingAlgorithms::MonteCarlo::ConstructKernel(), muq::SamplingAlgorithms::ParallelTempering::ExtractKernels(), and muq::SamplingAlgorithms::DILIKernel::UpdateKernels().

◆ GetBlockInd()

virtual int muq::SamplingAlgorithms::TransitionKernel::GetBlockInd ( ) const
inlinevirtual

Definition at line 85 of file TransitionKernel.h.

References blockInd.

◆ GetTransitionKernelMap()

std::shared_ptr< TransitionKernel::TransitionKernelMap > TransitionKernel::GetTransitionKernelMap ( )
static

Definition at line 13 of file TransitionKernel.cpp.

Referenced by Construct().

◆ PostStep()

virtual void muq::SamplingAlgorithms::TransitionKernel::PostStep ( unsigned int const  t,
std::vector< std::shared_ptr< SamplingState >> const &  state 
)
inlinevirtual

Allow the kernel to adapt given a new state.

By default this function does nothing but children can override it to adapt the kernel

Parameters
[in]tThe current step
[in]stateThe current state

Reimplemented in muq::SamplingAlgorithms::MIKernel, muq::SamplingAlgorithms::MIDummyKernel, muq::SamplingAlgorithms::MHKernel, muq::SamplingAlgorithms::DummyKernel, muq::SamplingAlgorithms::DRKernel, and muq::SamplingAlgorithms::DILIKernel.

Definition at line 71 of file TransitionKernel.h.

◆ PreStep()

virtual void muq::SamplingAlgorithms::TransitionKernel::PreStep ( unsigned int const  t,
std::shared_ptr< SamplingState state 
)
inlinevirtual

Allow the kernel to preprocess the current step.

By default this function does nothing but children can override it to adapt the kernel

Parameters
[in]tThe current step
[in]stateThe current state

Reimplemented in muq::SamplingAlgorithms::GMHKernel.

Definition at line 63 of file TransitionKernel.h.

◆ PrintStatus() [1/2]

virtual void muq::SamplingAlgorithms::TransitionKernel::PrintStatus ( ) const
inlinevirtual

Definition at line 79 of file TransitionKernel.h.

References PrintStatus().

Referenced by PrintStatus().

◆ PrintStatus() [2/2]

virtual void muq::SamplingAlgorithms::TransitionKernel::PrintStatus ( std::string  prefix) const
inlinevirtual

◆ Problem()

virtual std::shared_ptr<AbstractSamplingProblem> const& muq::SamplingAlgorithms::TransitionKernel::Problem ( ) const
inlinevirtual

Get access to the problem that this kernel is defined by.

Definition at line 88 of file TransitionKernel.h.

References problem.

◆ SetBlockInd()

virtual void muq::SamplingAlgorithms::TransitionKernel::SetBlockInd ( int  newBlockInd)
inlinevirtual

Reimplemented in muq::SamplingAlgorithms::MHKernel, and muq::SamplingAlgorithms::DRKernel.

Definition at line 84 of file TransitionKernel.h.

References blockInd.

◆ SetCommunicator()

void TransitionKernel::SetCommunicator ( std::shared_ptr< parcer::Communicator >  newcomm)
virtual

Definition at line 48 of file TransitionKernel.cpp.

References comm.

◆ Step()

virtual std::vector<std::shared_ptr<SamplingState> > muq::SamplingAlgorithms::TransitionKernel::Step ( unsigned int const  t,
std::shared_ptr< SamplingState prevState 
)
pure virtual

Member Data Documentation

◆ blockInd

◆ comm

std::shared_ptr<parcer::Communicator> muq::SamplingAlgorithms::TransitionKernel::comm
protected

◆ problem

◆ reeval

const bool muq::SamplingAlgorithms::TransitionKernel::reeval
protected

true: reevaluate the log density (even if one already exists), false: use stored log density

For example, if the log-density is a continually refined surrogate (LA-MCMC) or an importance sampling estimate (pseudo-marginal) then we need to reevaluate every time.

Definition at line 105 of file TransitionKernel.h.

Referenced by muq::SamplingAlgorithms::DRKernel::Step(), and muq::SamplingAlgorithms::MHKernel::Step().


The documentation for this class was generated from the following files: