22 params.
addClassDescription(
"Generic reporter which decides whether or not to accept a proposed " 23 "sample in Adaptive Monte Carlo type of algorithms.");
25 "Value of the model output from the SubApp.");
29 "Modified value of the model output from this reporter class.");
30 params.
addParam<ReporterValueName>(
"inputs",
"inputs",
"Uncertain inputs to the model.");
32 params.
addParam<UserObjectName>(
"gp_decision",
"The Gaussian Process decision reporter.");
38 _output_value(isParamValid(
"gp_decision") ? getReporterValue<
std::vector<
Real>>(
"output_value")
39 : getReporterValue<
std::vector<
Real>>(
41 _output_required(declareValue<
std::vector<
Real>>(
"output_required")),
42 _inputs(declareValue<
std::vector<
std::vector<
Real>>>(
"inputs")),
43 _sampler(getSampler(
"sampler")),
46 _check_step(
std::numeric_limits<
int>::
max()),
47 _local_comm(_sampler.getLocalComm()),
48 _gp_used(isParamValid(
"gp_decision")),
56 paramError(
"sampler",
"The selected sampler is not an adaptive sampler.");
62 _inputs.resize(cols, std::vector<Real>(rows));
63 _prev_val.resize(cols, std::vector<Real>(rows));
119 if (_t_step <= _ais->getNumSamplesTrain() && !restart_gp)
127 if (output_limit_reached)
143 const unsigned int subset =
145 const unsigned int sub_ind =
155 data_in(ss,
j) = data[
j];
181 if (sub_ind % count_max == 0)
215 if (!output_limit_reached)
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
const Real & getOutputLimit() const
Sampler & _sampler
The adaptive Monte Carlo sampler.
std::vector< Real > _prev_val_out
Storage for previously accepted output value.
A class used to perform Parallel Subset Simulation Sampling.
const bool _gp_used
Check if a GP is used.
A class used to perform Adaptive Importance Sampling using a Markov Chain Monte Carlo algorithm...
std::vector< Real > computeVectorABS(const std::vector< Real > &data)
return the absolute values in a vector.
AdaptiveMonteCarloDecision(const InputParameters ¶meters)
virtual void execute() override
void reinitChain()
This reinitializes the Markov chain to the starting value until the Gaussian process training is comp...
const bool & getUseAbsoluteValue() const
Access use absolute value bool.
std::vector< Real > getNextLocalRow()
std::vector< std::vector< Real > > _inputs_sto
Storage for the previously accepted sample inputs across all the subsets.
dof_id_type getLocalRowBegin() const
std::vector< std::vector< Real > > _inputs_sorted
Store the sorted input samples according to their corresponding outputs.
std::vector< std::vector< Real > > _prev_val
Storage for previously accepted input values. This helps in making decision on the next proposed inpu...
static InputParameters validParams()
dof_id_type getNumberOfLocalRows() const
auto max(const L &left, const R &right)
const int *const _gp_training_samples
Store the GP training samples.
Real computeMin(const std::vector< Real > &data)
return the minimum value in a vector.
libMesh::Parallel::Communicator & _local_comm
Communicator that was split based on samples that have rows.
const std::vector< Real > & _output_value
Model output value from SubApp.
const unsigned int & getNumSamplesSub() const
Access the number samples per subset.
const ParallelSubsetSimulation *const _pss
Parallel Subset Simulation sampler.
std::vector< Real > _output_sorted
Store the sorted output sample values.
AdaptiveMonteCarloDecision will help make sample accept/reject decisions in adaptive Monte Carlo sche...
int _check_step
Ensure that the MCMC algorithm proceeds in a sequential fashion.
static InputParameters validParams()
void paramError(const std::string ¶m, Args... args) const
const ReporterMode REPORTER_MODE_DISTRIBUTED
const Real & getSubsetProbability() const
Access the subset probability.
dof_id_type getLocalRowEnd() const
std::vector< Real > _outputs_sto
Storage for previously accepted sample outputs across all the subsets.
dof_id_type getNumberOfRows() const
const int & getNumSamplesTrain() const
const bool & getUseAbsoluteValue() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< Real > & _output_required
Modified value of model output by this reporter class.
std::vector< std::vector< Real > > sortInput(const std::vector< std::vector< Real >> &inputs, const std::vector< Real > &outputs, const unsigned int samplessub, const Real subset_prob)
return input values corresponding to the largest po percentile output values.
const AdaptiveImportanceSampler *const _ais
Adaptive Importance Sampler.
std::vector< std::vector< Real > > & _inputs
Model input data that is uncertain.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
registerMooseObject("StochasticToolsApp", AdaptiveMonteCarloDecision)
Real _output_limit
Store the intermediate ouput failure thresholds.
const std::vector< Real > & getInitialValues() const
void ErrorVector unsigned int
dof_id_type getNumberOfCols() const
std::vector< Real > sortOutput(const std::vector< Real > &outputs, const unsigned int samplessub, const Real subset_prob)
return the largest po percentile output values.