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 std::numeric_limits<Real>::max(),
39 "Upper bound for variance for making the next proposal.");
41 "The starting values of the inputs to be calibrated.");
45 "Initialize a certain number of random seeds. Change from the default only if you have to.");
52 _num_parallel_proposals(getParam<unsigned
int>(
"num_parallel_proposals")),
53 _lower_bound(isParamValid(
"lower_bound") ? &getParam<
std::vector<
Real>>(
"lower_bound")
55 _upper_bound(isParamValid(
"upper_bound") ? &getParam<
std::vector<
Real>>(
"upper_bound")
57 _variance_bound(getParam<
Real>(
"variance_bound")),
58 _initial_values(getParam<
std::vector<
Real>>(
"initial_values")),
59 _num_random_seeds(getParam<unsigned
int>(
"num_random_seeds")),
64 for (
const DistributionName &
name :
65 getParam<std::vector<DistributionName>>(
"prior_distributions"))
108 if (bound_check1 || bound_check2)
109 mooseError(
"Both lower and upper bounds should be specified.");
110 bool size_check =
_lower_bound ? ((*_lower_bound).size() != (*_upper_bound).size()) : 0;
112 mooseError(
"Lower and upper bounds should be of the same size.");
116 mooseError(
"The priors and initial values should be of the same size.");
123 for (
unsigned int i = 0; i <
_priors.size(); ++i)
150 auto req_index = exclude;
151 while (req_index == exclude)
156 std::pair<unsigned int, unsigned int>
159 auto req_index1 =
randomIndex(upper_bound, exclude);
160 auto req_index2 = req_index1;
161 while (req_index1 == req_index2)
163 return {req_index1, req_index2};
171 std::vector<Real> tmp;
184 const std::vector<Real> &
190 const std::vector<Real> &
196 const std::vector<std::vector<Real>> &
202 const std::vector<const Distribution *>
void setNumberOfRows(dof_id_type n_rows)
Real random()
Sample a random number between 0 and 1.
const unsigned int _num_random_seeds
Initialize a certain number of random seeds. Change from the default only if you have to...
const unsigned int _num_parallel_proposals
Number of parallel proposals to be made and subApps to be executed.
const std::vector< std::vector< Real > > & getSamples() const
Return the proposed samples to facilitate decision making in reporters.
const std::vector< Real > & _initial_values
Initial values of the input params to get the MCMC scheme started.
std::size_t _rand_index
Running index for the random number generators.
static InputParameters validParams()
const T & getParam(const std::string &name) const
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)
unsigned int getRandl(std::size_t n, unsigned int lower, unsigned int upper, unsigned int index=0) const
std::vector< const Distribution * > _priors
Storage for prior distribution objects to be utilized.
registerMooseObject("StochasticToolsApp", PMCMCBase)
const std::vector< const Distribution * > getPriors() const
Return the priors to facilitate decision making in reporters.
const Distribution * getVarPrior() const
Return the prior over variance to facilitate decision making in reporters.
virtual void proposeSamples()
Fill in the _new_samples vector of vectors (happens within sampleSetUp)
const std::string & name() const
std::vector< Real > _new_var_samples
Vector of new proposed variance samples.
Real getRand(std::size_t n, unsigned int index=0) const
std::pair< unsigned int, unsigned int > randomIndexPair(const unsigned int &upper_bound, const unsigned int &exclude)
Sample two random indices without repitition excluding a specified index.
unsigned int _seed_index
Generator index when requesting random numbers.
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.
const std::vector< Real > & getVarSamples() const
Return the proposed variance samples to facilitate decision making in reporters.
const Distribution & getDistributionByName(const DistributionName &name) const
void setAutoAdvanceGenerators(const bool state)
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.
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
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
bool isParamValid(const std::string &name) const
unsigned int randomIndex(const unsigned int &upper_bound, const unsigned int &exclude)
Sample a random index excluding a specified index.
std::vector< std::vector< Real > > _confg_values
Configuration values.
virtual void executeSetUp() override
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.