23 "prior_distributions",
"The prior distributions of the parameters to be calibrated.");
25 "prior_variance",
"The prior distribution of the variance parameter to be calibrated.");
27 "num_parallel_proposals",
28 "Number of proposals to make and corresponding subApps executed in " 30 params.
addRequiredParam<FileName>(
"file_name",
"Name of the CSV file with configuration values.");
32 "file_column_name",
"Name of column in CSV file to use, by default first column is used.");
34 "num_columns",
"Number of columns to be used in the CSV file with the configuration values.");
35 params.
addParam<std::vector<Real>>(
"lower_bound",
"Lower bounds for making the next proposal.");
36 params.
addParam<std::vector<Real>>(
"upper_bound",
"Upper bounds for making the next proposal.");
38 "The starting values of the inputs to be calibrated.");
42 "Initialize a certain number of random seeds. Change from the default only if you have to.");
49 _num_parallel_proposals(getParam<unsigned
int>(
"num_parallel_proposals")),
50 _lower_bound(isParamValid(
"lower_bound") ? &getParam<
std::vector<
Real>>(
"lower_bound")
52 _upper_bound(isParamValid(
"upper_bound") ? &getParam<
std::vector<
Real>>(
"upper_bound")
55 _initial_values(getParam<
std::vector<
Real>>(
"initial_values")),
56 _num_random_seeds(getParam<unsigned
int>(
"num_random_seeds"))
59 for (
const DistributionName &
name :
60 getParam<std::vector<DistributionName>>(
"prior_distributions"))
104 if (bound_check1 || bound_check2)
105 mooseError(
"Both lower and upper bounds should be specified.");
106 bool size_check =
_lower_bound ? ((*_lower_bound).size() != (*_upper_bound).size()) : 0;
108 mooseError(
"Lower and upper bounds should be of the same size.");
112 mooseError(
"The priors and initial values should be of the same size.");
119 for (
unsigned int i = 0; i <
_priors.size(); ++i)
142 const unsigned int & exclude,
143 const unsigned int & seed,
144 unsigned int & req_index)
147 while (req_index == exclude)
148 req_index =
getRandl(seed, 0, upper_bound);
153 const unsigned int & exclude,
154 const unsigned int & seed,
155 unsigned int & req_index1,
156 unsigned int & req_index2)
158 randomIndex(upper_bound, exclude, seed, req_index1);
159 req_index2 = req_index1;
160 while (req_index1 == req_index2)
161 randomIndex(upper_bound, exclude, seed, req_index2);
169 std::vector<Real> tmp;
182 const std::vector<Real> &
188 const std::vector<Real> &
194 const std::vector<const Distribution *>
void setNumberOfRows(dof_id_type n_rows)
const unsigned int _num_random_seeds
Initialize a certain number of random seeds. Change from the default only if you have to...
uint32_t getRandl(unsigned int index, uint32_t lower, uint32_t upper)
const unsigned int _num_parallel_proposals
Number of parallel proposals to be made and subApps to be executed.
const std::vector< Real > & _initial_values
Initial values of the input params to get the MCMC scheme started.
static InputParameters validParams()
std::vector< std::vector< Real > > _new_samples_confg
Vectors of new proposed samples combined with the experimental configuration values.
const std::vector< Real > * _lower_bound
Lower bounds for making the next proposal.
void combineWithExperimentalConfig()
Generates combinations of the new samples with the experimental configurations.
PMCMCBase(const InputParameters ¶meters)
std::vector< const Distribution * > _priors
Storage for prior distribution objects to be utilized.
registerMooseObject("StochasticToolsApp", PMCMCBase)
int _check_step
Ensure that the MCMC algorithm proceeds in a sequential fashion.
const std::vector< const Distribution * > getPriors() const
Return the priors to facilitate decision making in reporters.
Real getRand(unsigned int index=0)
virtual void proposeSamples(const unsigned int seed_value)
Fill in the _new_samples vector of vectors (happens within sampleSetUp)
virtual const std::string & name() const
const Distribution * getVarPrior() const
Return the prior over variance to facilitate decision making in reporters.
bool isParamValid(const std::string &name) const
std::vector< Real > _new_var_samples
Vector of new proposed variance samples.
const T & getParam(const std::string &name) const
std::vector< Real > _rnd_vec
Vector of random numbers for decision making.
const std::vector< std::vector< T > > & getData() const
const std::vector< Real > * _upper_bound
Upper bounds for making the next proposal.
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.
const std::vector< Real > & getVarSamples() const
Return the proposed variance samples to facilitate decision making in reporters.
const Distribution & getDistributionByName(const DistributionName &name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void setNumberOfCols(dof_id_type n_cols)
std::vector< std::vector< Real > > _new_samples
Vectors of new proposed samples.
virtual void sampleSetUp(const Sampler::SampleMode mode) override
const Distribution * _var_prior
Storage for prior distribution object of the variance to be utilized.
const std::vector< Real > & getRandomNumbers() const
Return the random numbers to facilitate decision making in reporters.
void mooseError(Args &&... args) const
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.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
std::vector< std::vector< Real > > _confg_values
Configuration values.
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override
void ErrorVector unsigned int
static InputParameters validParams()
void setNumberOfRandomSeeds(std::size_t number)
A base class used to perform Parallel Markov Chain Monte Carlo (MCMC) sampling.