A class for performing Affine Invariant Ensemble MCMC with stretch sampler. More...
#include <AffineInvariantStretchSampler.h>
Public Types | |
enum | SampleMode { SampleMode::GLOBAL, SampleMode::LOCAL } |
typedef DataFileName | DataFileParameterType |
Public Member Functions | |
AffineInvariantStretchSampler (const InputParameters ¶meters) | |
virtual int | decisionStep () const override |
Return the step after which decision making can begin. More... | |
const std::vector< Real > & | getAffineStepSize () const |
Return the vector of step size for decision making. More... | |
dof_id_type | getNumberOfConfigValues () const |
Return the number of configuration parameters. More... | |
dof_id_type | getNumberOfConfigParams () const |
Return the number of configuration parameters. More... | |
dof_id_type | getNumParallelProposals () const |
Return the number of parallel proposals. More... | |
const std::vector< Real > & | getRandomNumbers () const |
Return the random numbers to facilitate decision making in reporters. More... | |
const std::vector< Real > & | getVarSamples () const |
Return the proposed variance samples to facilitate decision making in reporters. More... | |
const std::vector< const Distribution * > | getPriors () const |
Return the priors to facilitate decision making in reporters. More... | |
const Distribution * | getVarPrior () const |
Return the prior over variance to facilitate decision making in reporters. More... | |
std::vector< Real > | getNextLocalRow () |
dof_id_type | getNumberOfRows () const |
dof_id_type | getNumberOfCols () const |
dof_id_type | getNumberOfLocalRows () const |
const LocalRankConfig & | getRankConfig (bool batch_mode) const |
virtual bool | isAdaptiveSamplingCompleted () const |
libMesh::Parallel::Communicator & | getLocalComm () |
virtual bool | enabled () const |
std::shared_ptr< MooseObject > | getSharedPtr () |
std::shared_ptr< const MooseObject > | getSharedPtr () const |
MooseApp & | getMooseApp () const |
const std::string & | type () const |
virtual const std::string & | name () const |
std::string | typeAndName () const |
std::string | errorPrefix (const std::string &error_type) const |
void | callMooseError (std::string msg, const bool with_prefix) const |
MooseObjectParameterName | uniqueParameterName (const std::string ¶meter_name) const |
const InputParameters & | parameters () const |
MooseObjectName | uniqueName () const |
const T & | getParam (const std::string &name) const |
std::vector< std::pair< T1, T2 > > | getParam (const std::string ¶m1, const std::string ¶m2) const |
const T * | queryParam (const std::string &name) const |
const T & | getRenamedParam (const std::string &old_name, const std::string &new_name) const |
T | getCheckedPointerParam (const std::string &name, const std::string &error_string="") const |
bool | isParamValid (const std::string &name) const |
bool | isParamSetByUser (const std::string &nm) const |
void | paramError (const std::string ¶m, Args... args) const |
void | paramWarning (const std::string ¶m, Args... args) const |
void | paramInfo (const std::string ¶m, Args... args) const |
void | connectControllableParams (const std::string ¶meter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const |
void | mooseError (Args &&... args) const |
void | mooseErrorNonPrefixed (Args &&... args) const |
void | mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const |
void | mooseWarning (Args &&... args) const |
void | mooseWarningNonPrefixed (Args &&... args) const |
void | mooseDeprecated (Args &&... args) const |
void | mooseInfo (Args &&... args) const |
std::string | getDataFileName (const std::string ¶m) const |
std::string | getDataFileNameByName (const std::string &relative_path) const |
std::string | getDataFilePath (const std::string &relative_path) const |
virtual void | initialSetup () |
virtual void | timestepSetup () |
virtual void | jacobianSetup () |
virtual void | residualSetup () |
virtual void | subdomainSetup () |
virtual void | customSetup (const ExecFlagType &) |
const ExecFlagEnum & | getExecuteOnEnum () const |
PerfGraph & | perfGraph () |
T & | getSampler (const std::string &name) |
Sampler & | getSampler (const std::string &name) |
T & | getSamplerByName (const SamplerName &name) |
Sampler & | getSamplerByName (const SamplerName &name) |
const VectorPostprocessorValue & | getVectorPostprocessorValue (const std::string ¶m_name, const std::string &vector_name) const |
const VectorPostprocessorValue & | getVectorPostprocessorValue (const std::string ¶m_name, const std::string &vector_name, bool needs_broadcast) const |
const VectorPostprocessorValue & | getVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const |
const VectorPostprocessorValue & | getVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const |
const VectorPostprocessorValue & | getVectorPostprocessorValueOld (const std::string ¶m_name, const std::string &vector_name) const |
const VectorPostprocessorValue & | getVectorPostprocessorValueOld (const std::string ¶m_name, const std::string &vector_name, bool needs_broadcast) const |
const VectorPostprocessorValue & | getVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const |
const VectorPostprocessorValue & | getVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const |
const ScatterVectorPostprocessorValue & | getScatterVectorPostprocessorValue (const std::string ¶m_name, const std::string &vector_name) const |
const ScatterVectorPostprocessorValue & | getScatterVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const |
const ScatterVectorPostprocessorValue & | getScatterVectorPostprocessorValueOld (const std::string ¶m_name, const std::string &vector_name) const |
const ScatterVectorPostprocessorValue & | getScatterVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const |
bool | hasVectorPostprocessor (const std::string ¶m_name, const std::string &vector_name) const |
bool | hasVectorPostprocessor (const std::string ¶m_name) const |
bool | hasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const |
bool | hasVectorPostprocessorByName (const VectorPostprocessorName &name) const |
const VectorPostprocessorName & | getVectorPostprocessorName (const std::string ¶m_name) const |
DenseMatrix< Real > | getGlobalSamples () |
DenseMatrix< Real > | getGlobalSamples () |
DenseMatrix< Real > | getLocalSamples () |
DenseMatrix< Real > | getLocalSamples () |
dof_id_type | getLocalRowBegin () const |
dof_id_type | getLocalRowBegin () const |
dof_id_type | getLocalRowEnd () const |
dof_id_type | getLocalRowEnd () const |
const Distribution & | getDistribution (const std::string &name) const |
const T & | getDistribution (const std::string &name) const |
const Distribution & | getDistribution (const std::string &name) const |
const T & | getDistribution (const std::string &name) const |
const Distribution & | getDistributionByName (const DistributionName &name) const |
const T & | getDistributionByName (const std::string &name) const |
const Distribution & | getDistributionByName (const DistributionName &name) const |
const T & | getDistributionByName (const std::string &name) const |
bool | isVectorPostprocessorDistributed (const std::string ¶m_name) const |
bool | isVectorPostprocessorDistributed (const std::string ¶m_name) const |
bool | isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const |
bool | isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
bool | isImplicit () |
Moose::StateArg | determineState () const |
Static Public Member Functions | |
static InputParameters | validParams () |
Public Attributes | |
const ConsoleStream | _console |
Protected Types | |
enum | CommMethod |
Protected Member Functions | |
virtual void | proposeSamples (const unsigned int seed_value) override |
Fill in the _new_samples vector of vectors (happens within sampleSetUp) More... | |
virtual void | sampleSetUp (const Sampler::SampleMode mode) override |
virtual Real | computeSample (dof_id_type row_index, dof_id_type col_index) override |
void | randomIndex (const unsigned int &upper_bound, const unsigned int &exclude, const unsigned int &seed, unsigned int &req_index) |
Sample a random index excluding a specified index. More... | |
void | randomIndexPair (const unsigned int &upper_bound, const unsigned int &exclude, const unsigned int &seed, unsigned int &req_index1, unsigned int &req_index2) |
Sample two random indices without repitition excluding a specified index. More... | |
void | setNumberOfRandomSeeds (std::size_t number) |
Real | getRand (unsigned int index=0) |
uint32_t | getRandl (unsigned int index, uint32_t lower, uint32_t upper) |
virtual LocalRankConfig | constructRankConfig (bool batch_mode) const |
PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level) const |
PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const |
std::string | timedSectionName (const std::string §ion_name) const |
virtual void | addVectorPostprocessorDependencyHelper (const VectorPostprocessorName &) const |
const ReporterName & | getReporterName (const std::string ¶m_name) const |
virtual void | addReporterDependencyHelper (const ReporterName &) |
void | setNumberOfRows (dof_id_type n_rows) |
void | setNumberOfRows (dof_id_type n_rows) |
void | setNumberOfCols (dof_id_type n_cols) |
void | setNumberOfCols (dof_id_type n_cols) |
virtual void | sampleTearDown (const SampleMode) |
virtual void | sampleTearDown (const SampleMode) |
virtual void | computeSampleMatrix (DenseMatrix< Real > &matrix) |
virtual void | computeSampleMatrix (DenseMatrix< Real > &matrix) |
virtual void | computeLocalSampleMatrix (DenseMatrix< Real > &matrix) |
virtual void | computeLocalSampleMatrix (DenseMatrix< Real > &matrix) |
virtual void | computeSampleRow (dof_id_type i, std::vector< Real > &data) |
virtual void | computeSampleRow (dof_id_type i, std::vector< Real > &data) |
virtual void | advanceGenerators (const dof_id_type count) |
virtual void | advanceGenerators (const dof_id_type count) |
virtual void | advanceGenerator (const unsigned int seed_index, const dof_id_type count) |
virtual void | advanceGenerator (const unsigned int seed_index, const dof_id_type count) |
void | setAutoAdvanceGenerators (const bool state) |
void | setAutoAdvanceGenerators (const bool state) |
void | shuffle (std::vector< T > &data, const std::size_t seed_index=0, const CommMethod method=CommMethod::LOCAL) |
void | shuffle (std::vector< T > &data, const std::size_t seed_index=0, const CommMethod method=CommMethod::LOCAL) |
virtual void | executeSetUp () |
virtual void | executeSetUp () |
virtual void | executeTearDown () |
virtual void | executeTearDown () |
void | saveGeneratorState () |
void | saveGeneratorState () |
void | restoreGeneratorState () |
void | restoreGeneratorState () |
const T & | getReporterValue (const std::string ¶m_name, const std::size_t time_index=0) |
const T & | getReporterValue (const std::string ¶m_name, ReporterMode mode, const std::size_t time_index=0) |
const T & | getReporterValue (const std::string ¶m_name, const std::size_t time_index=0) |
const T & | getReporterValue (const std::string ¶m_name, ReporterMode mode, const std::size_t time_index=0) |
const T & | getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0) |
const T & | getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0) |
const T & | getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0) |
const T & | getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0) |
bool | hasReporterValue (const std::string ¶m_name) const |
bool | hasReporterValue (const std::string ¶m_name) const |
bool | hasReporterValue (const std::string ¶m_name) const |
bool | hasReporterValue (const std::string ¶m_name) const |
bool | hasReporterValueByName (const ReporterName &reporter_name) const |
bool | hasReporterValueByName (const ReporterName &reporter_name) const |
bool | hasReporterValueByName (const ReporterName &reporter_name) const |
bool | hasReporterValueByName (const ReporterName &reporter_name) const |
Protected Attributes | |
const Real | _step_size |
The step size for the stretch sampler. More... | |
const std::vector< std::vector< Real > > & | _previous_state |
Reporter value with the previous state of all the walkers. More... | |
const std::vector< Real > & | _previous_state_var |
Reporter value with the previous state of all the walkers for variance. More... | |
std::vector< Real > | _affine_step |
Vector of affine step sizes. More... | |
const unsigned int | _num_parallel_proposals |
Number of parallel proposals to be made and subApps to be executed. More... | |
std::vector< const Distribution * > | _priors |
Storage for prior distribution objects to be utilized. More... | |
const Distribution * | _var_prior |
Storage for prior distribution object of the variance to be utilized. More... | |
const std::vector< Real > * | _lower_bound |
Lower bounds for making the next proposal. More... | |
const std::vector< Real > * | _upper_bound |
Upper bounds for making the next proposal. More... | |
int | _check_step |
Ensure that the MCMC algorithm proceeds in a sequential fashion. More... | |
const std::vector< Real > & | _initial_values |
Initial values of the input params to get the MCMC scheme started. More... | |
std::vector< std::vector< Real > > | _new_samples |
Vectors of new proposed samples. More... | |
std::vector< Real > | _new_var_samples |
Vector of new proposed variance samples. More... | |
std::vector< Real > | _rnd_vec |
Vector of random numbers for decision making. More... | |
NONE | |
LOCAL | |
SEMI_LOCAL | |
const dof_id_type | _min_procs_per_row |
const dof_id_type | _max_procs_per_row |
libMesh::Parallel::Communicator | _local_comm |
const bool & | _enabled |
MooseApp & | _app |
const std::string | _type |
const std::string | _name |
const InputParameters & | _pars |
Factory & | _factory |
ActionFactory & | _action_factory |
const ExecFlagEnum & | _execute_enum |
const ExecFlagType & | _current_execute_flag |
MooseApp & | _pg_moose_app |
const std::string | _prefix |
const Parallel::Communicator & | _communicator |
const InputParameters & | _ti_params |
FEProblemBase & | _ti_feproblem |
bool | _is_implicit |
Real & | _t |
const Real & | _t_old |
int & | _t_step |
Real & | _dt |
Real & | _dt_old |
bool | _is_transient |
A class for performing Affine Invariant Ensemble MCMC with stretch sampler.
Definition at line 17 of file AffineInvariantStretchSampler.h.
AffineInvariantStretchSampler::AffineInvariantStretchSampler | ( | const InputParameters & | parameters | ) |
Definition at line 28 of file AffineInvariantStretchSampler.C.
|
overrideprotectedvirtualinherited |
Implements Sampler.
Definition at line 207 of file PMCMCBase.C.
|
inlineoverridevirtual |
Return the step after which decision making can begin.
Reimplemented from PMCMCBase.
Definition at line 24 of file AffineInvariantStretchSampler.h.
Referenced by proposeSamples().
const std::vector< Real > & AffineInvariantStretchSampler::getAffineStepSize | ( | ) | const |
Return the vector of step size for decision making.
Definition at line 87 of file AffineInvariantStretchSampler.C.
|
inlineinherited |
Return the number of configuration parameters.
Definition at line 34 of file PMCMCBase.h.
Referenced by PMCMCDecision::PMCMCDecision().
|
inlineinherited |
Return the number of configuration parameters.
Definition at line 29 of file PMCMCBase.h.
Referenced by PMCMCDecision::PMCMCDecision().
|
inlineinherited |
Return the number of parallel proposals.
Definition at line 39 of file PMCMCBase.h.
Referenced by PMCMCDecision::PMCMCDecision().
|
inherited |
Return the priors to facilitate decision making in reporters.
Definition at line 195 of file PMCMCBase.C.
|
inherited |
Return the random numbers to facilitate decision making in reporters.
Definition at line 183 of file PMCMCBase.C.
|
inherited |
Return the prior over variance to facilitate decision making in reporters.
Definition at line 201 of file PMCMCBase.C.
|
inherited |
Return the proposed variance samples to facilitate decision making in reporters.
Definition at line 189 of file PMCMCBase.C.
|
overrideprotectedvirtual |
Fill in the _new_samples vector of vectors (happens within sampleSetUp)
seed_value | The seed for the random number generator |
Reimplemented from PMCMCBase.
Definition at line 48 of file AffineInvariantStretchSampler.C.
|
protectedinherited |
Sample a random index excluding a specified index.
upper_bound | The upper bound provided |
exclude | The index to be excluded from sampling |
seed | The seed of the random number generator |
req_index | The required index to be filled |
Definition at line 141 of file PMCMCBase.C.
Referenced by proposeSamples(), and PMCMCBase::randomIndexPair().
|
protectedinherited |
Sample two random indices without repitition excluding a specified index.
upper_bound | The upper bound provided |
exclude | The index to be excluded from sampling |
seed | The seed of the random number generator |
req_index1 | The required index 1 to be filled |
req_index2 | The required index 2 to be filled |
Definition at line 152 of file PMCMCBase.C.
Referenced by AffineInvariantDES::proposeSamples().
|
overrideprotectedvirtualinherited |
Reimplemented from Sampler.
Definition at line 124 of file PMCMCBase.C.
|
static |
Definition at line 15 of file AffineInvariantStretchSampler.C.
|
protected |
Vector of affine step sizes.
Definition at line 44 of file AffineInvariantStretchSampler.h.
Referenced by AffineInvariantStretchSampler(), getAffineStepSize(), and proposeSamples().
|
protectedinherited |
Ensure that the MCMC algorithm proceeds in a sequential fashion.
Definition at line 121 of file PMCMCBase.h.
Referenced by PMCMCBase::PMCMCBase(), and PMCMCBase::sampleSetUp().
|
protectedinherited |
Initial values of the input params to get the MCMC scheme started.
Definition at line 124 of file PMCMCBase.h.
Referenced by PMCMCBase::computeSample(), PMCMCBase::PMCMCBase(), and IndependentGaussianMH::proposeSamples().
|
protectedinherited |
Lower bounds for making the next proposal.
Definition at line 115 of file PMCMCBase.h.
Referenced by PMCMCBase::PMCMCBase(), AffineInvariantDES::proposeSamples(), IndependentGaussianMH::proposeSamples(), and proposeSamples().
|
protectedinherited |
Vectors of new proposed samples.
Definition at line 127 of file PMCMCBase.h.
Referenced by PMCMCBase::combineWithExperimentalConfig(), PMCMCBase::computeSample(), PMCMCBase::PMCMCBase(), IndependentGaussianMH::proposeSamples(), AffineInvariantDES::proposeSamples(), proposeSamples(), and PMCMCBase::proposeSamples().
|
protectedinherited |
Vector of new proposed variance samples.
Definition at line 130 of file PMCMCBase.h.
Referenced by PMCMCBase::getVarSamples(), PMCMCBase::PMCMCBase(), AffineInvariantDES::proposeSamples(), and proposeSamples().
|
protectedinherited |
Number of parallel proposals to be made and subApps to be executed.
Definition at line 106 of file PMCMCBase.h.
Referenced by AffineInvariantDES::AffineInvariantDES(), AffineInvariantStretchSampler(), PMCMCBase::combineWithExperimentalConfig(), PMCMCBase::computeSample(), PMCMCBase::getNumParallelProposals(), PMCMCBase::PMCMCBase(), AffineInvariantDES::proposeSamples(), IndependentGaussianMH::proposeSamples(), proposeSamples(), PMCMCBase::proposeSamples(), and PMCMCBase::sampleSetUp().
|
protected |
Reporter value with the previous state of all the walkers.
Definition at line 38 of file AffineInvariantStretchSampler.h.
Referenced by proposeSamples().
|
protected |
Reporter value with the previous state of all the walkers for variance.
Definition at line 41 of file AffineInvariantStretchSampler.h.
Referenced by proposeSamples().
|
protectedinherited |
Storage for prior distribution objects to be utilized.
Definition at line 109 of file PMCMCBase.h.
Referenced by AffineInvariantDES::AffineInvariantDES(), AffineInvariantStretchSampler(), PMCMCBase::getPriors(), IndependentGaussianMH::IndependentGaussianMH(), PMCMCBase::PMCMCBase(), AffineInvariantDES::proposeSamples(), IndependentGaussianMH::proposeSamples(), proposeSamples(), PMCMCBase::proposeSamples(), and AffineInvariantDES::tuneParams().
|
protectedinherited |
Vector of random numbers for decision making.
Definition at line 133 of file PMCMCBase.h.
Referenced by PMCMCBase::getRandomNumbers(), PMCMCBase::PMCMCBase(), and PMCMCBase::sampleSetUp().
|
protected |
The step size for the stretch sampler.
Definition at line 35 of file AffineInvariantStretchSampler.h.
Referenced by proposeSamples().
|
protectedinherited |
Upper bounds for making the next proposal.
Definition at line 118 of file PMCMCBase.h.
Referenced by PMCMCBase::PMCMCBase(), and IndependentGaussianMH::proposeSamples().
|
protectedinherited |
Storage for prior distribution object of the variance to be utilized.
Definition at line 112 of file PMCMCBase.h.
Referenced by PMCMCBase::getVarPrior(), PMCMCBase::PMCMCBase(), AffineInvariantDES::proposeSamples(), and proposeSamples().