25 #include <queso/MetropolisHastingsSGOptions.h>
26 #include <queso/Miscellaneous.h>
36 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
37 const SsOptionsValues* alternativeRawSsOptionsValues,
38 const SsOptionsValues* alternativeFilteredSsOptionsValues
62 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
63 m_rawChainComputeStats (UQ_MH_SG_RAW_CHAIN_COMPUTE_STATS_ODV),
72 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
73 m_filteredChainComputeStats (UQ_MH_SG_FILTERED_CHAIN_COMPUTE_STATS_ODV),
80 m_drScalesForExtraStages (0),
94 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
96 m_alternativeRawSsOptionsValues (),
97 m_alternativeFilteredSsOptionsValues ()
100 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
101 if (alternativeRawSsOptionsValues ) m_alternativeRawSsOptionsValues = *alternativeRawSsOptionsValues;
102 if (alternativeFilteredSsOptionsValues) m_alternativeFilteredSsOptionsValues = *alternativeFilteredSsOptionsValues;
145 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
146 m_rawChainComputeStats = src.m_rawChainComputeStats;
157 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
158 m_filteredChainComputeStats = src.m_filteredChainComputeStats;
182 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
183 m_alternativeRawSsOptionsValues = src.m_alternativeRawSsOptionsValues;
184 m_alternativeFilteredSsOptionsValues = src.m_alternativeFilteredSsOptionsValues;
198 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
200 m_rawChainStatisticalOptionsObj (NULL),
201 m_rawChainStatOptsInstantiated (false),
202 m_filteredChainStatisticalOptionsObj (NULL),
203 m_filteredChainStatOptsInstantiated (false),
207 m_prefix ((std::string)(prefix) +
"mh_"),
209 m_optionsDesc (new po::options_description(
"Bayesian Metropolis-Hastings options")),
210 m_option_help (m_prefix +
"help" ),
211 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
212 m_option_dataOutputAllowAll (m_prefix +
"dataOutputAllowAll" ),
213 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
214 m_option_totallyMute (m_prefix +
"totallyMute" ),
215 m_option_initialPosition_dataInputFileName (m_prefix +
"initialPosition_dataInputFileName" ),
216 m_option_initialPosition_dataInputFileType (m_prefix +
"initialPosition_dataInputFileType" ),
217 m_option_initialProposalCovMatrix_dataInputFileName(m_prefix +
"initialProposalCovMatrix_dataInputFileName"),
218 m_option_initialProposalCovMatrix_dataInputFileType(m_prefix +
"initialProposalCovMatrix_dataInputFileType"),
219 m_option_listOfDisabledParameters (m_prefix +
"listOfDisabledParameters" ),
220 m_option_rawChain_dataInputFileName (m_prefix +
"rawChain_dataInputFileName" ),
221 m_option_rawChain_dataInputFileType (m_prefix +
"rawChain_dataInputFileType" ),
222 m_option_rawChain_size (m_prefix +
"rawChain_size" ),
223 m_option_rawChain_generateExtra (m_prefix +
"rawChain_generateExtra" ),
224 m_option_rawChain_displayPeriod (m_prefix +
"rawChain_displayPeriod" ),
225 m_option_rawChain_measureRunTimes (m_prefix +
"rawChain_measureRunTimes" ),
226 m_option_rawChain_dataOutputPeriod (m_prefix +
"rawChain_dataOutputPeriod" ),
227 m_option_rawChain_dataOutputFileName (m_prefix +
"rawChain_dataOutputFileName" ),
228 m_option_rawChain_dataOutputFileType (m_prefix +
"rawChain_dataOutputFileType" ),
229 m_option_rawChain_dataOutputAllowAll (m_prefix +
"rawChain_dataOutputAllowAll" ),
230 m_option_rawChain_dataOutputAllowedSet (m_prefix +
"rawChain_dataOutputAllowedSet" ),
231 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
232 m_option_rawChain_computeStats (m_prefix +
"rawChain_computeStats" ),
234 m_option_filteredChain_generate (m_prefix +
"filteredChain_generate" ),
235 m_option_filteredChain_discardedPortion (m_prefix +
"filteredChain_discardedPortion" ),
236 m_option_filteredChain_lag (m_prefix +
"filteredChain_lag" ),
237 m_option_filteredChain_dataOutputFileName (m_prefix +
"filteredChain_dataOutputFileName" ),
238 m_option_filteredChain_dataOutputFileType (m_prefix +
"filteredChain_dataOutputFileType" ),
239 m_option_filteredChain_dataOutputAllowAll (m_prefix +
"filteredChain_dataOutputAllowAll" ),
240 m_option_filteredChain_dataOutputAllowedSet (m_prefix +
"filteredChain_dataOutputAllowedSet" ),
241 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
242 m_option_filteredChain_computeStats (m_prefix +
"filteredChain_computeStats" ),
244 m_option_displayCandidates (m_prefix +
"displayCandidates" ),
245 m_option_putOutOfBoundsInChain (m_prefix +
"putOutOfBoundsInChain" ),
246 m_option_tk_useLocalHessian (m_prefix +
"tk_useLocalHessian" ),
247 m_option_tk_useNewtonComponent (m_prefix +
"tk_useNewtonComponent" ),
248 m_option_dr_maxNumExtraStages (m_prefix +
"dr_maxNumExtraStages" ),
249 m_option_dr_listOfScalesForExtraStages (m_prefix +
"dr_listOfScalesForExtraStages" ),
250 m_option_dr_duringAmNonAdaptiveInt (m_prefix +
"dr_duringAmNonAdaptiveInt" ),
251 m_option_am_keepInitialMatrix (m_prefix +
"am_keepInitialMatrix" ),
252 m_option_am_initialNonAdaptInterval (m_prefix +
"am_initialNonAdaptInterval" ),
253 m_option_am_adaptInterval (m_prefix +
"am_adaptInterval" ),
254 m_option_am_adaptedMatrices_dataOutputPeriod (m_prefix +
"am_adaptedMatrices_dataOutputPeriod" ),
255 m_option_am_adaptedMatrices_dataOutputFileName (m_prefix +
"am_adaptedMatrices_dataOutputFileName" ),
256 m_option_am_adaptedMatrices_dataOutputFileType (m_prefix +
"am_adaptedMatrices_dataOutputFileType" ),
257 m_option_am_adaptedMatrices_dataOutputAllowAll (m_prefix +
"am_adaptedMatrices_dataOutputAllowAll" ),
258 m_option_am_adaptedMatrices_dataOutputAllowedSet (m_prefix +
"am_adaptedMatrices_dataOutputAllowedSet" ),
259 m_option_am_eta (m_prefix +
"am_eta" ),
260 m_option_am_epsilon (m_prefix +
"am_epsilon" ),
261 m_option_enableBrooksGelmanConvMonitor (m_prefix +
"enableBrooksGelmanConvMonitor" ),
262 m_option_BrooksGelmanLag (m_prefix +
"BrooksGelmanLag" )
266 "MetropolisHastingsSGOptions::constructor(1)",
267 "this constructor is incompatible with the absence of an options input file");
275 m_ov (alternativeOptionsValues),
276 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
277 m_rawChainStatisticalOptionsObj (NULL),
278 m_rawChainStatOptsInstantiated (false),
279 m_filteredChainStatisticalOptionsObj (NULL),
280 m_filteredChainStatOptsInstantiated (false),
282 m_prefix ((std::string)(prefix) +
"mh_"),
284 m_optionsDesc (NULL),
285 m_option_help (m_prefix +
"help" ),
286 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
287 m_option_dataOutputAllowAll (m_prefix +
"dataOutputAllowAll" ),
288 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
289 m_option_totallyMute (m_prefix +
"totallyMute" ),
290 m_option_initialPosition_dataInputFileName (m_prefix +
"initialPosition_dataInputFileName" ),
291 m_option_initialPosition_dataInputFileType (m_prefix +
"initialPosition_dataInputFileType" ),
292 m_option_initialProposalCovMatrix_dataInputFileName(m_prefix +
"initialProposalCovMatrix_dataInputFileName"),
293 m_option_initialProposalCovMatrix_dataInputFileType(m_prefix +
"initialProposalCovMatrix_dataInputFileType"),
294 m_option_listOfDisabledParameters (m_prefix +
"listOfDisabledParameters" ),
295 m_option_rawChain_dataInputFileName (m_prefix +
"rawChain_dataInputFileName" ),
296 m_option_rawChain_dataInputFileType (m_prefix +
"rawChain_dataInputFileType" ),
297 m_option_rawChain_size (m_prefix +
"rawChain_size" ),
298 m_option_rawChain_generateExtra (m_prefix +
"rawChain_generateExtra" ),
299 m_option_rawChain_displayPeriod (m_prefix +
"rawChain_displayPeriod" ),
300 m_option_rawChain_measureRunTimes (m_prefix +
"rawChain_measureRunTimes" ),
301 m_option_rawChain_dataOutputPeriod (m_prefix +
"rawChain_dataOutputPeriod" ),
302 m_option_rawChain_dataOutputFileName (m_prefix +
"rawChain_dataOutputFileName" ),
303 m_option_rawChain_dataOutputFileType (m_prefix +
"rawChain_dataOutputFileType" ),
304 m_option_rawChain_dataOutputAllowAll (m_prefix +
"rawChain_dataOutputAllowAll" ),
305 m_option_rawChain_dataOutputAllowedSet (m_prefix +
"rawChain_dataOutputAllowedSet" ),
306 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
307 m_option_rawChain_computeStats (m_prefix +
"rawChain_computeStats" ),
309 m_option_filteredChain_generate (m_prefix +
"filteredChain_generate" ),
310 m_option_filteredChain_discardedPortion (m_prefix +
"filteredChain_discardedPortion" ),
311 m_option_filteredChain_lag (m_prefix +
"filteredChain_lag" ),
312 m_option_filteredChain_dataOutputFileName (m_prefix +
"filteredChain_dataOutputFileName" ),
313 m_option_filteredChain_dataOutputFileType (m_prefix +
"filteredChain_dataOutputFileType" ),
314 m_option_filteredChain_dataOutputAllowAll (m_prefix +
"filteredChain_dataOutputAllowAll" ),
315 m_option_filteredChain_dataOutputAllowedSet (m_prefix +
"filteredChain_dataOutputAllowedSet" ),
316 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
317 m_option_filteredChain_computeStats (m_prefix +
"filteredChain_computeStats" ),
319 m_option_displayCandidates (m_prefix +
"displayCandidates" ),
320 m_option_putOutOfBoundsInChain (m_prefix +
"putOutOfBoundsInChain" ),
321 m_option_tk_useLocalHessian (m_prefix +
"tk_useLocalHessian" ),
322 m_option_tk_useNewtonComponent (m_prefix +
"tk_useNewtonComponent" ),
323 m_option_dr_maxNumExtraStages (m_prefix +
"dr_maxNumExtraStages" ),
324 m_option_dr_listOfScalesForExtraStages (m_prefix +
"dr_listOfScalesForExtraStages" ),
325 m_option_dr_duringAmNonAdaptiveInt (m_prefix +
"dr_duringAmNonAdaptiveInt" ),
326 m_option_am_keepInitialMatrix (m_prefix +
"am_keepInitialMatrix" ),
327 m_option_am_initialNonAdaptInterval (m_prefix +
"am_initialNonAdaptInterval" ),
328 m_option_am_adaptInterval (m_prefix +
"am_adaptInterval" ),
329 m_option_am_adaptedMatrices_dataOutputPeriod (m_prefix +
"am_adaptedMatrices_dataOutputPeriod" ),
330 m_option_am_adaptedMatrices_dataOutputFileName (m_prefix +
"am_adaptedMatrices_dataOutputFileName" ),
331 m_option_am_adaptedMatrices_dataOutputFileType (m_prefix +
"am_adaptedMatrices_dataOutputFileType" ),
332 m_option_am_adaptedMatrices_dataOutputAllowAll (m_prefix +
"am_adaptedMatrices_dataOutputAllowAll" ),
333 m_option_am_adaptedMatrices_dataOutputAllowedSet (m_prefix +
"am_adaptedMatrices_dataOutputAllowedSet" ),
334 m_option_am_eta (m_prefix +
"am_eta" ),
335 m_option_am_epsilon (m_prefix +
"am_epsilon" ),
336 m_option_enableBrooksGelmanConvMonitor (m_prefix +
"enableBrooksGelmanConvMonitor" ),
337 m_option_BrooksGelmanLag (m_prefix +
"BrooksGelmanLag" )
341 "MetropolisHastingsSGOptions::constructor(2)",
342 "this constructor is incompatible with the existence of an options input file");
347 <<
": after setting values of options with prefix '" <<
m_prefix
348 <<
"', state of object is:"
353 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
354 if (
m_ov.m_rawChainComputeStats) {
355 m_rawChainStatisticalOptionsObj =
new SequenceStatisticalOptions(
m_env,
m_prefix +
"rawChain_",
m_ov.m_alternativeRawSsOptionsValues);
356 m_rawChainStatOptsInstantiated =
true;
358 if (
m_ov.m_filteredChainComputeStats) {
359 m_filteredChainStatisticalOptionsObj =
new SequenceStatisticalOptions(
m_env,
m_prefix +
"filteredChain_",
m_ov.m_alternativeFilteredSsOptionsValues);
360 m_filteredChainStatOptsInstantiated =
true;
368 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
370 m_rawChainStatisticalOptionsObj (NULL),
371 m_rawChainStatOptsInstantiated (false),
372 m_filteredChainStatisticalOptionsObj (NULL),
373 m_filteredChainStatOptsInstantiated (false),
377 m_prefix (mlOptions.m_prefix),
378 m_env (mlOptions.env()),
379 m_optionsDesc (NULL),
380 m_option_help (m_prefix +
"help" ),
381 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
382 m_option_dataOutputAllowAll (m_prefix +
"dataOutputAllowAll" ),
383 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
384 m_option_totallyMute (m_prefix +
"totallyMute" ),
385 m_option_initialPosition_dataInputFileName (m_prefix +
"initialPosition_dataInputFileName" ),
386 m_option_initialPosition_dataInputFileType (m_prefix +
"initialPosition_dataInputFileType" ),
387 m_option_initialProposalCovMatrix_dataInputFileName(m_prefix +
"initialProposalCovMatrix_dataInputFileName"),
388 m_option_initialProposalCovMatrix_dataInputFileType(m_prefix +
"initialProposalCovMatrix_dataInputFileType"),
389 m_option_listOfDisabledParameters (m_prefix +
"listOfDisabledParameters" ),
390 m_option_rawChain_dataInputFileName (m_prefix +
"rawChain_dataInputFileName" ),
391 m_option_rawChain_dataInputFileType (m_prefix +
"rawChain_dataInputFileType" ),
392 m_option_rawChain_size (m_prefix +
"rawChain_size" ),
393 m_option_rawChain_generateExtra (m_prefix +
"rawChain_generateExtra" ),
394 m_option_rawChain_displayPeriod (m_prefix +
"rawChain_displayPeriod" ),
395 m_option_rawChain_measureRunTimes (m_prefix +
"rawChain_measureRunTimes" ),
396 m_option_rawChain_dataOutputPeriod (m_prefix +
"rawChain_dataOutputPeriod" ),
397 m_option_rawChain_dataOutputFileName (m_prefix +
"rawChain_dataOutputFileName" ),
398 m_option_rawChain_dataOutputFileType (m_prefix +
"rawChain_dataOutputFileType" ),
399 m_option_rawChain_dataOutputAllowAll (m_prefix +
"rawChain_dataOutputAllowAll" ),
400 m_option_rawChain_dataOutputAllowedSet (m_prefix +
"rawChain_dataOutputAllowedSet" ),
401 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
402 m_option_rawChain_computeStats (m_prefix +
"rawChain_computeStats" ),
404 m_option_filteredChain_generate (m_prefix +
"filteredChain_generate" ),
405 m_option_filteredChain_discardedPortion (m_prefix +
"filteredChain_discardedPortion" ),
406 m_option_filteredChain_lag (m_prefix +
"filteredChain_lag" ),
407 m_option_filteredChain_dataOutputFileName (m_prefix +
"filteredChain_dataOutputFileName" ),
408 m_option_filteredChain_dataOutputFileType (m_prefix +
"filteredChain_dataOutputFileType" ),
409 m_option_filteredChain_dataOutputAllowAll (m_prefix +
"filteredChain_dataOutputAllowAll" ),
410 m_option_filteredChain_dataOutputAllowedSet (m_prefix +
"filteredChain_dataOutputAllowedSet" ),
411 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
412 m_option_filteredChain_computeStats (m_prefix +
"filteredChain_computeStats" ),
414 m_option_displayCandidates (m_prefix +
"displayCandidates" ),
415 m_option_putOutOfBoundsInChain (m_prefix +
"putOutOfBoundsInChain" ),
416 m_option_tk_useLocalHessian (m_prefix +
"tk_useLocalHessian" ),
417 m_option_tk_useNewtonComponent (m_prefix +
"tk_useNewtonComponent" ),
418 m_option_dr_maxNumExtraStages (m_prefix +
"dr_maxNumExtraStages" ),
419 m_option_dr_listOfScalesForExtraStages (m_prefix +
"dr_listOfScalesForExtraStages" ),
420 m_option_dr_duringAmNonAdaptiveInt (m_prefix +
"dr_duringAmNonAdaptiveInt" ),
421 m_option_am_keepInitialMatrix (m_prefix +
"am_keepInitialMatrix" ),
422 m_option_am_initialNonAdaptInterval (m_prefix +
"am_initialNonAdaptInterval" ),
423 m_option_am_adaptInterval (m_prefix +
"am_adaptInterval" ),
424 m_option_am_adaptedMatrices_dataOutputPeriod (m_prefix +
"am_adaptedMatrices_dataOutputPeriod" ),
425 m_option_am_adaptedMatrices_dataOutputFileName (m_prefix +
"am_adaptedMatrices_dataOutputFileName" ),
426 m_option_am_adaptedMatrices_dataOutputFileType (m_prefix +
"am_adaptedMatrices_dataOutputFileType" ),
427 m_option_am_adaptedMatrices_dataOutputAllowAll (m_prefix +
"am_adaptedMatrices_dataOutputAllowAll" ),
428 m_option_am_adaptedMatrices_dataOutputAllowedSet (m_prefix +
"am_adaptedMatrices_dataOutputAllowedSet" ),
429 m_option_am_eta (m_prefix +
"am_eta" ),
430 m_option_am_epsilon (m_prefix +
"am_epsilon" ),
431 m_option_enableBrooksGelmanConvMonitor (m_prefix +
"enableBrooksGelmanConvMonitor" ),
432 m_option_BrooksGelmanLag (m_prefix +
"BrooksGelmanLag" )
454 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
455 m_ov.m_rawChainComputeStats = mlOptions.m_rawChainComputeStats;
464 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
465 m_ov.m_filteredChainComputeStats = mlOptions.m_filteredChainComputeStats;
487 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
492 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
493 m_rawChainStatisticalOptionsObj = mlOptions.m_rawChainStatisticalOptionsObj;
494 m_rawChainStatOptsInstantiated =
false;
495 m_filteredChainStatisticalOptionsObj = mlOptions.m_filteredChainStatisticalOptionsObj;
496 m_filteredChainStatOptsInstantiated =
false;
501 <<
": after copying values of options with prefix '" <<
m_prefix
502 <<
"', state of object is:"
510 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
511 if (m_filteredChainStatOptsInstantiated)
delete m_filteredChainStatisticalOptionsObj;
512 if (m_rawChainStatOptsInstantiated )
delete m_rawChainStatisticalOptionsObj;
523 "MetropolisHastingsSGOptions::scanOptionsValues()",
524 "m_optionsDesc variable is NULL");
533 <<
": after reading values of options with prefix '" <<
m_prefix
534 <<
"', state of object is:"
539 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
540 if (
m_ov.m_rawChainComputeStats) {
541 m_rawChainStatisticalOptionsObj =
new SequenceStatisticalOptions(
m_env,
m_prefix +
"rawChain_");
542 m_rawChainStatOptsInstantiated =
true;
544 if (
m_ov.m_filteredChainComputeStats) {
545 m_filteredChainStatisticalOptionsObj =
new SequenceStatisticalOptions(
m_env,
m_prefix +
"filteredChain_");
546 m_filteredChainStatOptsInstantiated =
true;
586 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
587 <<
"\n" << m_option_rawChain_computeStats <<
" = " <<
m_ov.m_rawChainComputeStats
600 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
601 <<
"\n" << m_option_filteredChain_computeStats <<
" = " <<
m_ov.m_filteredChainComputeStats
637 optionsDesc.add_options()
638 (
m_option_help.c_str(),
"produce help msg for Bayesian Metropolis-Hastings" )
659 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
660 (m_option_rawChain_computeStats.c_str(), po::value<bool >()->default_value(UQ_MH_SG_RAW_CHAIN_COMPUTE_STATS_ODV ),
"compute statistics on raw chain" )
669 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
670 (m_option_filteredChain_computeStats.c_str(), po::value<bool >()->default_value(UQ_MH_SG_FILTERED_CHAIN_COMPUTE_STATS_ODV ),
"compute statistics on filtered chain" )
720 std::vector<double> tmpAllow(0,0.);
724 if (tmpAllow.size() > 0) {
725 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
753 std::vector<double> tmpAllow(0,0.);
756 if (tmpAllow.size() > 0) {
757 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
804 std::vector<double> tmpAllow(0,0.);
808 if (tmpAllow.size() > 0) {
809 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
815 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
817 m_ov.m_rawChainComputeStats = ((
const po::variable_value&)
m_env.
allOptionsMap()[m_option_rawChain_computeStats]).as<bool>();
837 std::cerr <<
"WARNING In MetropolisHastingsSG<P_V,P_M>::getMyOptionsValues()"
867 std::vector<double> tmpAllow(0,0.);
871 if (tmpAllow.size() > 0) {
872 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
878 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
880 m_ov.m_filteredChainComputeStats = ((
const po::variable_value&)
m_env.
allOptionsMap()[m_option_filteredChain_computeStats]).as<bool>();
903 std::vector<double> tmpScales(0,0.);
918 unsigned int tmpSize = tmpScales.size();
923 if (i < tmpSize) scale = tmpScales[i];
966 std::vector<double> tmpAllow(0,0.);
970 if (tmpAllow.size() > 0) {
971 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
std::string m_option_filteredChain_lag
#define UQ_MH_SG_DR_LIST_OF_SCALES_FOR_EXTRA_STAGES_ODV
std::string m_rawChainDataOutputFileType
Type of output file for raw chain.
std::string m_amAdaptedMatricesDataOutputFileName
Name of output file for 'am' adapted matrices.
std::string m_initialProposalCovMatrixDataInputFileType
Type of input file for initial proposal covariance matrix.
#define UQ_MH_SG_DATA_OUTPUT_ALLOW_ALL_ODV
std::string m_option_putOutOfBoundsInChain
bool m_filteredChainGenerate
Whether or not to generate filtered chain.
#define UQ_MH_SG_FILTERED_CHAIN_DISCARDED_PORTION_ODV
std::string m_option_dr_duringAmNonAdaptiveInt
po::options_description * m_optionsDesc
std::string m_option_rawChain_size
int subRank() const
Access function for sub-rank.
std::string m_option_rawChain_dataInputFileType
#define UQ_MH_SG_RAW_CHAIN_GENERATE_EXTRA_ODV
bool m_dataOutputAllowAll
#define UQ_MH_SG_AM_ETA_ODV
#define UQ_MH_SG_BROOKS_GELMAN_LAG
#define UQ_MH_SG_RAW_CHAIN_MEASURE_RUN_TIMES_ODV
unsigned int m_rawChainSize
std::string m_option_am_initialNonAdaptInterval
unsigned int m_amInitialNonAdaptInterval
unsigned int m_amAdaptInterval
'am' adaptation interval.
#define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_FILE_NAME_ODV
bool m_rawChainDataOutputAllowAll
#define UQ_MH_SG_INITIAL_POSITION_DATA_INPUT_FILE_TYPE_ODV
unsigned int m_drMaxNumExtraStages
bool m_putOutOfBoundsInChain
Put 'out of bound' candidates in chain as well.
const BaseEnvironment & m_env
std::set< unsigned int > m_parameterDisabledSet
std::string m_option_totallyMute
unsigned int m_rawChainSize
Size of raw chain.
std::string m_option_initialPosition_dataInputFileName
std::string m_option_dr_maxNumExtraStages
std::string m_option_rawChain_dataOutputFileName
std::string m_option_dataOutputAllowAll
int inter0Rank() const
Returns the process inter0 rank.
bool m_filteredChainDataOutputAllowAll
bool m_amAdaptedMatricesDataOutputAllowAll
Whether or not subEnvs will write to output file for 'am' adapted matrices.
double m_filteredChainDiscardedPortion
Initial discarded portion for chain filtering.
bool m_putOutOfBoundsInChain
std::string m_rawChainDataOutputFileName
std::string m_rawChainDataOutputFileType
int worldRank() const
Returns the process world rank.
std::string m_amAdaptedMatricesDataOutputFileType
Type of output file for 'am' adapted matrices.
unsigned int m_rawChainDataOutputPeriod
#define UQ_MH_SG_INITIAL_PROPOSAL_COV_MATRIX_DATA_INPUT_FILE_TYPE_ODV
#define UQ_MH_SG_AM_EPSILON_ODV
std::string m_option_dataOutputFileName
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_ALLOWED_SET_ODV
void scanOptionsValues()
It scans the option values from the options input file.
std::string m_initialProposalCovMatrixDataInputFileName
#define UQ_MH_SG_PUT_OUT_OF_BOUNDS_IN_CHAIN_ODV
std::string m_option_filteredChain_discardedPortion
void print(std::ostream &os) const
It prints the option values.
unsigned int m_amInitialNonAdaptInterval
'am' initial non adaptation interval
unsigned int m_filteredChainLag
Spacing for chain filtering.
#define UQ_MH_SG_ENABLE_BROOKS_GELMAN_CONV_MONITOR
std::string m_option_rawChain_dataOutputFileType
std::string m_option_filteredChain_generate
#define UQ_MH_SG_INITIAL_PROPOSAL_COV_MATRIX_DATA_INPUT_FILE_NAME_ODV
std::string m_option_filteredChain_dataOutputAllowedSet
std::string m_option_am_adaptedMatrices_dataOutputPeriod
std::string m_initialPositionDataInputFileName
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_ALLOWED_SET_ODV
void defineMyOptions(po::options_description &optionsDesc) const
Defines the options for the Metropolis-Hastings generator of samples as the default options...
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_ALLOW_ALL_ODV
#define UQ_MH_SG_DATA_OUTPUT_ALLOWED_SET_ODV
po::variables_map & allOptionsMap() const
std::string m_dataOutputFileName
std::string m_option_dataOutputAllowedSet
std::string m_rawChainDataInputFileName
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
std::string m_option_rawChain_measureRunTimes
std::string m_option_filteredChain_dataOutputFileType
bool m_dataOutputAllowAll
subEnvs that will write to generic output file.
bool m_tkUseLocalHessian
Whether or not 'proposal' uses local Hessian.
std::string m_option_tk_useNewtonComponent
void getMyOptionValues(po::options_description &optionsDesc)
Gets the sequence options defined to the Metropolis-Hastings algorithm.
bool m_filteredChainGenerate
unsigned int m_enableBrooksGelmanConvMonitor
unsigned int m_amAdaptInterval
#define UQ_MH_SG_DR_MAX_NUM_EXTRA_STAGES_ODV
std::string m_option_am_keepInitialMatrix
#define UQ_MH_SG_RAW_CHAIN_DATA_INPUT_FILE_TYPE_ODV
~MhOptionsValues()
Destructor.
double m_amEta
Proposal covariance scaling factor, usually 2.4 * 2.4 / d.
std::set< unsigned int > m_rawChainDataOutputAllowedSet
unsigned int m_drMaxNumExtraStages
'dr' maximum number of extra stages.
std::string m_dataOutputFileName
Name of generic output file.
bool m_tkUseNewtonComponent
std::string m_option_filteredChain_dataOutputAllowAll
#define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_FILE_TYPE_ODV
unsigned int m_rawChainDataOutputPeriod
Period of message display during raw chain generation.
std::string m_option_am_epsilon
See MhOptionsValues::m_amEpsilon.
std::string m_rawChainDataInputFileType
Type of input file for raw chain.
std::string m_option_rawChain_displayPeriod
std::string m_initialProposalCovMatrixDataInputFileType
std::string m_amAdaptedMatricesDataOutputFileName
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_FILE_TYPE_ODV
unsigned int m_BrooksGelmanLag
#define UQ_MH_SG_RAW_CHAIN_DISPLAY_PERIOD_ODV
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
std::set< unsigned int > m_filteredChainDataOutputAllowedSet
subEnvs that will write to output file for filtered chain.
#define UQ_MH_SG_FILTERED_CHAIN_GENERATE_ODV
#define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_ALLOWED_SET_ODV
std::string m_option_displayCandidates
std::set< unsigned int > m_filteredChainDataOutputAllowedSet
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
std::set< unsigned int > m_rawChainDataOutputAllowedSet
subEnvs that will write to output file for raw chain.
std::set< unsigned int > m_parameterDisabledSet
std::string m_initialPositionDataInputFileType
bool m_rawChainMeasureRunTimes
std::string m_option_rawChain_dataOutputAllowedSet
std::string m_filteredChainDataOutputFileType
std::set< unsigned int > m_amAdaptedMatricesDataOutputAllowedSet
subEnvs that will write to output file for 'am' adapted matrices.
std::string m_filteredChainDataOutputFileName
unsigned int m_rawChainDisplayPeriod
Period of message display during raw chain generation.
std::string m_filteredChainDataOutputFileType
Type of output file for filtered chain.
#define UQ_MH_SG_DR_DURING_AM_NON_ADAPTIVE_INT_ODV
unsigned int m_amAdaptedMatricesDataOutputPeriod
bool m_amKeepInitialMatrix
unsigned int m_amAdaptedMatricesDataOutputPeriod
Period for outputing 'am' adapted matrices.
MetropolisHastingsSGOptions(const BaseEnvironment &env, const char *prefix)
Constructor: reads options from the input file.
std::vector< double > m_drScalesForExtraStages
'dr' list of scales for proposal covariance matrices from 2nd stage on.
std::string m_initialPositionDataInputFileName
Name of input file for initial position.
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_FILE_NAME_ODV
std::string m_option_rawChain_dataOutputPeriod
std::string m_initialPositionDataInputFileType
Type of input file for initial position.
bool m_amKeepInitialMatrix
Whether or not 'am' will keep initial (given) matrix.
std::vector< double > m_drScalesForExtraStages
std::string m_option_BrooksGelmanLag
MhOptionsValues & operator=(const MhOptionsValues &rhs)
Assignment operator; it copies rhs to this.
bool m_tkUseNewtonComponent
Whether or not 'proposal' uses Newton component.
#define UQ_MH_SG_TK_USE_LOCAL_HESSIAN_ODV
#define UQ_MH_SG_DATA_OUTPUT_FILE_NAME_ODV
bool m_rawChainMeasureRunTimes
Whether or not to measure run times.
int fullRank() const
Returns the process full rank.
std::string m_amAdaptedMatricesDataOutputFileType
std::string m_option_am_adaptInterval
MhOptionsValues()
Default constructor.
bool m_displayCandidates
Display candidates generated in the core MH algorithm.
void copy(const MhOptionsValues &src)
Copies the option values from src to this.
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_PERIOD_ODV
This class provides options for each level of the Multilevel sequence generator if no input file is a...
bool m_drDuringAmNonAdaptiveInt
Whether or not 'dr' is used during 'am' non adaptive interval.
#define UQ_MH_SG_RAW_CHAIN_DATA_INPUT_FILE_NAME_ODV
std::string m_option_am_adaptedMatrices_dataOutputAllowAll
#define UQ_MH_SG_DISPLAY_CANDIDATES_ODV
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_dr_listOfScalesForExtraStages
bool m_totallyMute
Whether or not to be totally mute (no printout message).
#define UQ_MH_SG_FILTERED_CHAIN_LAG_ODV
#define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_ALLOW_ALL_ODV
bool m_rawChainGenerateExtra
bool m_amAdaptedMatricesDataOutputAllowAll
#define UQ_MH_SG_LIST_OF_DISABLED_PARAMETERS_ODV
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_ALLOW_ALL_ODV
#define UQ_MH_SG_AM_INIT_NON_ADAPT_INT_ODV
This class provides options for the Metropolis-Hastings generator of samples if no input file is avai...
std::string m_option_filteredChain_dataOutputFileName
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
double m_amEpsilon
Regularisation parameter for the DRAM covariance matrix.
~MetropolisHastingsSGOptions()
Destructor.
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_FILE_TYPE_ODV
std::string m_option_initialPosition_dataInputFileType
std::string m_initialProposalCovMatrixDataInputFileName
Name of input file for initial proposal covariance matrix.
std::string m_option_tk_useLocalHessian
std::string m_option_am_adaptedMatrices_dataOutputFileType
bool m_filteredChainDataOutputAllowAll
Whether or not subEnvs will write to output file for filtered chain.
std::string m_option_rawChain_generateExtra
std::string m_option_initialProposalCovMatrix_dataInputFileType
#define UQ_MH_SG_RAW_CHAIN_SIZE_ODV
std::string m_option_rawChain_dataOutputAllowAll
std::string m_rawChainDataInputFileName
Name of input file for raw chain.
#define UQ_MH_SG_AM_ADAPT_INTERVAL_ODV
std::string m_option_initialProposalCovMatrix_dataInputFileName
std::string m_rawChainDataOutputFileName
Name of output file for raw chain.
bool m_rawChainDataOutputAllowAll
Whether or not subEnvs will write to output file for raw chain.
MhOptionsValues m_ov
This class is where the actual options are stored.
std::set< unsigned int > m_amAdaptedMatricesDataOutputAllowedSet
std::string m_option_rawChain_dataInputFileName
std::string m_option_help
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_FILE_NAME_ODV
#define UQ_MH_SG_TOTALLY_MUTE_ODV
unsigned int m_filteredChainLag
std::string m_option_listOfDisabledParameters
bool m_drDuringAmNonAdaptiveInt
std::string m_option_am_adaptedMatrices_dataOutputAllowedSet
double m_filteredChainDiscardedPortion
double m_amEta
'am' eta.
#define UQ_MH_SG_AM_KEEP_INITIAL_MATRIX_ODV
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_PERIOD_ODV
#define UQ_MH_SG_TK_USE_NEWTON_COMPONENT_ODV
double m_amEpsilon
'am' epsilon.
bool m_rawChainGenerateExtra
Generate extra information about raw chain.
std::string m_option_enableBrooksGelmanConvMonitor
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
std::string m_option_am_eta
See MhOptionsValues::m_amEta.
#define UQ_MH_SG_INITIAL_POSITION_DATA_INPUT_FILE_NAME_ODV
std::string m_filteredChainDataOutputFileName
Name of output file for filtered chain.
std::set< unsigned int > m_dataOutputAllowedSet
subEnvs that will write to generic output file.
void scanInputFileForMyOptions(const po::options_description &optionsDesc) const
This method scans the input file provided by the user to QUESO.
unsigned int m_rawChainDisplayPeriod
std::string m_rawChainDataInputFileType
std::string m_option_am_adaptedMatrices_dataOutputFileName
This class reads the options for the Metropolis-Hastings generator of samples from an input file...