https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PMCMCDecision.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "GeneralReporter.h"
13#include "PMCMCBase.h"
15#include "LikelihoodInterface.h"
16#include "Distribution.h"
17
23{
24public:
27 virtual void initialize() override;
28 virtual void finalize() override {}
29 virtual void execute() override;
30
31protected:
37 virtual void computeEvidence(std::vector<Real> & evidence,
38 const DenseMatrix<Real> & input_matrix);
39
45 virtual void computeTransitionVector(std::vector<Real> & tv, const std::vector<Real> & evidence);
46
54 virtual void nextSamples(std::vector<Real> & req_inputs,
55 DenseMatrix<Real> & input_matrix,
56 const std::vector<Real> & tv,
57 const unsigned int & parallel_index);
58
63 virtual void nextSeeds() {}
64
66 virtual bool usingGP() const { return false; }
67
69 std::vector<std::vector<Real>> & _inputs;
70
72 std::vector<Real> & _tpm;
73
75 std::vector<Real> & _variance;
76
78 Real & _noise;
79
81 std::vector<const LikelihoodFunctionBase *> _likelihoods;
82
85
87 const PMCMCBase * const _pmcmc;
88
90 dof_id_type _props;
91
93 const std::vector<Real> & _rnd_vec;
94
96 const std::vector<Real> & _new_var_samples;
97
99 const std::vector<const Distribution *> _priors;
100
103
105 std::vector<Real> * _outputs_required;
106
108 dof_id_type _num_confg_values;
109
111 dof_id_type _num_confg_params;
112
114 DenseMatrix<Real> _data_prev;
115
117 std::vector<Real> _var_prev;
118
120 std::vector<Real> _outputs_prev;
121
123 const std::vector<Real> * _output_value;
124
127
130};
const InputParameters & parameters() const
A base class used to perform Parallel Markov Chain Monte Carlo (MCMC) sampling.
Definition PMCMCBase.h:20
PMCMCDecision will help making sample accept/reject decisions in MCMC schemes (for e....
const std::vector< Real > & _rnd_vec
Storage for the random numbers for decision making.
std::vector< Real > & _tpm
Transition probability matrix.
int _check_step
Ensure that the MCMC algorithm proceeds in a sequential fashion.
dof_id_type _num_confg_values
Storage for the number of experimental configuration values.
libMesh::Parallel::Communicator & _local_comm
Communicator that was split based on samples that have rows.
std::vector< const LikelihoodFunctionBase * > _likelihoods
Storage for the likelihood objects to be utilized.
std::vector< Real > & _variance
Model variance term.
virtual void execute() override
virtual void nextSeeds()
Compute the next set of seeds to facilitate proposals.
virtual void finalize() override
std::vector< std::vector< Real > > & _inputs
Model input data that is uncertain.
const std::vector< const Distribution * > _priors
Storage for the priors.
virtual void initialize() override
dof_id_type _num_confg_params
Storage for the number of experimental configuration parameters.
Sampler & _sampler
The MCMC sampler.
virtual bool usingGP() const
Flag to specify if a pre-trained Gaussian process model is used.
static InputParameters validParams()
virtual void nextSamples(std::vector< Real > &req_inputs, DenseMatrix< Real > &input_matrix, const std::vector< Real > &tv, const unsigned int &parallel_index)
Resample inputs given the transition vector (after transition vector computed)
const std::vector< Real > * _output_value
Current output values.
std::vector< Real > _var_prev
Storage for previous variances.
DenseMatrix< Real > _data_prev
Storage for previous inputs.
const PMCMCBase *const _pmcmc
MCMC sampler base.
const Distribution * _var_prior
Storage for the prior over the variance.
Real & _noise
Model noise term to pass to Likelihoods object.
const std::vector< Real > & _new_var_samples
Storage for new proposed variance samples.
std::vector< Real > _outputs_prev
Storage for previous outputs.
virtual void computeTransitionVector(std::vector< Real > &tv, const std::vector< Real > &evidence)
Compute the transition probability vector (after the computation of evidence)
dof_id_type _props
Storage for the number of parallel proposals.
virtual void computeEvidence(std::vector< Real > &evidence, const DenseMatrix< Real > &input_matrix)
Compute the evidence (aka, betterness of the proposed sample vs the previous)
std::vector< Real > * _outputs_required
Transfer the right outputs to the file.