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),
97 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
99 m_alternativeRawSsOptionsValues (),
100 m_alternativeFilteredSsOptionsValues ()
103 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
104 if (alternativeRawSsOptionsValues ) m_alternativeRawSsOptionsValues = *alternativeRawSsOptionsValues;
105 if (alternativeFilteredSsOptionsValues) m_alternativeFilteredSsOptionsValues = *alternativeFilteredSsOptionsValues;
148 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
149 m_rawChainComputeStats = src.m_rawChainComputeStats;
160 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
161 m_filteredChainComputeStats = src.m_filteredChainComputeStats;
188 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
189 m_alternativeRawSsOptionsValues = src.m_alternativeRawSsOptionsValues;
190 m_alternativeFilteredSsOptionsValues = src.m_alternativeFilteredSsOptionsValues;
204 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
206 m_rawChainStatisticalOptionsObj (NULL),
207 m_rawChainStatOptsInstantiated (false),
208 m_filteredChainStatisticalOptionsObj (NULL),
209 m_filteredChainStatOptsInstantiated (false),
213 m_prefix ((std::string)(prefix) +
"mh_"),
215 m_optionsDesc (new po::options_description(
"Bayesian Metropolis-Hastings options")),
216 m_option_help (m_prefix +
"help" ),
217 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
218 m_option_dataOutputAllowAll (m_prefix +
"dataOutputAllowAll" ),
219 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
220 m_option_totallyMute (m_prefix +
"totallyMute" ),
221 m_option_initialPosition_dataInputFileName (m_prefix +
"initialPosition_dataInputFileName" ),
222 m_option_initialPosition_dataInputFileType (m_prefix +
"initialPosition_dataInputFileType" ),
223 m_option_initialProposalCovMatrix_dataInputFileName(m_prefix +
"initialProposalCovMatrix_dataInputFileName"),
224 m_option_initialProposalCovMatrix_dataInputFileType(m_prefix +
"initialProposalCovMatrix_dataInputFileType"),
225 m_option_listOfDisabledParameters (m_prefix +
"listOfDisabledParameters" ),
226 m_option_rawChain_dataInputFileName (m_prefix +
"rawChain_dataInputFileName" ),
227 m_option_rawChain_dataInputFileType (m_prefix +
"rawChain_dataInputFileType" ),
228 m_option_rawChain_size (m_prefix +
"rawChain_size" ),
229 m_option_rawChain_generateExtra (m_prefix +
"rawChain_generateExtra" ),
230 m_option_rawChain_displayPeriod (m_prefix +
"rawChain_displayPeriod" ),
231 m_option_rawChain_measureRunTimes (m_prefix +
"rawChain_measureRunTimes" ),
232 m_option_rawChain_dataOutputPeriod (m_prefix +
"rawChain_dataOutputPeriod" ),
233 m_option_rawChain_dataOutputFileName (m_prefix +
"rawChain_dataOutputFileName" ),
234 m_option_rawChain_dataOutputFileType (m_prefix +
"rawChain_dataOutputFileType" ),
235 m_option_rawChain_dataOutputAllowAll (m_prefix +
"rawChain_dataOutputAllowAll" ),
236 m_option_rawChain_dataOutputAllowedSet (m_prefix +
"rawChain_dataOutputAllowedSet" ),
237 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
238 m_option_rawChain_computeStats (m_prefix +
"rawChain_computeStats" ),
240 m_option_filteredChain_generate (m_prefix +
"filteredChain_generate" ),
241 m_option_filteredChain_discardedPortion (m_prefix +
"filteredChain_discardedPortion" ),
242 m_option_filteredChain_lag (m_prefix +
"filteredChain_lag" ),
243 m_option_filteredChain_dataOutputFileName (m_prefix +
"filteredChain_dataOutputFileName" ),
244 m_option_filteredChain_dataOutputFileType (m_prefix +
"filteredChain_dataOutputFileType" ),
245 m_option_filteredChain_dataOutputAllowAll (m_prefix +
"filteredChain_dataOutputAllowAll" ),
246 m_option_filteredChain_dataOutputAllowedSet (m_prefix +
"filteredChain_dataOutputAllowedSet" ),
247 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
248 m_option_filteredChain_computeStats (m_prefix +
"filteredChain_computeStats" ),
250 m_option_displayCandidates (m_prefix +
"displayCandidates" ),
251 m_option_putOutOfBoundsInChain (m_prefix +
"putOutOfBoundsInChain" ),
252 m_option_tk_useLocalHessian (m_prefix +
"tk_useLocalHessian" ),
253 m_option_tk_useNewtonComponent (m_prefix +
"tk_useNewtonComponent" ),
254 m_option_dr_maxNumExtraStages (m_prefix +
"dr_maxNumExtraStages" ),
255 m_option_dr_listOfScalesForExtraStages (m_prefix +
"dr_listOfScalesForExtraStages" ),
256 m_option_dr_duringAmNonAdaptiveInt (m_prefix +
"dr_duringAmNonAdaptiveInt" ),
257 m_option_am_keepInitialMatrix (m_prefix +
"am_keepInitialMatrix" ),
258 m_option_am_initialNonAdaptInterval (m_prefix +
"am_initialNonAdaptInterval" ),
259 m_option_am_adaptInterval (m_prefix +
"am_adaptInterval" ),
260 m_option_am_adaptedMatrices_dataOutputPeriod (m_prefix +
"am_adaptedMatrices_dataOutputPeriod" ),
261 m_option_am_adaptedMatrices_dataOutputFileName (m_prefix +
"am_adaptedMatrices_dataOutputFileName" ),
262 m_option_am_adaptedMatrices_dataOutputFileType (m_prefix +
"am_adaptedMatrices_dataOutputFileType" ),
263 m_option_am_adaptedMatrices_dataOutputAllowAll (m_prefix +
"am_adaptedMatrices_dataOutputAllowAll" ),
264 m_option_am_adaptedMatrices_dataOutputAllowedSet (m_prefix +
"am_adaptedMatrices_dataOutputAllowedSet" ),
265 m_option_am_eta (m_prefix +
"am_eta" ),
266 m_option_am_epsilon (m_prefix +
"am_epsilon" ),
267 m_option_enableBrooksGelmanConvMonitor (m_prefix +
"enableBrooksGelmanConvMonitor" ),
268 m_option_BrooksGelmanLag (m_prefix +
"BrooksGelmanLag" ),
269 m_option_outputLogLikelihood (m_prefix +
"outputLogLikelihood" ),
270 m_option_outputLogTarget (m_prefix +
"outputLogTarget" ),
271 m_option_doLogitTransform (m_prefix +
"doLogitTransform" )
275 "MetropolisHastingsSGOptions::constructor(1)",
276 "this constructor is incompatible with the absence of an options input file");
284 m_ov (alternativeOptionsValues),
285 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
286 m_rawChainStatisticalOptionsObj (NULL),
287 m_rawChainStatOptsInstantiated (false),
288 m_filteredChainStatisticalOptionsObj (NULL),
289 m_filteredChainStatOptsInstantiated (false),
291 m_prefix ((std::string)(prefix) +
"mh_"),
293 m_optionsDesc (NULL),
294 m_option_help (m_prefix +
"help" ),
295 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
296 m_option_dataOutputAllowAll (m_prefix +
"dataOutputAllowAll" ),
297 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
298 m_option_totallyMute (m_prefix +
"totallyMute" ),
299 m_option_initialPosition_dataInputFileName (m_prefix +
"initialPosition_dataInputFileName" ),
300 m_option_initialPosition_dataInputFileType (m_prefix +
"initialPosition_dataInputFileType" ),
301 m_option_initialProposalCovMatrix_dataInputFileName(m_prefix +
"initialProposalCovMatrix_dataInputFileName"),
302 m_option_initialProposalCovMatrix_dataInputFileType(m_prefix +
"initialProposalCovMatrix_dataInputFileType"),
303 m_option_listOfDisabledParameters (m_prefix +
"listOfDisabledParameters" ),
304 m_option_rawChain_dataInputFileName (m_prefix +
"rawChain_dataInputFileName" ),
305 m_option_rawChain_dataInputFileType (m_prefix +
"rawChain_dataInputFileType" ),
306 m_option_rawChain_size (m_prefix +
"rawChain_size" ),
307 m_option_rawChain_generateExtra (m_prefix +
"rawChain_generateExtra" ),
308 m_option_rawChain_displayPeriod (m_prefix +
"rawChain_displayPeriod" ),
309 m_option_rawChain_measureRunTimes (m_prefix +
"rawChain_measureRunTimes" ),
310 m_option_rawChain_dataOutputPeriod (m_prefix +
"rawChain_dataOutputPeriod" ),
311 m_option_rawChain_dataOutputFileName (m_prefix +
"rawChain_dataOutputFileName" ),
312 m_option_rawChain_dataOutputFileType (m_prefix +
"rawChain_dataOutputFileType" ),
313 m_option_rawChain_dataOutputAllowAll (m_prefix +
"rawChain_dataOutputAllowAll" ),
314 m_option_rawChain_dataOutputAllowedSet (m_prefix +
"rawChain_dataOutputAllowedSet" ),
315 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
316 m_option_rawChain_computeStats (m_prefix +
"rawChain_computeStats" ),
318 m_option_filteredChain_generate (m_prefix +
"filteredChain_generate" ),
319 m_option_filteredChain_discardedPortion (m_prefix +
"filteredChain_discardedPortion" ),
320 m_option_filteredChain_lag (m_prefix +
"filteredChain_lag" ),
321 m_option_filteredChain_dataOutputFileName (m_prefix +
"filteredChain_dataOutputFileName" ),
322 m_option_filteredChain_dataOutputFileType (m_prefix +
"filteredChain_dataOutputFileType" ),
323 m_option_filteredChain_dataOutputAllowAll (m_prefix +
"filteredChain_dataOutputAllowAll" ),
324 m_option_filteredChain_dataOutputAllowedSet (m_prefix +
"filteredChain_dataOutputAllowedSet" ),
325 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
326 m_option_filteredChain_computeStats (m_prefix +
"filteredChain_computeStats" ),
328 m_option_displayCandidates (m_prefix +
"displayCandidates" ),
329 m_option_putOutOfBoundsInChain (m_prefix +
"putOutOfBoundsInChain" ),
330 m_option_tk_useLocalHessian (m_prefix +
"tk_useLocalHessian" ),
331 m_option_tk_useNewtonComponent (m_prefix +
"tk_useNewtonComponent" ),
332 m_option_dr_maxNumExtraStages (m_prefix +
"dr_maxNumExtraStages" ),
333 m_option_dr_listOfScalesForExtraStages (m_prefix +
"dr_listOfScalesForExtraStages" ),
334 m_option_dr_duringAmNonAdaptiveInt (m_prefix +
"dr_duringAmNonAdaptiveInt" ),
335 m_option_am_keepInitialMatrix (m_prefix +
"am_keepInitialMatrix" ),
336 m_option_am_initialNonAdaptInterval (m_prefix +
"am_initialNonAdaptInterval" ),
337 m_option_am_adaptInterval (m_prefix +
"am_adaptInterval" ),
338 m_option_am_adaptedMatrices_dataOutputPeriod (m_prefix +
"am_adaptedMatrices_dataOutputPeriod" ),
339 m_option_am_adaptedMatrices_dataOutputFileName (m_prefix +
"am_adaptedMatrices_dataOutputFileName" ),
340 m_option_am_adaptedMatrices_dataOutputFileType (m_prefix +
"am_adaptedMatrices_dataOutputFileType" ),
341 m_option_am_adaptedMatrices_dataOutputAllowAll (m_prefix +
"am_adaptedMatrices_dataOutputAllowAll" ),
342 m_option_am_adaptedMatrices_dataOutputAllowedSet (m_prefix +
"am_adaptedMatrices_dataOutputAllowedSet" ),
343 m_option_am_eta (m_prefix +
"am_eta" ),
344 m_option_am_epsilon (m_prefix +
"am_epsilon" ),
345 m_option_enableBrooksGelmanConvMonitor (m_prefix +
"enableBrooksGelmanConvMonitor" ),
346 m_option_BrooksGelmanLag (m_prefix +
"BrooksGelmanLag" ),
347 m_option_outputLogLikelihood (m_prefix +
"outputLogLikelihood" ),
348 m_option_outputLogTarget (m_prefix +
"outputLogTarget" ),
349 m_option_doLogitTransform (m_prefix +
"doLogitTransform" )
353 "MetropolisHastingsSGOptions::constructor(2)",
354 "this constructor is incompatible with the existence of an options input file");
359 <<
": after setting values of options with prefix '" <<
m_prefix
360 <<
"', state of object is:"
365 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
366 if (
m_ov.m_rawChainComputeStats) {
367 m_rawChainStatisticalOptionsObj =
new SequenceStatisticalOptions(
m_env,
m_prefix +
"rawChain_",
m_ov.m_alternativeRawSsOptionsValues);
368 m_rawChainStatOptsInstantiated =
true;
370 if (
m_ov.m_filteredChainComputeStats) {
371 m_filteredChainStatisticalOptionsObj =
new SequenceStatisticalOptions(
m_env,
m_prefix +
"filteredChain_",
m_ov.m_alternativeFilteredSsOptionsValues);
372 m_filteredChainStatOptsInstantiated =
true;
380 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
382 m_rawChainStatisticalOptionsObj (NULL),
383 m_rawChainStatOptsInstantiated (false),
384 m_filteredChainStatisticalOptionsObj (NULL),
385 m_filteredChainStatOptsInstantiated (false),
389 m_prefix (mlOptions.m_prefix),
390 m_env (mlOptions.env()),
391 m_optionsDesc (NULL),
392 m_option_help (m_prefix +
"help" ),
393 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
394 m_option_dataOutputAllowAll (m_prefix +
"dataOutputAllowAll" ),
395 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
396 m_option_totallyMute (m_prefix +
"totallyMute" ),
397 m_option_initialPosition_dataInputFileName (m_prefix +
"initialPosition_dataInputFileName" ),
398 m_option_initialPosition_dataInputFileType (m_prefix +
"initialPosition_dataInputFileType" ),
399 m_option_initialProposalCovMatrix_dataInputFileName(m_prefix +
"initialProposalCovMatrix_dataInputFileName"),
400 m_option_initialProposalCovMatrix_dataInputFileType(m_prefix +
"initialProposalCovMatrix_dataInputFileType"),
401 m_option_listOfDisabledParameters (m_prefix +
"listOfDisabledParameters" ),
402 m_option_rawChain_dataInputFileName (m_prefix +
"rawChain_dataInputFileName" ),
403 m_option_rawChain_dataInputFileType (m_prefix +
"rawChain_dataInputFileType" ),
404 m_option_rawChain_size (m_prefix +
"rawChain_size" ),
405 m_option_rawChain_generateExtra (m_prefix +
"rawChain_generateExtra" ),
406 m_option_rawChain_displayPeriod (m_prefix +
"rawChain_displayPeriod" ),
407 m_option_rawChain_measureRunTimes (m_prefix +
"rawChain_measureRunTimes" ),
408 m_option_rawChain_dataOutputPeriod (m_prefix +
"rawChain_dataOutputPeriod" ),
409 m_option_rawChain_dataOutputFileName (m_prefix +
"rawChain_dataOutputFileName" ),
410 m_option_rawChain_dataOutputFileType (m_prefix +
"rawChain_dataOutputFileType" ),
411 m_option_rawChain_dataOutputAllowAll (m_prefix +
"rawChain_dataOutputAllowAll" ),
412 m_option_rawChain_dataOutputAllowedSet (m_prefix +
"rawChain_dataOutputAllowedSet" ),
413 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
414 m_option_rawChain_computeStats (m_prefix +
"rawChain_computeStats" ),
416 m_option_filteredChain_generate (m_prefix +
"filteredChain_generate" ),
417 m_option_filteredChain_discardedPortion (m_prefix +
"filteredChain_discardedPortion" ),
418 m_option_filteredChain_lag (m_prefix +
"filteredChain_lag" ),
419 m_option_filteredChain_dataOutputFileName (m_prefix +
"filteredChain_dataOutputFileName" ),
420 m_option_filteredChain_dataOutputFileType (m_prefix +
"filteredChain_dataOutputFileType" ),
421 m_option_filteredChain_dataOutputAllowAll (m_prefix +
"filteredChain_dataOutputAllowAll" ),
422 m_option_filteredChain_dataOutputAllowedSet (m_prefix +
"filteredChain_dataOutputAllowedSet" ),
423 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
424 m_option_filteredChain_computeStats (m_prefix +
"filteredChain_computeStats" ),
426 m_option_displayCandidates (m_prefix +
"displayCandidates" ),
427 m_option_putOutOfBoundsInChain (m_prefix +
"putOutOfBoundsInChain" ),
428 m_option_tk_useLocalHessian (m_prefix +
"tk_useLocalHessian" ),
429 m_option_tk_useNewtonComponent (m_prefix +
"tk_useNewtonComponent" ),
430 m_option_dr_maxNumExtraStages (m_prefix +
"dr_maxNumExtraStages" ),
431 m_option_dr_listOfScalesForExtraStages (m_prefix +
"dr_listOfScalesForExtraStages" ),
432 m_option_dr_duringAmNonAdaptiveInt (m_prefix +
"dr_duringAmNonAdaptiveInt" ),
433 m_option_am_keepInitialMatrix (m_prefix +
"am_keepInitialMatrix" ),
434 m_option_am_initialNonAdaptInterval (m_prefix +
"am_initialNonAdaptInterval" ),
435 m_option_am_adaptInterval (m_prefix +
"am_adaptInterval" ),
436 m_option_am_adaptedMatrices_dataOutputPeriod (m_prefix +
"am_adaptedMatrices_dataOutputPeriod" ),
437 m_option_am_adaptedMatrices_dataOutputFileName (m_prefix +
"am_adaptedMatrices_dataOutputFileName" ),
438 m_option_am_adaptedMatrices_dataOutputFileType (m_prefix +
"am_adaptedMatrices_dataOutputFileType" ),
439 m_option_am_adaptedMatrices_dataOutputAllowAll (m_prefix +
"am_adaptedMatrices_dataOutputAllowAll" ),
440 m_option_am_adaptedMatrices_dataOutputAllowedSet (m_prefix +
"am_adaptedMatrices_dataOutputAllowedSet" ),
441 m_option_am_eta (m_prefix +
"am_eta" ),
442 m_option_am_epsilon (m_prefix +
"am_epsilon" ),
443 m_option_enableBrooksGelmanConvMonitor (m_prefix +
"enableBrooksGelmanConvMonitor" ),
444 m_option_BrooksGelmanLag (m_prefix +
"BrooksGelmanLag" ),
445 m_option_outputLogLikelihood (m_prefix +
"outputLogLikelihood" ),
446 m_option_outputLogTarget (m_prefix +
"outputLogTarget" ),
447 m_option_doLogitTransform (m_prefix +
"doLogitTransform" )
469 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
470 m_ov.m_rawChainComputeStats = mlOptions.m_rawChainComputeStats;
479 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
480 m_ov.m_filteredChainComputeStats = mlOptions.m_filteredChainComputeStats;
505 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
510 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
511 m_rawChainStatisticalOptionsObj = mlOptions.m_rawChainStatisticalOptionsObj;
512 m_rawChainStatOptsInstantiated =
false;
513 m_filteredChainStatisticalOptionsObj = mlOptions.m_filteredChainStatisticalOptionsObj;
514 m_filteredChainStatOptsInstantiated =
false;
519 <<
": after copying values of options with prefix '" <<
m_prefix
520 <<
"', state of object is:"
528 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
529 if (m_filteredChainStatOptsInstantiated)
delete m_filteredChainStatisticalOptionsObj;
530 if (m_rawChainStatOptsInstantiated )
delete m_rawChainStatisticalOptionsObj;
541 "MetropolisHastingsSGOptions::scanOptionsValues()",
542 "m_optionsDesc variable is NULL");
551 <<
": after reading values of options with prefix '" <<
m_prefix
552 <<
"', state of object is:"
557 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
558 if (
m_ov.m_rawChainComputeStats) {
559 m_rawChainStatisticalOptionsObj =
new SequenceStatisticalOptions(
m_env,
m_prefix +
"rawChain_");
560 m_rawChainStatOptsInstantiated =
true;
562 if (
m_ov.m_filteredChainComputeStats) {
563 m_filteredChainStatisticalOptionsObj =
new SequenceStatisticalOptions(
m_env,
m_prefix +
"filteredChain_");
564 m_filteredChainStatOptsInstantiated =
true;
604 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
605 <<
"\n" << m_option_rawChain_computeStats <<
" = " <<
m_ov.m_rawChainComputeStats
618 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
619 <<
"\n" << m_option_filteredChain_computeStats <<
" = " <<
m_ov.m_filteredChainComputeStats
658 optionsDesc.add_options()
659 (
m_option_help.c_str(),
"produce help msg for Bayesian Metropolis-Hastings" )
680 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
681 (m_option_rawChain_computeStats.c_str(), po::value<bool >()->default_value(UQ_MH_SG_RAW_CHAIN_COMPUTE_STATS_ODV ),
"compute statistics on raw chain" )
690 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
691 (m_option_filteredChain_computeStats.c_str(), po::value<bool >()->default_value(UQ_MH_SG_FILTERED_CHAIN_COMPUTE_STATS_ODV ),
"compute statistics on filtered chain" )
744 std::vector<double> tmpAllow(0,0.);
748 if (tmpAllow.size() > 0) {
749 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
777 std::vector<double> tmpAllow(0,0.);
780 if (tmpAllow.size() > 0) {
781 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
828 std::vector<double> tmpAllow(0,0.);
832 if (tmpAllow.size() > 0) {
833 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
839 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
841 m_ov.m_rawChainComputeStats = ((
const po::variable_value&)
m_env.
allOptionsMap()[m_option_rawChain_computeStats]).as<bool>();
861 std::cerr <<
"WARNING In MetropolisHastingsSG<P_V,P_M>::getMyOptionsValues()"
891 std::vector<double> tmpAllow(0,0.);
895 if (tmpAllow.size() > 0) {
896 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
902 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
904 m_ov.m_filteredChainComputeStats = ((
const po::variable_value&)
m_env.
allOptionsMap()[m_option_filteredChain_computeStats]).as<bool>();
927 std::vector<double> tmpScales(0,0.);
942 unsigned int tmpSize = tmpScales.size();
947 if (i < tmpSize) scale = tmpScales[i];
990 std::vector<double> tmpAllow(0,0.);
994 if (tmpAllow.size() > 0) {
995 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
#define UQ_MH_SG_AM_EPSILON_ODV
unsigned int m_rawChainDisplayPeriod
Period of message display during raw chain generation.
This class provides options for the Metropolis-Hastings generator of samples if no input file is avai...
std::string m_initialProposalCovMatrixDataInputFileType
Type of input file for initial proposal covariance matrix.
std::string m_initialPositionDataInputFileName
std::set< unsigned int > m_filteredChainDataOutputAllowedSet
subEnvs that will write to output file for filtered chain.
int subRank() const
Access function for sub-rank.
unsigned int m_rawChainSize
bool m_drDuringAmNonAdaptiveInt
std::string m_option_am_adaptedMatrices_dataOutputFileName
std::string m_option_initialPosition_dataInputFileName
std::string m_option_rawChain_dataOutputAllowedSet
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
std::string m_initialPositionDataInputFileType
Type of input file for initial position.
std::string m_option_dr_listOfScalesForExtraStages
std::string m_filteredChainDataOutputFileName
Name of output file for filtered chain.
std::string m_option_tk_useLocalHessian
#define UQ_MH_SG_DISPLAY_CANDIDATES_ODV
bool m_putOutOfBoundsInChain
This class provides options for each level of the Multilevel sequence generator if no input file is a...
#define UQ_MH_SG_TK_USE_LOCAL_HESSIAN_ODV
std::string m_option_initialProposalCovMatrix_dataInputFileType
#define UQ_MH_SG_AM_ETA_ODV
#define UQ_MH_SG_RAW_CHAIN_DISPLAY_PERIOD_ODV
std::string m_initialProposalCovMatrixDataInputFileType
unsigned int m_filteredChainLag
Set the lag for the filtered chain. Default is 1.
std::string m_rawChainDataOutputFileName
Name of output file for raw chain.
#define UQ_MH_SG_OUTPUT_LOG_LIKELIHOOD
std::string m_rawChainDataOutputFileType
Type of output file for raw chain.
double m_amEpsilon
'am' epsilon.
int inter0Rank() const
Returns the process inter0 rank.
std::string m_initialPositionDataInputFileName
Name of input file for initial position.
bool m_filteredChainGenerate
Toggle the option to save a filtered chain. Default is 0 (off).
std::string m_option_initialPosition_dataInputFileType
MhOptionsValues & operator=(const MhOptionsValues &rhs)
Assignment operator; it copies rhs to this.
std::string m_dataOutputFileName
Name of generic output file.
void print(std::ostream &os) const
It prints the option values.
int worldRank() const
Returns the process world rank.
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_FILE_TYPE_ODV
std::string m_option_BrooksGelmanLag
std::string m_option_filteredChain_generate
#define UQ_MH_SG_DR_LIST_OF_SCALES_FOR_EXTRA_STAGES_ODV
std::string m_option_totallyMute
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_ALLOW_ALL_ODV
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
std::string m_option_enableBrooksGelmanConvMonitor
bool m_doLogitTransform
Flag for deciding whether or not to do logit transform of bounded domains.
#define UQ_MH_SG_BROOKS_GELMAN_LAG
unsigned int m_BrooksGelmanLag
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
unsigned int m_drMaxNumExtraStages
'dr' maximum number of extra stages.
This class reads the options for the Metropolis-Hastings generator of samples from an input file...
double m_filteredChainDiscardedPortion
Initial discarded portion for chain filtering.
unsigned int m_drMaxNumExtraStages
unsigned int m_amAdaptedMatricesDataOutputPeriod
Period for outputing 'am' adapted matrices.
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_ALLOWED_SET_ODV
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_PERIOD_ODV
std::set< unsigned int > m_parameterDisabledSet
std::vector< double > m_drScalesForExtraStages
'dr' list of scales for proposal covariance matrices from 2nd stage on.
std::string m_amAdaptedMatricesDataOutputFileName
bool m_dataOutputAllowAll
subEnvs that will write to generic output file.
bool m_drDuringAmNonAdaptiveInt
Whether or not 'dr' is used during 'am' non adaptive interval.
MetropolisHastingsSGOptions(const BaseEnvironment &env, const char *prefix)
Constructor: reads options from the input file.
std::string m_option_rawChain_measureRunTimes
std::string m_option_filteredChain_dataOutputFileType
double m_amEta
Proposal covariance scaling factor, usually 2.4 * 2.4 / d.
unsigned int m_amAdaptInterval
'am' adaptation interval.
po::variables_map & allOptionsMap() const
std::string m_rawChainDataInputFileName
Name of input file for raw chain.
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_PERIOD_ODV
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_FILE_TYPE_ODV
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
std::vector< double > m_drScalesForExtraStages
std::string m_rawChainDataInputFileType
bool m_tkUseLocalHessian
Whether or not 'proposal' uses local Hessian.
std::string m_initialProposalCovMatrixDataInputFileName
~MetropolisHastingsSGOptions()
Destructor.
#define UQ_MH_SG_RAW_CHAIN_DATA_INPUT_FILE_NAME_ODV
std::string m_option_am_initialNonAdaptInterval
void defineMyOptions(po::options_description &optionsDesc) const
Defines the options for the Metropolis-Hastings generator of samples as the default options...
std::string m_option_filteredChain_dataOutputAllowAll
std::string m_option_am_adaptedMatrices_dataOutputFileType
std::string m_amAdaptedMatricesDataOutputFileType
Type of output file for 'am' adapted matrices.
bool m_tkUseNewtonComponent
Whether or not 'proposal' uses Newton component.
unsigned int m_rawChainDataOutputPeriod
#define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_ALLOW_ALL_ODV
#define UQ_MH_SG_FILTERED_CHAIN_DISCARDED_PORTION_ODV
std::string m_filteredChainDataOutputFileName
File name to save the filtered chain to. Default is ".".
#define UQ_MH_SG_DR_MAX_NUM_EXTRA_STAGES_ODV
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
std::string m_option_tk_useNewtonComponent
std::string m_option_rawChain_dataInputFileName
#define UQ_MH_SG_AM_ADAPT_INTERVAL_ODV
unsigned int m_rawChainDataOutputPeriod
Period of message display during raw chain generation.
unsigned int m_amAdaptInterval
#define UQ_MH_SG_INITIAL_PROPOSAL_COV_MATRIX_DATA_INPUT_FILE_NAME_ODV
std::string m_dataOutputFileName
unsigned int m_amInitialNonAdaptInterval
'am' initial non adaptation interval
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_ALLOW_ALL_ODV
#define UQ_MH_SG_DATA_OUTPUT_ALLOWED_SET_ODV
std::set< unsigned int > m_dataOutputAllowedSet
subEnvs that will write to generic output file.
std::string m_rawChainDataInputFileType
Type of input file for raw chain.
std::set< unsigned int > m_parameterDisabledSet
std::string m_option_am_adaptedMatrices_dataOutputAllowAll
std::string m_option_doLogitTransform
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
double m_amEta
'am' eta.
std::string m_option_dr_duringAmNonAdaptiveInt
bool m_rawChainDataOutputAllowAll
Whether or not subEnvs will write to output file for raw chain.
unsigned int m_rawChainDisplayPeriod
std::string m_option_initialProposalCovMatrix_dataInputFileName
#define UQ_MH_SG_AM_KEEP_INITIAL_MATRIX_ODV
#define UQ_MH_SG_INITIAL_POSITION_DATA_INPUT_FILE_NAME_ODV
std::string m_option_filteredChain_dataOutputFileName
bool m_doLogitTransform
Whether or not a logit transform will be done for bounded domains.
~MhOptionsValues()
Destructor.
#define UQ_MH_SG_TOTALLY_MUTE_ODV
#define UQ_MH_SG_INITIAL_PROPOSAL_COV_MATRIX_DATA_INPUT_FILE_TYPE_ODV
std::string m_option_dataOutputFileName
std::string m_option_rawChain_dataOutputPeriod
bool m_rawChainMeasureRunTimes
#define UQ_MH_SG_INITIAL_POSITION_DATA_INPUT_FILE_TYPE_ODV
std::string m_filteredChainDataOutputFileType
Type of output file for filtered chain.
std::string m_option_listOfDisabledParameters
unsigned int m_enableBrooksGelmanConvMonitor
std::string m_option_dataOutputAllowedSet
std::string m_option_rawChain_dataOutputAllowAll
po::options_description * m_optionsDesc
bool m_putOutOfBoundsInChain
Put 'out of bound' candidates in chain as well.
bool m_outputLogLikelihood
Flag for deciding whether or not to dump log likelihood values in output.
#define UQ_MH_SG_LIST_OF_DISABLED_PARAMETERS_ODV
#define UQ_MH_SG_PUT_OUT_OF_BOUNDS_IN_CHAIN_ODV
std::string m_option_am_adaptInterval
MhOptionsValues()
Default constructor.
#define UQ_MH_SG_DO_LOGIT_TRANSFORM
#define UQ_MH_SG_RAW_CHAIN_GENERATE_EXTRA_ODV
MhOptionsValues m_ov
This class is where the actual options are stored.
std::set< unsigned int > m_rawChainDataOutputAllowedSet
subEnvs that will write to output file for raw chain.
void getMyOptionValues(po::options_description &optionsDesc)
Gets the sequence options defined to the Metropolis-Hastings algorithm.
#define UQ_MH_SG_DR_DURING_AM_NON_ADAPTIVE_INT_ODV
std::string m_option_help
int fullRank() const
Returns the process full rank.
std::set< unsigned int > m_amAdaptedMatricesDataOutputAllowedSet
subEnvs that will write to output file for 'am' adapted matrices.
#define UQ_MH_SG_RAW_CHAIN_SIZE_ODV
std::string m_option_outputLogTarget
bool m_amKeepInitialMatrix
bool m_filteredChainGenerate
Whether or not to generate filtered chain.
std::string m_option_rawChain_dataOutputFileName
#define UQ_MH_SG_DATA_OUTPUT_FILE_NAME_ODV
std::string m_option_dataOutputAllowAll
std::string m_option_putOutOfBoundsInChain
bool m_rawChainGenerateExtra
Generate extra information about raw chain.
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_am_eta
See MhOptionsValues::m_amEta.
std::string m_option_rawChain_dataInputFileType
std::string m_option_rawChain_displayPeriod
std::string m_option_am_keepInitialMatrix
std::string m_option_am_adaptedMatrices_dataOutputPeriod
#define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_ALLOWED_SET_ODV
std::string m_initialProposalCovMatrixDataInputFileName
Name of input file for initial proposal covariance matrix.
bool m_amAdaptedMatricesDataOutputAllowAll
unsigned int m_amInitialNonAdaptInterval
bool m_tkUseNewtonComponent
bool m_rawChainMeasureRunTimes
Whether or not to measure run times.
double m_amEpsilon
Regularisation parameter for the DRAM covariance matrix.
std::string m_option_filteredChain_discardedPortion
bool m_displayCandidates
Display candidates generated in the core MH algorithm.
std::string m_option_rawChain_generateExtra
#define UQ_MH_SG_DATA_OUTPUT_ALLOW_ALL_ODV
std::string m_option_rawChain_dataOutputFileType
bool m_rawChainGenerateExtra
std::set< unsigned int > m_filteredChainDataOutputAllowedSet
std::string m_option_dr_maxNumExtraStages
std::set< unsigned int > m_rawChainDataOutputAllowedSet
#define UQ_MH_SG_ENABLE_BROOKS_GELMAN_CONV_MONITOR
std::string m_amAdaptedMatricesDataOutputFileName
Name of output file for 'am' adapted matrices.
#define UQ_MH_SG_RAW_CHAIN_DATA_INPUT_FILE_TYPE_ODV
bool m_totallyMute
Whether or not to be totally mute (no printout message).
#define UQ_MH_SG_FILTERED_CHAIN_GENERATE_ODV
#define UQ_MH_SG_RAW_CHAIN_DATA_OUTPUT_FILE_NAME_ODV
const BaseEnvironment & m_env
bool m_outputLogTarget
Flag for deciding whether or not to dump log target values in output.
unsigned int m_rawChainSize
Size of raw chain.
#define UQ_MH_SG_OUTPUT_LOG_TARGET
bool m_amAdaptedMatricesDataOutputAllowAll
Whether or not subEnvs will write to output file for 'am' adapted matrices.
unsigned int m_filteredChainLag
Spacing for chain filtering.
#define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_FILE_TYPE_ODV
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
std::string m_rawChainDataOutputFileName
void copy(const MhOptionsValues &src)
Copies the option values from src to this.
std::string m_option_outputLogLikelihood
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_ALLOWED_SET_ODV
#define UQ_MH_SG_FILTERED_CHAIN_DATA_OUTPUT_FILE_NAME_ODV
std::string m_initialPositionDataInputFileType
std::string m_filteredChainDataOutputFileType
#define UQ_MH_SG_AM_ADAPTED_MATRICES_DATA_OUTPUT_FILE_NAME_ODV
std::string m_rawChainDataInputFileName
#define UQ_MH_SG_RAW_CHAIN_MEASURE_RUN_TIMES_ODV
bool m_filteredChainDataOutputAllowAll
Whether or not subEnvs will write to output file for filtered chain.
unsigned int m_amAdaptedMatricesDataOutputPeriod
#define UQ_MH_SG_AM_INIT_NON_ADAPT_INT_ODV
std::string m_option_filteredChain_lag
std::string m_option_displayCandidates
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.
bool m_rawChainDataOutputAllowAll
std::string m_rawChainDataOutputFileType
std::string m_option_rawChain_size
std::string m_option_am_epsilon
See MhOptionsValues::m_amEpsilon.
std::string m_amAdaptedMatricesDataOutputFileType
#define UQ_MH_SG_TK_USE_NEWTON_COMPONENT_ODV
void scanInputFileForMyOptions(const po::options_description &optionsDesc) const
This method scans the input file provided by the user to QUESO.
bool m_amKeepInitialMatrix
Whether or not 'am' will keep initial (given) matrix.
std::set< unsigned int > m_amAdaptedMatricesDataOutputAllowedSet
std::string m_option_am_adaptedMatrices_dataOutputAllowedSet
std::string m_option_filteredChain_dataOutputAllowedSet
#define UQ_MH_SG_FILTERED_CHAIN_LAG_ODV
bool m_filteredChainDataOutputAllowAll
bool m_dataOutputAllowAll