queso-0.52.0
MetropolisHastingsSGOptions.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-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 #ifndef UQ_MH_SG_OPTIONS_H
26 #define UQ_MH_SG_OPTIONS_H
27 
28 #include <queso/Environment.h>
29 #include <queso/MLSamplingLevelOptions.h>
30 #include <queso/SequenceStatisticalOptions.h>
31 
32 #undef UQ_MH_SG_REQUIRES_INVERTED_COV_MATRICES
33 #define UQ_NOTHING_JUST_FOR_TEST_OF_SVN_ID 1
34 
35 #define UQ_MH_SG_FILENAME_FOR_NO_FILE "."
36 
37 // _ODV = option default value
38 #define UQ_MH_SG_DATA_OUTPUT_FILE_NAME_ODV UQ_MH_SG_FILENAME_FOR_NO_FILE
39 #define UQ_MH_SG_DATA_OUTPUT_ALLOW_ALL_ODV 0
40 #define UQ_MH_SG_DATA_OUTPUT_ALLOWED_SET_ODV ""
41 
42 #define UQ_MH_SG_TOTALLY_MUTE_ODV 0
43 #define UQ_MH_SG_INITIAL_POSITION_DATA_INPUT_FILE_NAME_ODV UQ_MH_SG_FILENAME_FOR_NO_FILE
44 #define UQ_MH_SG_INITIAL_POSITION_DATA_INPUT_FILE_TYPE_ODV UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
45 #define UQ_MH_SG_INITIAL_PROPOSAL_COV_MATRIX_DATA_INPUT_FILE_NAME_ODV UQ_MH_SG_FILENAME_FOR_NO_FILE
46 #define UQ_MH_SG_INITIAL_PROPOSAL_COV_MATRIX_DATA_INPUT_FILE_TYPE_ODV UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
47 #define UQ_MH_SG_LIST_OF_DISABLED_PARAMETERS_ODV ""
48 #define UQ_MH_SG_RAW_CHAIN_DATA_INPUT_FILE_NAME_ODV UQ_MH_SG_FILENAME_FOR_NO_FILE
49 #define UQ_MH_SG_RAW_CHAIN_DATA_INPUT_FILE_TYPE_ODV UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
50 #define UQ_MH_SG_RAW_CHAIN_SIZE_ODV 100
51 #define UQ_MH_SG_RAW_CHAIN_GENERATE_EXTRA_ODV 0
52 #define UQ_MH_SG_RAW_CHAIN_DISPLAY_PERIOD_ODV 500
53 #define UQ_MH_SG_RAW_CHAIN_MEASURE_RUN_TIMES_ODV 1
54 #define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_PERIOD_ODV 0
55 #define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_FILE_NAME_ODV UQ_MH_SG_FILENAME_FOR_NO_FILE
56 #define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_FILE_TYPE_ODV UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
57 #define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_ALLOW_ALL_ODV 0
58 #define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_ALLOWED_SET_ODV ""
59 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
60 #define UQ_MH_SG_RAW_CHAIN_COMPUTE_STATS_ODV 0
61 #endif
62 #define UQ_MH_SG_FILTERED_CHAIN_GENERATE_ODV 0
63 #define UQ_MH_SG_FILTERED_CHAIN_DISCARDED_PORTION_ODV 0.
64 #define UQ_MH_SG_FILTERED_CHAIN_LAG_ODV 1
65 #define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_FILE_NAME_ODV UQ_MH_SG_FILENAME_FOR_NO_FILE
66 #define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_FILE_TYPE_ODV UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
67 #define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_ALLOW_ALL_ODV 0
68 #define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_ALLOWED_SET_ODV ""
69 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
70 #define UQ_MH_SG_FILTERED_CHAIN_COMPUTE_STATS_ODV 0
71 #endif
72 #define UQ_MH_SG_DISPLAY_CANDIDATES_ODV 0
73 #define UQ_MH_SG_PUT_OUT_OF_BOUNDS_IN_CHAIN_ODV 1
74 #define UQ_MH_SG_TK_USE_LOCAL_HESSIAN_ODV 0
75 #define UQ_MH_SG_TK_USE_NEWTON_COMPONENT_ODV 1
76 #define UQ_MH_SG_DR_MAX_NUM_EXTRA_STAGES_ODV 0
77 #define UQ_MH_SG_DR_LIST_OF_SCALES_FOR_EXTRA_STAGES_ODV ""
78 #define UQ_MH_SG_DR_DURING_AM_NON_ADAPTIVE_INT_ODV 1
79 #define UQ_MH_SG_AM_KEEP_INITIAL_MATRIX_ODV 0
80 #define UQ_MH_SG_AM_INIT_NON_ADAPT_INT_ODV 0
81 #define UQ_MH_SG_AM_ADAPT_INTERVAL_ODV 0
82 #define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_PERIOD_ODV 0
83 #define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_FILE_NAME_ODV UQ_MH_SG_FILENAME_FOR_NO_FILE
84 #define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_FILE_TYPE_ODV UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
85 #define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_ALLOW_ALL_ODV 0
86 #define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_ALLOWED_SET_ODV ""
87 #define UQ_MH_SG_AM_ETA_ODV 1.
88 #define UQ_MH_SG_AM_EPSILON_ODV 1.e-5
89 #define UQ_MH_SG_ENABLE_BROOKS_GELMAN_CONV_MONITOR 0
90 #define UQ_MH_SG_BROOKS_GELMAN_LAG 100
91 #define UQ_MH_SG_OUTPUT_LOG_LIKELIHOOD 1
92 #define UQ_MH_SG_OUTPUT_LOG_TARGET 1
93 #define UQ_MH_SG_DO_LOGIT_TRANSFORM 1
94 
95 namespace QUESO {
96 
111 {
112 public:
113 
115 
116 
117 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
118  MhOptionsValues (const SsOptionsValues* alternativeRawSsOptionsValues,
119  const SsOptionsValues* alternativeFilteredSsOptionsValues);
120 #else
121 
123 
124  MhOptionsValues ();
125 #endif
126 
128 
129  MhOptionsValues (const MhOptionsValues& src);
130 
132  ~MhOptionsValues ();
134 
136 
140 
141  std::string m_dataOutputFileName;
143  std::set<unsigned int> m_dataOutputAllowedSet;
144 
150  std::set<unsigned int> m_parameterDisabledSet; // gpmsa2
153  unsigned int m_rawChainSize;
161  std::set<unsigned int> m_rawChainDataOutputAllowedSet;
162 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
163  bool m_rawChainComputeStats;
164 #endif
165 
167 
172 
174 
178  double m_filteredChainDiscardedPortion; // input or set during run time
179 
181 
185  unsigned int m_filteredChainLag; // input or set during run time
186 
191  std::set<unsigned int> m_filteredChainDataOutputAllowedSet;
192 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
193  bool m_filteredChainComputeStats;
194 #endif
195 
200  unsigned int m_drMaxNumExtraStages;
201  std::vector<double> m_drScalesForExtraStages;
205  unsigned int m_amAdaptInterval;
211 
221  double m_amEta;
222 
231  double m_amEpsilon;
232 
234  unsigned int m_BrooksGelmanLag;
235 
238 
241 
244 
245 private:
247  void copy(const MhOptionsValues& src);
248 
249 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
250  friend class MetropolisHastingsSGOptions;
251  SsOptionsValues m_alternativeRawSsOptionsValues;
252  SsOptionsValues m_alternativeFilteredSsOptionsValues;
253 #endif
254 };
255 
271 {
272 public:
274 
275  MetropolisHastingsSGOptions(const BaseEnvironment& env, const char* prefix);
277 
279 
280  MetropolisHastingsSGOptions(const BaseEnvironment& env, const char* prefix, const MhOptionsValues& alternativeOptionsValues);
281 
284 
288 
290 
291  void scanOptionsValues();
293 
295  void print (std::ostream& os) const;
297 
300 
301 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
302  SequenceStatisticalOptions* m_rawChainStatisticalOptionsObj;
303  bool m_rawChainStatOptsInstantiated;
304  SequenceStatisticalOptions* m_filteredChainStatisticalOptionsObj;
305  bool m_filteredChainStatOptsInstantiated;
306 #endif
307  std::string m_prefix;
308 
309 private:
311  void defineMyOptions (po::options_description& optionsDesc) const;
312 
314  void getMyOptionValues(po::options_description& optionsDesc);
315 
317  po::options_description* m_optionsDesc;
318 
319  std::string m_option_help;
320 
324 
325  std::string m_option_totallyMute;
330  std::string m_option_listOfDisabledParameters; // gpmsa2
342 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
343  std::string m_option_rawChain_computeStats;
344 #endif
352 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
353  std::string m_option_filteredChain_computeStats;
354 #endif
370 
372  std::string m_option_am_eta;
374  std::string m_option_am_epsilon;
375 
378 
382 };
383 
384 std::ostream& operator<<(std::ostream& os, const MetropolisHastingsSGOptions& obj);
385 
386 } // End namespace QUESO
387 
388 #endif // UQ_MH_SG_OPTIONS_H
This class provides options for the Metropolis-Hastings generator of samples if no input file is avai...
This class provides options for each level of the Multilevel sequence generator if no input file is a...
std::string m_initialProposalCovMatrixDataInputFileType
unsigned int m_filteredChainLag
Set the lag for the filtered chain. Default is 1.
bool m_filteredChainGenerate
Toggle the option to save a filtered chain. Default is 0 (off).
MhOptionsValues & operator=(const MhOptionsValues &rhs)
Assignment operator; it copies rhs to this.
void print(std::ostream &os) const
It prints the option values.
bool m_doLogitTransform
Flag for deciding whether or not to do logit transform of bounded domains.
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
This class reads the options for the Metropolis-Hastings generator of samples from an input file...
MetropolisHastingsSGOptions(const BaseEnvironment &env, const char *prefix)
Constructor: reads options from the input file.
double m_amEta
Proposal covariance scaling factor, usually 2.4 * 2.4 / d.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:187
std::vector< double > m_drScalesForExtraStages
std::string m_initialProposalCovMatrixDataInputFileName
void defineMyOptions(po::options_description &optionsDesc) const
Defines the options for the Metropolis-Hastings generator of samples as the default options...
std::string m_filteredChainDataOutputFileName
File name to save the filtered chain to. Default is &quot;.&quot;.
std::set< unsigned int > m_parameterDisabledSet
bool m_outputLogLikelihood
Flag for deciding whether or not to dump log likelihood values in output.
MhOptionsValues()
Default constructor.
MhOptionsValues m_ov
This class is where the actual options are stored.
void getMyOptionValues(po::options_description &optionsDesc)
Gets the sequence options defined to the Metropolis-Hastings algorithm.
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_am_eta
See MhOptionsValues::m_amEta.
double m_amEpsilon
Regularisation parameter for the DRAM covariance matrix.
std::set< unsigned int > m_filteredChainDataOutputAllowedSet
std::set< unsigned int > m_rawChainDataOutputAllowedSet
bool m_outputLogTarget
Flag for deciding whether or not to dump log target values in output.
void copy(const MhOptionsValues &src)
Copies the option values from src to this.
void scanOptionsValues()
It scans the option values from the options input file.
double m_filteredChainDiscardedPortion
What initial fraction of the filtered chain is discarded. Default is 0.
std::string m_option_am_epsilon
See MhOptionsValues::m_amEpsilon.
std::set< unsigned int > m_amAdaptedMatricesDataOutputAllowedSet

Generated on Thu Apr 23 2015 19:30:54 for queso-0.52.0 by  doxygen 1.8.5