queso-0.56.0
StatisticalInverseProblem.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #include <queso/StatisticalInverseProblem.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
28 #include <queso/GPMSA.h>
29 #include <queso/GslOptimizer.h>
30 #include <queso/OptimizerMonitor.h>
31 #include <queso/BayesianJointPdf.h>
32 
33 namespace QUESO {
34 
35 // Default constructor -----------------------------
36 template <class P_V,class P_M>
37 StatisticalInverseProblem<P_V,P_M>::StatisticalInverseProblem( const char* prefix, const SipOptionsValues* alternativeOptionsValues, // dakota const BaseVectorRV <P_V,P_M>& priorRv, const BaseScalarFunction<P_V,P_M>& likelihoodFunction, GenericVectorRV <P_V,P_M>& postRv)
43  :
44  m_env (priorRv.env()),
45  m_priorRv (priorRv),
46  m_likelihoodFunction (likelihoodFunction),
47  m_postRv (postRv),
48  m_solutionDomain (NULL),
49  m_solutionPdf (NULL),
50  m_subSolutionMdf (NULL),
51  m_subSolutionCdf (NULL),
52  m_solutionRealizer (NULL),
53  m_mhSeqGenerator (NULL),
54  m_mlSampler (NULL),
55  m_chain (NULL),
56  m_logLikelihoodValues (NULL),
57  m_logTargetValues (NULL),
58  m_optionsObj (alternativeOptionsValues),
59  m_seedWithMAPEstimator (false),
60  m_userDidNotProvideOptions(false)
61 {
62 #ifdef QUESO_MEMORY_DEBUGGING
63  std::cout << "Entering Sip" << std::endl;
64 #endif
65  if (m_env.subDisplayFile()) {
66  *m_env.subDisplayFile() << "Entering StatisticalInverseProblem<P_V,P_M>::constructor()"
67  << ": prefix = " << prefix
68  << ", alternativeOptionsValues = " << alternativeOptionsValues
69  << ", m_env.optionsInputFileName() = " << m_env.optionsInputFileName()
70  << std::endl;
71  }
72 
73  // If NULL, we create one
74  if (m_optionsObj == NULL) {
75  SipOptionsValues * tempOptions = new SipOptionsValues(&m_env, prefix);
76 
77  // We did this dance because scanOptionsValues is not a const method, but
78  // m_optionsObj is a pointer to const
79  m_optionsObj = tempOptions;
80 
81  // We set this flag so we don't delete the user-created object when it
82  // comes time to deconstruct
83  m_userDidNotProvideOptions = true;
84  }
85 
86  if (m_optionsObj->m_help != "") {
87  if (m_env.subDisplayFile()) {
88  *m_env.subDisplayFile() << (*m_optionsObj) << std::endl;
89  }
90  }
91 
92 #ifdef QUESO_MEMORY_DEBUGGING
93  std::cout << "In Sip, finished scanning options" << std::endl;
94 #endif
95 
96  queso_require_equal_to_msg(priorRv.imageSet().vectorSpace().dimLocal(), likelihoodFunction.domainSet().vectorSpace().dimLocal(), "'priorRv' and 'likelihoodFunction' are related to vector spaces of different dimensions");
97 
98  queso_require_equal_to_msg(priorRv.imageSet().vectorSpace().dimLocal(), postRv.imageSet().vectorSpace().dimLocal(), "'priorRv' and 'postRv' are related to vector spaces of different dimensions");
99 
100  if (m_env.subDisplayFile()) {
101  *m_env.subDisplayFile() << "Leaving StatisticalInverseProblem<P_V,P_M>::constructor()"
102  << ": prefix = " << m_optionsObj->m_prefix
103  << std::endl;
104  }
105 
106  return;
107 }
108 
109 template <class P_V,class P_M>
111  const char * prefix,
112  const SipOptionsValues * alternativeOptionsValues,
113  const GPMSAFactory<P_V, P_M> & gpmsaFactory,
114  GenericVectorRV <P_V,P_M> & postRv)
115  :
116  m_env (gpmsaFactory.m_totalPrior->env()),
117  m_priorRv (*(gpmsaFactory.m_totalPrior)),
118  m_likelihoodFunction (gpmsaFactory.getGPMSAEmulator()),
119  m_postRv (postRv),
120  m_solutionDomain (NULL),
121  m_solutionPdf (NULL),
122  m_subSolutionMdf (NULL),
123  m_subSolutionCdf (NULL),
124  m_solutionRealizer (NULL),
125  m_mhSeqGenerator (NULL),
126  m_mlSampler (NULL),
127  m_chain (NULL),
128  m_logLikelihoodValues (NULL),
129  m_logTargetValues (NULL),
130  m_optionsObj (alternativeOptionsValues),
131  m_seedWithMAPEstimator (false),
132  m_userDidNotProvideOptions(false)
133 {
134  if (m_env.subDisplayFile()) {
135  *m_env.subDisplayFile() << "Entering StatisticalInverseProblem<P_V,P_M>::constructor()"
136  << ": prefix = " << prefix
137  << ", alternativeOptionsValues = " << alternativeOptionsValues
138  << ", m_env.optionsInputFileName() = " << m_env.optionsInputFileName()
139  << std::endl;
140  }
141 
142  // If NULL, we create one
143  if (m_optionsObj == NULL) {
144  SipOptionsValues * tempOptions = new SipOptionsValues(&m_env, prefix);
145 
146  // We did this dance because scanOptionsValues is not a const method, but
147  // m_optionsObj is a pointer to const
148  m_optionsObj = tempOptions;
149 
151  }
152 
153  if (m_optionsObj->m_help != "") {
154  if (m_env.subDisplayFile()) {
155  *m_env.subDisplayFile() << (*m_optionsObj) << std::endl;
156  }
157  }
158 
159  queso_require_equal_to_msg(m_priorRv.imageSet().vectorSpace().dimLocal(), m_likelihoodFunction.domainSet().vectorSpace().dimLocal(), "'priorRv' and 'likelihoodFunction' are related to vector spaces of different dimensions");
160 
161  queso_require_equal_to_msg(m_priorRv.imageSet().vectorSpace().dimLocal(), postRv.imageSet().vectorSpace().dimLocal(), "'priorRv' and 'postRv' are related to vector spaces of different dimensions");
162 
163  if (m_env.subDisplayFile()) {
164  *m_env.subDisplayFile() << "Leaving StatisticalInverseProblem<P_V,P_M>::constructor()"
165  << ": prefix = " << m_optionsObj->m_prefix
166  << std::endl;
167  }
168 
169  return;
170 }
171 
172 // Destructor --------------------------------------
173 template <class P_V,class P_M>
175 {
176  if (m_chain) {
177  m_chain->clear();
178  delete m_chain;
179  }
180  if (m_logLikelihoodValues) {
181  m_logLikelihoodValues->clear();
182  delete m_logLikelihoodValues;
183  }
184  if (m_logTargetValues) {
185  m_logTargetValues->clear();
186  delete m_logTargetValues;
187  }
188  if (m_mlSampler ) delete m_mlSampler;
189  if (m_mhSeqGenerator ) delete m_mhSeqGenerator;
190  if (m_solutionRealizer) delete m_solutionRealizer;
191  if (m_subSolutionCdf ) delete m_subSolutionCdf;
192  if (m_subSolutionMdf ) delete m_subSolutionMdf;
193  if (m_solutionPdf ) delete m_solutionPdf;
194  if (m_solutionDomain ) delete m_solutionDomain;
195 
196  if (m_optionsObj && m_userDidNotProvideOptions) {
197  delete m_optionsObj;
198  }
199 }
200 // Statistical methods -----------------------------
201 template <class P_V,class P_M>
202 void
204  const MhOptionsValues* alternativeOptionsValues, // dakota
205  const P_V& initialValues,
206  const P_M* initialProposalCovMatrix)
207 {
208  //grvy_timer_begin("BayesMetropolisHastings"); TODO: revisit timing output
209  //std::cout << "proc " << m_env.fullRank() << ", HERE sip 000" << std::endl;
210  m_env.fullComm().Barrier();
211  //std::cout << "proc " << m_env.fullRank() << ", HERE sip 001" << std::endl;
212  m_env.fullComm().syncPrintDebugMsg("Entering StatisticalInverseProblem<P_V,P_M>::solveWithBayesMetropolisHastings()",1,3000000);
213 
214  if (m_optionsObj->m_computeSolution == false) {
215  if ((m_env.subDisplayFile())) {
216  *m_env.subDisplayFile() << "In StatisticalInverseProblem<P_V,P_M>::solveWithBayesMetropolisHastings()"
217  << ": avoiding solution, as requested by user"
218  << std::endl;
219  }
220  return;
221  }
222  if ((m_env.subDisplayFile())) {
223  *m_env.subDisplayFile() << "In StatisticalInverseProblem<P_V,P_M>::solveWithBayesMetropolisHastings()"
224  << ": computing solution, as requested by user"
225  << std::endl;
226  }
227 
228  queso_require_equal_to_msg(m_priorRv.imageSet().vectorSpace().dimLocal(), initialValues.sizeLocal(), "'m_priorRv' and 'initialValues' should have equal dimensions");
229 
230  if (initialProposalCovMatrix) {
231  queso_require_equal_to_msg(m_priorRv.imageSet().vectorSpace().dimLocal(), initialProposalCovMatrix->numRowsLocal(), "'m_priorRv' and 'initialProposalCovMatrix' should have equal dimensions");
232  queso_require_equal_to_msg(initialProposalCovMatrix->numCols(), initialProposalCovMatrix->numRowsGlobal(), "'initialProposalCovMatrix' should be a square matrix");
233  }
234 
235  if (m_mlSampler ) delete m_mlSampler;
236  if (m_mhSeqGenerator ) delete m_mhSeqGenerator;
237  if (m_solutionRealizer) delete m_solutionRealizer;
238  if (m_subSolutionCdf ) delete m_subSolutionCdf;
239  if (m_subSolutionMdf ) delete m_subSolutionMdf;
240  if (m_solutionPdf ) delete m_solutionPdf;
241  if (m_solutionDomain ) delete m_solutionDomain;
242 
243  P_V numEvaluationPointsVec(m_priorRv.imageSet().vectorSpace().zeroVector());
244  numEvaluationPointsVec.cwSet(250.);
245 
246  // Compute output pdf up to a multiplicative constant: Bayesian approach
247  m_solutionDomain = InstantiateIntersection(m_priorRv.pdf().domainSet(),m_likelihoodFunction.domainSet());
248 
249  m_solutionPdf = new BayesianJointPdf<P_V,P_M>(m_optionsObj->m_prefix.c_str(),
250  m_priorRv.pdf(),
251  m_likelihoodFunction,
252  1.,
253  *m_solutionDomain);
254 
255  m_postRv.setPdf(*m_solutionPdf);
256  m_chain = new SequenceOfVectors<P_V,P_M>(m_postRv.imageSet().vectorSpace(),0,m_optionsObj->m_prefix+"chain");
257 
258  // Decide whether or not to create a MetropolisHastingsSG instance from the
259  // user-provided initial seed, or use the user-provided seed for a
260  // deterministic optimisation instead and seed the chain with the result of
261  // the optimisation
262  if (this->m_seedWithMAPEstimator ||
263  m_optionsObj->m_seedWithMAPEstimator) {
264  // Unfortunately, I didn't have the foresight to make this an input file
265  // option from the beginning, hence needing to check two flags
266 
267  // Read in optimizer options from input file
268  OptimizerOptions optimizer_options(&m_env, "ip_");
269 
270  // Do optimisation before sampling
271  GslOptimizer optimizer(optimizer_options, *m_solutionPdf);
272  optimizer.setInitialPoint(dynamic_cast<const GslVector &>(initialValues));
273 
274  OptimizerMonitor monitor(m_env);
275  monitor.set_display_output(true, true);
276 
277  // If the input file option is set, then use the monitor, otherwise don't
278  if (m_optionsObj->m_useOptimizerMonitor) {
279  optimizer.minimize(&monitor);
280  }
281  else {
282  optimizer.minimize();
283  }
284 
285  // Compute output realizer: Metropolis-Hastings approach
286  m_mhSeqGenerator = new MetropolisHastingsSG<P_V, P_M>(
287  m_optionsObj->m_prefix.c_str(), alternativeOptionsValues,
288  m_postRv, optimizer.minimizer(), initialProposalCovMatrix);
289  }
290  else {
291  // Compute output realizer: Metropolis-Hastings approach
292  m_mhSeqGenerator = new MetropolisHastingsSG<P_V, P_M>(
293  m_optionsObj->m_prefix.c_str(), alternativeOptionsValues, m_postRv,
294  initialValues, initialProposalCovMatrix);
295  }
296 
297 
298  m_logLikelihoodValues = new ScalarSequence<double>(m_env, 0,
299  m_optionsObj->m_prefix +
300  "logLike");
301 
302  m_logTargetValues = new ScalarSequence<double>(m_env, 0,
303  m_optionsObj->m_prefix +
304  "logTarget");
305 
306  // m_logLikelihoodValues and m_logTargetValues may be NULL
307  m_mhSeqGenerator->generateSequence(*m_chain, m_logLikelihoodValues,
308  m_logTargetValues);
309 
310  m_solutionRealizer = new SequentialVectorRealizer<P_V,P_M>(m_optionsObj->m_prefix.c_str(),
311  *m_chain);
312 
313  m_postRv.setRealizer(*m_solutionRealizer);
314 
315  m_env.fullComm().syncPrintDebugMsg("In StatisticalInverseProblem<P_V,P_M>::solveWithBayesMetropolisHastings(), code place 1",3,3000000);
316  //m_env.fullComm().Barrier();
317 
318  // Compute output mdf: uniform sampling approach
319 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
320  m_subMdfGrids = new ArrayOfOneDGrids <P_V,P_M>((m_optionsObj->m_prefix+"Mdf_").c_str(),m_postRv.imageSet().vectorSpace());
321  m_subMdfValues = new ArrayOfOneDTables<P_V,P_M>((m_optionsObj->m_prefix+"Mdf_").c_str(),m_postRv.imageSet().vectorSpace());
322  m_chain->subUniformlySampledMdf(numEvaluationPointsVec, // input
323  *m_subMdfGrids, // output
324  *m_subMdfValues); // output
325  m_subSolutionMdf = new SampledVectorMdf<P_V,P_M>(m_optionsObj->m_prefix.c_str(),
326  *m_subMdfGrids,
327  *m_subMdfValues);
328  m_postRv.setMdf(*m_subSolutionMdf);
329 
330  if ((m_optionsObj->m_dataOutputFileName != UQ_SIP_FILENAME_FOR_NO_FILE ) &&
331  (m_optionsObj->m_dataOutputAllowedSet.find(m_env.subId()) != m_optionsObj->m_dataOutputAllowedSet.end())) {
332  if (m_env.subRank() == 0) {
333  // Write data output file
334  if (m_env.subDisplayFile()) {
335  *m_env.subDisplayFile() << "Opening data output file '" << m_optionsObj->m_dataOutputFileName
336  << "' for calibration problem with problem with prefix = " << m_optionsObj->m_prefix
337  << std::endl;
338  }
339 
340  // Open file
341  // Always write at the end of an eventual pre-existing file
342  std::ofstream* ofsvar = new std::ofstream((m_optionsObj->m_dataOutputFileName+"_sub"+m_env.subIdString()+".m").c_str(), std::ofstream::out | std::ofstream::in | std::ofstream::ate);
343  if ((ofsvar == NULL ) ||
344  (ofsvar->is_open() == false)) {
345  delete ofsvar;
346  ofsvar = new std::ofstream((m_optionsObj->m_dataOutputFileName+"_sub"+m_env.subIdString()+".m").c_str(), std::ofstream::out | std::ofstream::trunc);
347  }
348  queso_require_msg((ofsvar && ofsvar->is_open()), "failed to open file");
349 
350  m_postRv.mdf().print(*ofsvar);
351 
352  // Close file
353  //ofsvar->close();
354  delete ofsvar;
355  if (m_env.subDisplayFile()) {
356  *m_env.subDisplayFile() << "Closed data output file '" << m_optionsObj->m_dataOutputFileName
357  << "' for calibration problem with problem with prefix = " << m_optionsObj->m_prefix
358  << std::endl;
359  }
360  }
361  }
362 #endif
363  if (m_env.subDisplayFile()) {
364  *m_env.subDisplayFile() << std::endl;
365  }
366 
367  m_env.fullComm().syncPrintDebugMsg("Leaving StatisticalInverseProblem<P_V,P_M>::solveWithBayesMetropolisHastings()",1,3000000);
368  m_env.fullComm().Barrier();
369  // grvy_timer_end("BayesMetropolisHastings"); TODO: revisit timers
370  return;
371 }
372 
373 template <class P_V, class P_M>
374 void
376 {
377  this->m_seedWithMAPEstimator = true;
378 }
379 
380 template <class P_V,class P_M>
381 void
383 {
384  m_env.fullComm().Barrier();
385  m_env.fullComm().syncPrintDebugMsg("Entering StatisticalInverseProblem<P_V,P_M>::solveWithBayesMLSampling()",1,3000000);
386 
387  if (m_optionsObj->m_computeSolution == false) {
388  if ((m_env.subDisplayFile())) {
389  *m_env.subDisplayFile() << "In StatisticalInverseProblem<P_V,P_M>::solveWithBayesMLSampling()"
390  << ": avoiding solution, as requested by user"
391  << std::endl;
392  }
393  return;
394  }
395  if ((m_env.subDisplayFile())) {
396  *m_env.subDisplayFile() << "In StatisticalInverseProblem<P_V,P_M>::solveWithBayesMLSampling()"
397  << ": computing solution, as requested by user"
398  << std::endl;
399  }
400 
401  if (m_mlSampler ) delete m_mlSampler;
402  if (m_mhSeqGenerator ) delete m_mhSeqGenerator;
403  if (m_solutionRealizer) delete m_solutionRealizer;
404  if (m_subSolutionCdf ) delete m_subSolutionCdf;
405  if (m_subSolutionMdf ) delete m_subSolutionMdf;
406  if (m_solutionPdf ) delete m_solutionPdf;
407  if (m_solutionDomain ) delete m_solutionDomain;
408 
409  P_V numEvaluationPointsVec(m_priorRv.imageSet().vectorSpace().zeroVector());
410  numEvaluationPointsVec.cwSet(250.);
411 
412  // Compute output pdf up to a multiplicative constant: Bayesian approach
413  m_solutionDomain = InstantiateIntersection(m_priorRv.pdf().domainSet(),m_likelihoodFunction.domainSet());
414 
415  m_solutionPdf = new BayesianJointPdf<P_V,P_M>(m_optionsObj->m_prefix.c_str(),
416  m_priorRv.pdf(),
417  m_likelihoodFunction,
418  1.,
419  *m_solutionDomain);
420 
421  m_postRv.setPdf(*m_solutionPdf);
422 
423  // Compute output realizer: ML approach
424  m_chain = new SequenceOfVectors<P_V,P_M>(m_postRv.imageSet().vectorSpace(),0,m_optionsObj->m_prefix+"chain");
425  m_mlSampler = new MLSampling<P_V,P_M>(m_optionsObj->m_prefix.c_str(),
426  //m_postRv,
427  m_priorRv,
428  m_likelihoodFunction);
429  // initialValues,
430  // initialProposalCovMatrix);
431 
432  m_mlSampler->generateSequence(*m_chain,
433  NULL,
434  NULL);
435 
436  m_solutionRealizer = new SequentialVectorRealizer<P_V,P_M>(m_optionsObj->m_prefix.c_str(),
437  *m_chain);
438 
439  m_postRv.setRealizer(*m_solutionRealizer);
440 
441  if (m_env.subDisplayFile()) {
442  *m_env.subDisplayFile() << std::endl;
443  }
444 
445  m_env.fullComm().syncPrintDebugMsg("Leaving StatisticalInverseProblem<P_V,P_M>::solveWithBayesMLSampling()",1,3000000);
446  m_env.fullComm().Barrier();
447 
448  return;
449 }
450 
451 template <class P_V, class P_M>
454 {
455  return *m_mhSeqGenerator;
456 }
457 
458 //--------------------------------------------------
459 template <class P_V,class P_M>
462 {
463  return m_priorRv;
464 }
465 //--------------------------------------------------
466 template <class P_V,class P_M>
469 {
470  return m_postRv;
471 }
472 //--------------------------------------------------
473 template <class P_V,class P_M>
476 {
477  queso_require_msg(m_chain, "m_chain is NULL");
478  return *m_chain;
479 }
480 //--------------------------------------------------
481 template <class P_V,class P_M>
484 {
485  queso_require_msg(m_logLikelihoodValues, "m_logLikelihoodValues is NULL");
486  return *m_logLikelihoodValues;
487 }
488 //--------------------------------------------------
489 template <class P_V,class P_M>
492 {
493  queso_require_msg(m_logTargetValues, "m_logTargetValues is NULL");
494  return *m_logTargetValues;
495 }
496 //--------------------------------------------------
497 template <class P_V,class P_M>
499 {
500  queso_require_msg(m_mlSampler, "m_mlSampler is NULL");
501  return m_mlSampler->logEvidence();
502 }
503 //--------------------------------------------------
504 template <class P_V,class P_M>
506 {
507  queso_require_msg(m_mlSampler, "m_mlSampler is NULL");
508  return m_mlSampler->meanLogLikelihood();
509 }
510 //--------------------------------------------------
511 template <class P_V,class P_M>
513 {
514  queso_require_msg(m_mlSampler, "m_mlSampler is NULL");
515  return m_mlSampler->eig();
516 }
517 // I/O methods--------------------------------------
518 template <class P_V,class P_M>
519 void
521 {
522  return;
523 }
524 
525 } // End namespace QUESO
526 
A class for handling sequential draws (sampling) from probability density distributions.
const BaseScalarFunction< P_V, P_M > & m_likelihoodFunction
Class to accommodate arrays of one-dimensional grid.
This class provides options for a Statistical Inverse Problem if no input file is available...
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
A class for handling sampled vector MDFs.
void setInitialPoint(const GslVector &intialPoint)
Set the point at which the optimization starts.
Definition: GslOptimizer.C:247
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
Definition: Environment.C:353
#define UQ_SIP_FILENAME_FOR_NO_FILE
const GenericVectorRV< P_V, P_M > & postRv() const
Returns the Posterior RV; access to private attribute m_postrRv.
VectorSet< V, M > * InstantiateIntersection(const VectorSet< V, M > &domain1, const VectorSet< V, M > &domain2)
This method calculates the intersection of domain1 and domain2.
double logEvidence() const
Returns the logarithm value of the evidence. Related to ML.
void solveWithBayesMLSampling()
Solves with Bayes Multi-Level (ML) sampling.
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:73
A templated class that represents a Metropolis-Hastings generator of samples.
double meanLogLikelihood() const
Returns the mean of the logarithm value of the likelihood. Related to ML.
virtual void minimize(OptimizerMonitor *monitor=NULL)
Minimize the objective function, starting at m_initialPoint.
Definition: GslOptimizer.C:211
This class provides options for a Optimizer.
void set_display_output(bool enable_output, bool print_xmin)
Enabling output to std::cout everytime append is called.
void seedWithMAPEstimator()
Seeds the chain with the result of a deterministic optimisation.
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
Definition: VectorRV.C:82
const GslVector & minimizer() const
Return the point that minimizes the objective function.
Definition: GslOptimizer.C:255
This templated class represents a Statistical Inverse Problem.
A base class for handling optimisation of scalar functions.
Definition: GslOptimizer.h:50
void solveWithBayesMetropolisHastings(const MhOptionsValues *alternativeOptionsValues, const P_V &initialValues, const P_M *initialProposalCovMatrix)
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm.
const BaseVectorRV< P_V, P_M > & priorRv() const
Returns the Prior RV; access to private attribute m_priorRv.
const BaseVectorRV< P_V, P_M > & m_priorRv
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
StatisticalInverseProblem(const char *prefix, const SipOptionsValues *alternativeOptionsValues, const BaseVectorRV< P_V, P_M > &priorRv, const BaseScalarFunction< P_V, P_M > &likelihoodFunction, GenericVectorRV< P_V, P_M > &postRv)
Constructor.
const BaseVectorSequence< P_V, P_M > & chain() const
Returns the MCMC chain; access to private attribute m_chain.
Object to monitor convergence of optimizers.
This class provides options for the Metropolis-Hastings generator of samples if no input file is avai...
const VectorSet< V, M > & domainSet() const
Access to the protected attribute m_domainSet: domain set of the scalar function. ...
const ScalarSequence< double > & logTargetValues() const
Returns log target values; access to private attribute m_logTargetValues.
Class to accommodate arrays of one-dimensional tables.
A templated class that represents a Multilevel generator of samples.
Definition: MLSampling.h:122
virtual const VectorSpace< V, M > & vectorSpace() const =0
Vector space to which this set belongs to. See template specialization.
std::string m_help
If this string is non-empty, options are print to the output file.
void print(std::ostream &os) const
TODO: Prints the sequence.
unsigned int dimLocal() const
Definition: VectorSpace.C:170
const MetropolisHastingsSG< P_V, P_M > & sequenceGenerator() const
Return the underlying MetropolisHastingSG object.
const ScalarSequence< double > & logLikelihoodValues() const
Returns log likelihood values; access to private attribute m_logLikelihoodValues. ...

Generated on Tue Nov 29 2016 10:53:11 for queso-0.56.0 by  doxygen 1.8.5