queso-0.53.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
QUESO::InfiniteDimensionalMCMCSamplerOptions Class Reference

This class defines the options that specify the behaviour of the MCMC sampler. More...

#include <InfiniteDimensionalMCMCSamplerOptions.h>

Collaboration diagram for QUESO::InfiniteDimensionalMCMCSamplerOptions:
Collaboration graph
[legend]

Public Member Functions

 InfiniteDimensionalMCMCSamplerOptions (const BaseEnvironment &env, const char *prefix)
 Given prefix, read the input file for parameters named prefix_*. More...
 
virtual ~InfiniteDimensionalMCMCSamplerOptions ()
 Destructor. More...
 
void print (std::ostream &os) const
 Prints this to os. More...
 
const BaseEnvironmentenv () const
 Returns the QUESO environment. More...
 

Public Attributes

std::string m_prefix
 The prefix to look for in the input file. More...
 
std::string m_dataOutputDirName
 Name of the output dir to save infinite dimensional output files to. More...
 
std::string m_dataOutputFileName
 Name of the HDF5 output file to store chain statistics. More...
 
unsigned int m_num_iters
 The total number of iterations to do. More...
 
unsigned int m_save_freq
 The frequency at which to save the state of the chain. More...
 
double m_rwmh_step
 The proposal step size. More...
 

Private Member Functions

void checkOptions ()
 

Private Attributes

BoostInputOptionsParserm_parser
 
const BaseEnvironmentm_env
 
std::string m_option_help
 
std::string m_option_dataOutputDirName
 
std::string m_option_dataOutputFileName
 
std::string m_option_num_iters
 
std::string m_option_save_freq
 
std::string m_option_rwmh_step
 

Friends

std::ostream & operator<< (std::ostream &os, const InfiniteDimensionalMCMCSamplerOptions &opts)
 

Detailed Description

This class defines the options that specify the behaviour of the MCMC sampler.

Definition at line 40 of file InfiniteDimensionalMCMCSamplerOptions.h.

Constructor & Destructor Documentation

QUESO::InfiniteDimensionalMCMCSamplerOptions::InfiniteDimensionalMCMCSamplerOptions ( const BaseEnvironment env,
const char *  prefix 
)

Given prefix, read the input file for parameters named prefix_*.

Definition at line 37 of file InfiniteDimensionalMCMCSamplerOptions.C.

References checkOptions(), QUESO::BoostInputOptionsParser::getOption(), m_dataOutputDirName, m_dataOutputFileName, m_env, m_num_iters, m_option_dataOutputDirName, m_option_dataOutputFileName, m_option_help, m_option_num_iters, m_option_rwmh_step, m_option_save_freq, m_parser, m_rwmh_step, m_save_freq, QUESO::BaseEnvironment::optionsInputFileName(), queso_require_not_equal_to_msg, QUESO::BoostInputOptionsParser::registerOption(), QUESO::BoostInputOptionsParser::scanInputFile(), UQ_INF_DATA_OUTPUT_DIR_NAME_ODV, UQ_INF_DATA_OUTPUT_FILE_NAME_ODV, UQ_INF_NUM_ITERS_ODV, UQ_INF_RWMH_STEP_ODV, and UQ_INF_SAVE_FREQ_ODV.

40  : m_prefix((std::string)(prefix) + "infmcmc_"),
46  m_parser(new BoostInputOptionsParser(env.optionsInputFileName())),
47  m_env(env),
48  m_option_help(m_prefix + "help"),
49  m_option_dataOutputDirName(m_prefix + "dataOutputDirName"),
50  m_option_dataOutputFileName(m_prefix + "dataOutputFileName"),
51  m_option_num_iters(m_prefix + "num_iters"),
52  m_option_save_freq(m_prefix + "save_freq"),
53  m_option_rwmh_step(m_prefix + "rwmh_step")
54 {
55  queso_require_not_equal_to_msg(m_env.optionsInputFileName(), "", "this constructor is incompatible with the abscense of an options input file");
56 
57  m_parser->registerOption(m_option_help, "produce help message for infinite dimensional sampler");
58  m_parser->registerOption<std::string>(m_option_dataOutputDirName, UQ_INF_DATA_OUTPUT_DIR_NAME_ODV, "name of data output dir");
59  m_parser->registerOption<std::string>(m_option_dataOutputFileName, UQ_INF_DATA_OUTPUT_FILE_NAME_ODV, "name of data output file (HDF5)");
60  m_parser->registerOption<unsigned int>(m_option_num_iters, UQ_INF_NUM_ITERS_ODV, "number of mcmc iterations to do");
61  m_parser->registerOption<unsigned int>(m_option_save_freq, UQ_INF_SAVE_FREQ_ODV, "the frequency at which to save the chain state");
62  m_parser->registerOption<double >(m_option_rwmh_step, UQ_INF_RWMH_STEP_ODV, "the step-size in the random-walk Metropolis proposal");;
63 
65 
71 
72  checkOptions();
73 }
#define UQ_INF_DATA_OUTPUT_DIR_NAME_ODV
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:86
#define UQ_INF_DATA_OUTPUT_FILE_NAME_ODV
std::string m_dataOutputDirName
Name of the output dir to save infinite dimensional output files to.
std::string m_prefix
The prefix to look for in the input file.
std::string m_dataOutputFileName
Name of the HDF5 output file to store chain statistics.
const BaseEnvironment & env() const
Returns the QUESO environment.
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
Definition: Environment.C:307
void scanInputFile()
This is the method that parses the input file.
void registerOption(std::string name, T defaultValue, std::string description)
Call this to register an option with the parser.
unsigned int m_save_freq
The frequency at which to save the state of the chain.
void getOption(std::string &name, T &value)
Get option name from the parser and set value to the parsed value.
unsigned int m_num_iters
The total number of iterations to do.
QUESO::InfiniteDimensionalMCMCSamplerOptions::~InfiniteDimensionalMCMCSamplerOptions ( )
virtual

Destructor.

Definition at line 82 of file InfiniteDimensionalMCMCSamplerOptions.C.

83 {
84 }

Member Function Documentation

void QUESO::InfiniteDimensionalMCMCSamplerOptions::checkOptions ( )
private

Definition at line 76 of file InfiniteDimensionalMCMCSamplerOptions.C.

References m_num_iters, m_rwmh_step, m_save_freq, queso_require_equal_to_msg, and queso_require_greater_msg.

Referenced by InfiniteDimensionalMCMCSamplerOptions().

77 {
78  queso_require_equal_to_msg(m_num_iters % m_save_freq, 0, "save frequency must divide number of iterations");
79  queso_require_greater_msg(m_rwmh_step, 0, "random-walk Metropolis step size must be positive");
80 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
unsigned int m_save_freq
The frequency at which to save the state of the chain.
#define queso_require_greater_msg(expr1, expr2, msg)
Definition: asserts.h:88
unsigned int m_num_iters
The total number of iterations to do.
const BaseEnvironment & QUESO::InfiniteDimensionalMCMCSamplerOptions::env ( ) const

Returns the QUESO environment.

Definition at line 106 of file InfiniteDimensionalMCMCSamplerOptions.C.

References m_env.

107 {
108  return this->m_env;
109 }
void QUESO::InfiniteDimensionalMCMCSamplerOptions::print ( std::ostream &  os) const

Prints this to os.

Definition at line 86 of file InfiniteDimensionalMCMCSamplerOptions.C.

References m_dataOutputDirName, m_dataOutputFileName, m_num_iters, m_option_dataOutputDirName, m_option_dataOutputFileName, m_option_num_iters, m_option_rwmh_step, m_option_save_freq, m_rwmh_step, and m_save_freq.

Referenced by QUESO::operator<<().

87 {
88  os << "\n" << this->m_option_dataOutputDirName << " = " << this->m_dataOutputDirName;
89  os << "\n" << this->m_option_dataOutputFileName << " = " << this->m_dataOutputFileName;
90  os << "\n" << this->m_option_num_iters << " = " << this->m_num_iters;
91  os << "\n" << this->m_option_save_freq << " = " << this->m_save_freq;
92  os << "\n" << this->m_option_rwmh_step << " = " << this->m_rwmh_step;
93  os << std::endl;
94  return;
95 }
std::string m_dataOutputDirName
Name of the output dir to save infinite dimensional output files to.
std::string m_dataOutputFileName
Name of the HDF5 output file to store chain statistics.
unsigned int m_save_freq
The frequency at which to save the state of the chain.
unsigned int m_num_iters
The total number of iterations to do.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const InfiniteDimensionalMCMCSamplerOptions opts 
)
friend

Definition at line 97 of file InfiniteDimensionalMCMCSamplerOptions.C.

99 {
100  os << (*(obj.m_parser)) << std::endl;
101  obj.print(os);
102  return os;
103 }

Member Data Documentation

std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_dataOutputDirName

Name of the output dir to save infinite dimensional output files to.

For example, if m_dataOutputDirName is set to 'outputData/chain' then a series of folders will be created, one for each QUESO subenvironment, called 'outputData/chain0', 'outputData/chain1', etc. Inside these folders, output data from the infinite dimensional chain will be saved as an HDF5 file.

Definition at line 63 of file InfiniteDimensionalMCMCSamplerOptions.h.

Referenced by InfiniteDimensionalMCMCSamplerOptions(), and print().

std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_dataOutputFileName

Name of the HDF5 output file to store chain statistics.

Definition at line 66 of file InfiniteDimensionalMCMCSamplerOptions.h.

Referenced by InfiniteDimensionalMCMCSamplerOptions(), and print().

const BaseEnvironment& QUESO::InfiniteDimensionalMCMCSamplerOptions::m_env
private
unsigned int QUESO::InfiniteDimensionalMCMCSamplerOptions::m_num_iters

The total number of iterations to do.

Definition at line 69 of file InfiniteDimensionalMCMCSamplerOptions.h.

Referenced by checkOptions(), InfiniteDimensionalMCMCSamplerOptions(), and print().

std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_option_dataOutputDirName
private
std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_option_dataOutputFileName
private
std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_option_help
private
std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_option_num_iters
private
std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_option_rwmh_step
private
std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_option_save_freq
private
BoostInputOptionsParser* QUESO::InfiniteDimensionalMCMCSamplerOptions::m_parser
private
std::string QUESO::InfiniteDimensionalMCMCSamplerOptions::m_prefix

The prefix to look for in the input file.

Definition at line 53 of file InfiniteDimensionalMCMCSamplerOptions.h.

double QUESO::InfiniteDimensionalMCMCSamplerOptions::m_rwmh_step

The proposal step size.

Definition at line 75 of file InfiniteDimensionalMCMCSamplerOptions.h.

Referenced by checkOptions(), InfiniteDimensionalMCMCSamplerOptions(), and print().

unsigned int QUESO::InfiniteDimensionalMCMCSamplerOptions::m_save_freq

The frequency at which to save the state of the chain.

Definition at line 72 of file InfiniteDimensionalMCMCSamplerOptions.h.

Referenced by checkOptions(), InfiniteDimensionalMCMCSamplerOptions(), and print().


The documentation for this class was generated from the following files:

Generated on Thu Jun 11 2015 13:52:34 for queso-0.53.0 by  doxygen 1.8.5