queso-0.51.1
MLSampling.h
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,2009,2010,2011,2012,2013 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 #ifndef UQ_MULTI_LEVEL_SAMPLING_H
26 #define UQ_MULTI_LEVEL_SAMPLING_H
27 
28 #define ML_NEW_CODE_2009_12_29
29 
30 #include <queso/MLSamplingOptions.h>
31 #include <queso/MetropolisHastingsSG.h>
32 #include <queso/FiniteDistribution.h>
33 #include <queso/VectorRV.h>
34 #include <queso/GenericVectorRV.h>
35 #include <queso/VectorSpace.h>
36 #include <queso/MarkovChainPositionData.h>
37 #include <queso/ScalarFunctionSynchronizer.h>
38 #include <queso/SequenceOfVectors.h>
39 #include <queso/ArrayOfSequences.h>
40 #ifdef QUESO_HAS_GLPK
41 #include <glpk.h>
42 #endif
43 #include <sys/time.h>
44 #include <fstream>
45 
46 #define ML_CHECKPOINT_FIXED_AMOUNT_OF_DATA 6
47 
48 //---------------------------------------------------------
49 
50 namespace QUESO {
51 
52 // aqui 1
53 #ifdef QUESO_HAS_GLPK
54 struct BIP_routine_struct {
55  const BaseEnvironment* env;
56  unsigned int currLevel;
57 };
58 
59 void BIP_routine(glp_tree *tree, void *info);
60 #endif
61 
62 //---------------------------------------------------------
63 
65 {
69  unsigned int numberOfPositions;
70 };
71 
72 //---------------------------------------------------------
73 
74 template <class P_V>
76 {
80  unsigned int numberOfPositions;
81 };
82 
83 template <class P_V>
85 {
86  std::vector<BalancedLinkedChainControlStruct<P_V> > balLinkedChains;
87 };
88 
89 //---------------------------------------------------------
90 
92 {
93  unsigned int initialPositionIndexInPreviousChain; // KEY new: add logPrior and logLikelihood
94  unsigned int numberOfPositions;
95 };
96 
98 {
99  std::vector<UnbalancedLinkedChainControlStruct> unbLinkedChains;
100 };
101 
102 //---------------------------------------------------------
103 
104 //---------------------------------------------------------
114  /* If options request data to be written in the output file (MATLAB .m format
115  * only, for now), the user can check which MATLAB variables are defined and set by running
116  * 'grep zeros <OUTPUT FILE NAME>' after the solution procedures ends.
117  * The names of the variables are chosen to be self explanatory. */
118 
119 template <class P_V,class P_M>
121 {
122 public:
124 
125 
130  MLSampling( const char* prefix, const BaseVectorRV <P_V,P_M>& priorRv, const BaseScalarFunction<P_V,P_M>& likelihoodFunction);
134  ~MLSampling();
136 
138 
163  void generateSequence (BaseVectorSequence<P_V,P_M>& workingChain,
164  ScalarSequence<double>* workingLogLikelihoodValues,
165  ScalarSequence<double>* workingLogTargetValues);
166 
168 
169  double logEvidence () const;
170 
172 
173  double meanLogLikelihood() const;
174 
176 
193  double eig () const;
195 
197 
198 
200  void print (std::ostream& os) const;
202 
203 
204  friend std::ostream& operator<<(std::ostream& os,
205  const MLSampling<P_V,P_M>& obj) {
206  obj.print(os);
207  return os;
208  }
209 
210 private:
212 
214  void checkpointML (double currExponent, // input
215  double currEta, // input
216  const SequenceOfVectors<P_V,P_M>& currChain, // input
217  const ScalarSequence<double>& currLogLikelihoodValues, // input
218  const ScalarSequence<double>& currLogTargetValues); // input
219 
221 
224  void restartML (double& currExponent, // output
225  double& currEta, // output
226  SequenceOfVectors<P_V,P_M>& currChain, // output
227  ScalarSequence<double>& currLogLikelihoodValues, // output
228  ScalarSequence<double>& currLogTargetValues); // output
229 
231 
233  void generateSequence_Level0_all (const MLSamplingLevelOptions& currOptions, // input
234  unsigned int& unifiedRequestedNumSamples, // output
235  SequenceOfVectors<P_V,P_M>& currChain, // output
236  ScalarSequence<double>& currLogLikelihoodValues, // output
237  ScalarSequence<double>& currLogTargetValues); // output
238 
240 
243  void generateSequence_Step01_inter0(const MLSamplingLevelOptions* currOptions, // input
244  unsigned int& unifiedRequestedNumSamples); // output
245 
247 
251  void generateSequence_Step02_inter0(const MLSamplingLevelOptions* currOptions, // input
252  SequenceOfVectors<P_V,P_M>& currChain, // input/output
253  ScalarSequence<double>& currLogLikelihoodValues, // input/output
254  ScalarSequence<double>& currLogTargetValues, // input/output
255  SequenceOfVectors<P_V,P_M>& prevChain, // output
256  ScalarSequence<double>& prevLogLikelihoodValues, // output
257  ScalarSequence<double>& prevLogTargetValues, // output
258  unsigned int& indexOfFirstWeight, // output
259  unsigned int& indexOfLastWeight); // output
260 
262 
265  void generateSequence_Step03_inter0(const MLSamplingLevelOptions* currOptions, // input
266  const ScalarSequence<double>& prevLogLikelihoodValues, // input
267  double prevExponent, // input
268  double failedExponent, // input // gpmsa1
269  double& currExponent, // output
270  ScalarSequence<double>& weightSequence); // output
271 
273 
276  void generateSequence_Step04_inter0(const SequenceOfVectors<P_V,P_M>& prevChain, // input
277  const ScalarSequence<double>& weightSequence, // input
278  P_M& unifiedCovMatrix); // output
279 
281 
284  void generateSequence_Step05_inter0(unsigned int unifiedRequestedNumSamples, // input
285  const ScalarSequence<double>& weightSequence, // input
286  std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // output
287  std::vector<double>& unifiedWeightStdVectorAtProc0Only); // output
288 
290 
293  void generateSequence_Step06_all (const MLSamplingLevelOptions* currOptions, // input
294  unsigned int indexOfFirstWeight, // input
295  unsigned int indexOfLastWeight, // input
296  const std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // input
297  bool& useBalancedChains, // output
298  std::vector<ExchangeInfoStruct>& exchangeStdVec); // output
299 
301 
305  void generateSequence_Step07_inter0(bool useBalancedChains, // input
306  unsigned int indexOfFirstWeight, // input
307  unsigned int indexOfLastWeight, // input
308  const std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // input
309  UnbalancedLinkedChainsPerNodeStruct& unbalancedLinkControl, // (possible) output
310  const MLSamplingLevelOptions* currOptions, // input
311  const SequenceOfVectors<P_V,P_M>& prevChain, // input
312  double prevExponent, // input
313  double currExponent, // input
314  const ScalarSequence<double>& prevLogLikelihoodValues, // input
315  const ScalarSequence<double>& prevLogTargetValues, // input
316  std::vector<ExchangeInfoStruct>& exchangeStdVec, // (possible) input/output
317  BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl); // (possible) output
318 
320 
323  void generateSequence_Step08_all (BayesianJointPdf<P_V,P_M>& currPdf, // input/output
324  GenericVectorRV<P_V,P_M>& currRv); // output
325 
327 
331  void generateSequence_Step09_all (const SequenceOfVectors<P_V,P_M>& prevChain, // input
332  double prevExponent, // input
333  double currExponent, // input
334  const ScalarSequence<double>& prevLogLikelihoodValues, // input
335  const ScalarSequence<double>& prevLogTargetValues, // input
336  unsigned int indexOfFirstWeight, // input
337  unsigned int indexOfLastWeight, // input
338  const std::vector<double>& unifiedWeightStdVectorAtProc0Only, // input
339  const ScalarSequence<double>& weightSequence, // input
340  double prevEta, // input
341  const GenericVectorRV<P_V,P_M>& currRv, // input
342  MLSamplingLevelOptions* currOptions, // input (changed temporarily internally)
343  P_M& unifiedCovMatrix, // input/output
344  double& currEta); // output
345 
347 
350  void generateSequence_Step10_all (MLSamplingLevelOptions& currOptions, // input (changed temporarily internally)
351  const P_M& unifiedCovMatrix, // input
352  const GenericVectorRV <P_V,P_M>& currRv, // input
353  bool useBalancedChains, // input
354  const UnbalancedLinkedChainsPerNodeStruct& unbalancedLinkControl, // input // Round Rock
355  unsigned int indexOfFirstWeight, // input // Round Rock
356  const SequenceOfVectors<P_V,P_M>& prevChain, // input // Round Rock
357  double prevExponent, // input
358  double currExponent, // input
359  const ScalarSequence<double>& prevLogLikelihoodValues, // input
360  const ScalarSequence<double>& prevLogTargetValues, // input
361  const BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl, // input // Round Rock
362  SequenceOfVectors <P_V,P_M>& currChain, // output
363  double& cumulativeRawChainRunTime, // output
364  unsigned int& cumulativeRawChainRejections, // output
365  ScalarSequence <double>* currLogLikelihoodValues, // output
366  ScalarSequence <double>* currLogTargetValues); // output
367 
369 
373  void generateSequence_Step11_inter0(const MLSamplingLevelOptions* currOptions, // input
374  unsigned int unifiedRequestedNumSamples, // input
375  unsigned int cumulativeRawChainRejections, // input
376  SequenceOfVectors<P_V,P_M>& currChain, // input/output
377  ScalarSequence<double>& currLogLikelihoodValues, // input/output
378  ScalarSequence<double>& currLogTargetValues, // input/output
379  unsigned int& unifiedNumberOfRejections); // output
380 
383  void sampleIndexes_proc0 (unsigned int unifiedRequestedNumSamples, // input
384  const std::vector<double>& unifiedWeightStdVectorAtProc0Only, // input
385  std::vector<unsigned int>& unifiedIndexCountersAtProc0Only); // output
386 
389  bool decideOnBalancedChains_all (const MLSamplingLevelOptions* currOptions, // input
390  unsigned int indexOfFirstWeight, // input
391  unsigned int indexOfLastWeight, // input
392  const std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // input
393  std::vector<ExchangeInfoStruct>& exchangeStdVec); // output
394 
397  void prepareBalLinkedChains_inter0 (const MLSamplingLevelOptions* currOptions, // input
398  const SequenceOfVectors<P_V,P_M>& prevChain, // input
399  double prevExponent, // input
400  double currExponent, // input
401  const ScalarSequence<double>& prevLogLikelihoodValues, // input
402  const ScalarSequence<double>& prevLogTargetValues, // input
403  std::vector<ExchangeInfoStruct>& exchangeStdVec, // input/output
404  BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl); // output
405 
408  void prepareUnbLinkedChains_inter0 (unsigned int indexOfFirstWeight, // input
409  unsigned int indexOfLastWeight, // input
410  const std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // input
411  UnbalancedLinkedChainsPerNodeStruct& unbalancedLinkControl); // output
412 
415  void generateBalLinkedChains_all (MLSamplingLevelOptions& inputOptions, // input, only m_rawChainSize changes
416  const P_M& unifiedCovMatrix, // input
417  const GenericVectorRV <P_V,P_M>& rv, // input
418  const BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl, // input // Round Rock
419  SequenceOfVectors <P_V,P_M>& workingChain, // output
420  double& cumulativeRunTime, // output
421  unsigned int& cumulativeRejections, // output
422  ScalarSequence <double>* currLogLikelihoodValues, // output
423  ScalarSequence <double>* currLogTargetValues); // output
424 
427  void generateUnbLinkedChains_all (MLSamplingLevelOptions& inputOptions, // input, only m_rawChainSize changes
428  const P_M& unifiedCovMatrix, // input
429  const GenericVectorRV <P_V,P_M>& rv, // input
430  const UnbalancedLinkedChainsPerNodeStruct& unbalancedLinkControl, // input // Round Rock
431  unsigned int indexOfFirstWeight, // input // Round Rock
432  const SequenceOfVectors<P_V,P_M>& prevChain, // input // Round Rock
433  double prevExponent, // input
434  double currExponent, // input
435  const ScalarSequence<double>& prevLogLikelihoodValues, // input
436  const ScalarSequence<double>& prevLogTargetValues, // input
437  SequenceOfVectors <P_V,P_M>& workingChain, // output
438  double& cumulativeRunTime, // output
439  unsigned int& cumulativeRejections, // output
440  ScalarSequence <double>* currLogLikelihoodValues, // output
441  ScalarSequence <double>* currLogTargetValues); // output
442 
443 #ifdef QUESO_HAS_GLPK
444 
446  void solveBIP_proc0 (std::vector<ExchangeInfoStruct>& exchangeStdVec); // input/output
447 #endif
448 
451  void justBalance_proc0 (const MLSamplingLevelOptions* currOptions, // input
452  std::vector<ExchangeInfoStruct>& exchangeStdVec); // input/output
453 
456  void mpiExchangePositions_inter0 (const SequenceOfVectors<P_V,P_M>& prevChain, // input
457  double prevExponent, // input
458  double currExponent, // input
459  const ScalarSequence<double>& prevLogLikelihoodValues, // input
460  const ScalarSequence<double>& prevLogTargetValues, // input
461  const std::vector<ExchangeInfoStruct>& exchangeStdVec, // input
462  const std::vector<unsigned int>& finalNumChainsPerNode, // input
463  const std::vector<unsigned int>& finalNumPositionsPerNode, // input
464  BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl); // output
465 
466  // Private variables
469 
472 
475 
478 
481 
482  unsigned int m_numDisabledParameters; // gpmsa2
483 
484  std::vector<bool> m_parameterEnabledStatus; // gpmsa2
485 
488 
490  unsigned int m_currLevel; // restart
491 
493  unsigned int m_currStep;
494 
497  std::vector<double> m_logEvidenceFactors; // restart
500  double m_eig;
501 };
502 
503 } // End namespace QUESO
504 
505 #endif // UQ_MULTI_LEVEL_SAMPLING_H
void print(std::ostream &os) const
TODO: Prints the sequence.
void generateSequence_Step07_inter0(bool useBalancedChains, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, const MLSamplingLevelOptions *currOptions, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, std::vector< ExchangeInfoStruct > &exchangeStdVec, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl)
Plans for number of linked chains for each node so that all nodes generate the closest possible to th...
Definition: MLSampling.C:3280
void generateSequence_Step08_all(BayesianJointPdf< P_V, P_M > &currPdf, GenericVectorRV< P_V, P_M > &currRv)
Creates a vector RV for current level (Step 08 from ML algorithm).
Definition: MLSampling.C:3348
void generateSequence_Step02_inter0(const MLSamplingLevelOptions *currOptions, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues, SequenceOfVectors< P_V, P_M > &prevChain, ScalarSequence< double > &prevLogLikelihoodValues, ScalarSequence< double > &prevLogTargetValues, unsigned int &indexOfFirstWeight, unsigned int &indexOfLastWeight)
Saves chain and corresponding target pdf values from previous level (Step 02 from ML algorithm)...
Definition: MLSampling.C:2625
void prepareUnbLinkedChains_inter0(unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl)
Definition: MLSampling.C:489
void generateSequence_Step03_inter0(const MLSamplingLevelOptions *currOptions, const ScalarSequence< double > &prevLogLikelihoodValues, double prevExponent, double failedExponent, double &currExponent, ScalarSequence< double > &weightSequence)
Computes currExponent and sequence of weights for current level and update &#39;m_logEvidenceFactors&#39; (St...
Definition: MLSampling.C:2763
double logEvidence() const
Method to calculate the logarithm of the evidence.
Definition: MLSampling.C:4999
void prepareBalLinkedChains_inter0(const MLSamplingLevelOptions *currOptions, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, std::vector< ExchangeInfoStruct > &exchangeStdVec, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl)
Definition: MLSampling.C:343
void justBalance_proc0(const MLSamplingLevelOptions *currOptions, std::vector< ExchangeInfoStruct > &exchangeStdVec)
Definition: MLSampling.C:1582
friend std::ostream & operator<<(std::ostream &os, const MLSampling< P_V, P_M > &obj)
Definition: MLSampling.h:204
std::vector< double > m_logEvidenceFactors
Definition: MLSampling.h:497
void generateSequence_Step06_all(const MLSamplingLevelOptions *currOptions, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, bool &useBalancedChains, std::vector< ExchangeInfoStruct > &exchangeStdVec)
Decides on wheter or not to use balanced chains (Step 06 from ML algorithm).
Definition: MLSampling.C:3247
unsigned int m_currLevel
Current level.
Definition: MLSampling.h:490
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:187
A templated class that represents a Multilevel generator of samples.
Definition: MLSampling.h:120
double m_logEvidence
Definition: MLSampling.h:498
double meanLogLikelihood() const
Method to calculate the mean of the logarithm of the likelihood.
Definition: MLSampling.C:5005
const BaseScalarFunction< P_V, P_M > & m_likelihoodFunction
Likelihood function.
Definition: MLSampling.h:474
VectorSet< P_V, P_M > * m_targetDomain
Domain of the target PDF: intersection of the domains of the prior PDf and likelihood function...
Definition: MLSampling.h:480
unsigned int numberOfPositions
Definition: MLSampling.h:69
void generateSequence(BaseVectorSequence< P_V, P_M > &workingChain, ScalarSequence< double > *workingLogLikelihoodValues, ScalarSequence< double > *workingLogTargetValues)
Method to generate the chain.
Definition: MLSampling.C:4193
void mpiExchangePositions_inter0(const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, const std::vector< ExchangeInfoStruct > &exchangeStdVec, const std::vector< unsigned int > &finalNumChainsPerNode, const std::vector< unsigned int > &finalNumPositionsPerNode, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl)
Definition: MLSampling.C:1885
std::vector< bool > m_parameterEnabledStatus
Definition: MLSampling.h:484
void generateUnbLinkedChains_all(MLSamplingLevelOptions &inputOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &rv, const UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, unsigned int indexOfFirstWeight, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, SequenceOfVectors< P_V, P_M > &workingChain, double &cumulativeRunTime, unsigned int &cumulativeRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues)
Definition: MLSampling.C:922
void generateSequence_Step09_all(const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< double > &unifiedWeightStdVectorAtProc0Only, const ScalarSequence< double > &weightSequence, double prevEta, const GenericVectorRV< P_V, P_M > &currRv, MLSamplingLevelOptions *currOptions, P_M &unifiedCovMatrix, double &currEta)
Scales the unified covariance matrix until min &lt;= rejection rate &lt;= max (Step 09 from ML algorithm)...
Definition: MLSampling.C:3381
unsigned int m_numDisabledParameters
Definition: MLSampling.h:482
void sampleIndexes_proc0(unsigned int unifiedRequestedNumSamples, const std::vector< double > &unifiedWeightStdVectorAtProc0Only, std::vector< unsigned int > &unifiedIndexCountersAtProc0Only)
Definition: MLSampling.C:93
const VectorSpace< P_V, P_M > & m_vectorSpace
Vector space.
Definition: MLSampling.h:477
This class provides options for the Multilevel sequence generator if no input file is available...
void generateSequence_Level0_all(const MLSamplingLevelOptions &currOptions, unsigned int &unifiedRequestedNumSamples, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues)
Generates the sequence at the level 0.
Definition: MLSampling.C:2429
void generateSequence_Step01_inter0(const MLSamplingLevelOptions *currOptions, unsigned int &unifiedRequestedNumSamples)
Reads options for the ML algorithm (Step 01 from ML algorithm).
Definition: MLSampling.C:2579
unsigned int originalIndexOfInitialPosition
Definition: MLSampling.h:67
double eig() const
Calculates the expected information gain value, EIG.
Definition: MLSampling.C:5011
MLSampling(const char *prefix, const BaseVectorRV< P_V, P_M > &priorRv, const BaseScalarFunction< P_V, P_M > &likelihoodFunction)
Constructor.
Definition: MLSampling.C:4146
void restartML(double &currExponent, double &currEta, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues)
Restarts ML algorithm.
Definition: MLSampling.C:2234
Class for handling vector samples (sequence of vectors).
unsigned int m_currStep
Curret step.
Definition: MLSampling.h:493
void generateSequence_Step10_all(MLSamplingLevelOptions &currOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &currRv, bool useBalancedChains, const UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, unsigned int indexOfFirstWeight, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, const BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl, SequenceOfVectors< P_V, P_M > &currChain, double &cumulativeRawChainRunTime, unsigned int &cumulativeRawChainRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues)
Samples the vector RV of current level (Step 10 from ML algorithm).
Definition: MLSampling.C:3863
double m_meanLogLikelihood
Definition: MLSampling.h:499
void generateBalLinkedChains_all(MLSamplingLevelOptions &inputOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &rv, const BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl, SequenceOfVectors< P_V, P_M > &workingChain, double &cumulativeRunTime, unsigned int &cumulativeRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues)
Definition: MLSampling.C:664
void checkpointML(double currExponent, double currEta, const SequenceOfVectors< P_V, P_M > &currChain, const ScalarSequence< double > &currLogLikelihoodValues, const ScalarSequence< double > &currLogTargetValues)
Writes checkpoint data for the ML method.
Definition: MLSampling.C:2118
void generateSequence_Step05_inter0(unsigned int unifiedRequestedNumSamples, const ScalarSequence< double > &weightSequence, std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, std::vector< double > &unifiedWeightStdVectorAtProc0Only)
Creates unified finite distribution for current level (Step 05 from ML algorithm).
Definition: MLSampling.C:3164
~MLSampling()
Destructor.
Definition: MLSampling.C:4181
bool decideOnBalancedChains_all(const MLSamplingLevelOptions *currOptions, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, std::vector< ExchangeInfoStruct > &exchangeStdVec)
Definition: MLSampling.C:147
std::vector< BalancedLinkedChainControlStruct< P_V > > balLinkedChains
Definition: MLSampling.h:86
double m_debugExponent
Exponent for debugging.
Definition: MLSampling.h:496
const BaseEnvironment & m_env
Queso enviroment.
Definition: MLSampling.h:468
const BaseVectorRV< P_V, P_M > & m_priorRv
Prior RV.
Definition: MLSampling.h:471
std::vector< UnbalancedLinkedChainControlStruct > unbLinkedChains
Definition: MLSampling.h:99
void generateSequence_Step04_inter0(const SequenceOfVectors< P_V, P_M > &prevChain, const ScalarSequence< double > &weightSequence, P_M &unifiedCovMatrix)
Creates covariance matrix for current level (Step 04 from ML algorithm).
Definition: MLSampling.C:3070
MLSamplingOptions m_options
Options for the ML algorithm.
Definition: MLSampling.h:487
This class provides options for each level of the Multilevel sequence generator if no input file is a...
void generateSequence_Step11_inter0(const MLSamplingLevelOptions *currOptions, unsigned int unifiedRequestedNumSamples, unsigned int cumulativeRawChainRejections, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues, unsigned int &unifiedNumberOfRejections)
Filters chain (Step 11 from ML algorithm).
Definition: MLSampling.C:3977

Generated on Thu Apr 23 2015 19:26:15 for queso-0.51.1 by  doxygen 1.8.5