25 #include <queso/Defines.h>
26 #include <queso/Environment.h>
27 #include <queso/BoostInputOptionsParser.h>
28 #include <queso/OptimizerOptions.h>
43 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
46 m_option_help(m_prefix +
"help"),
47 m_option_maxIterations(m_prefix +
"maxIterations"),
48 m_option_tolerance(m_prefix +
"tolerance"),
49 m_option_finiteDifferenceStepSize(m_prefix +
"finiteDifferenceStepSize"),
50 m_option_solverType(m_prefix +
"solverType"),
51 m_option_fstepSize(m_prefix +
"fstepSize"),
52 m_option_fdfstepSize(m_prefix +
"fdfStepSize"),
53 m_option_lineTolerance(m_prefix +
"lineTolerance")
59 : m_prefix((std::string)(prefix) +
"optimizer_"),
69 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
72 m_option_help(m_prefix +
"help"),
73 m_option_maxIterations(m_prefix +
"maxIterations"),
74 m_option_tolerance(m_prefix +
"tolerance"),
75 m_option_finiteDifferenceStepSize(m_prefix +
"finiteDifferenceStepSize"),
76 m_option_solverType(m_prefix +
"solverType"),
77 m_option_fstepSize(m_prefix +
"fstepSize"),
78 m_option_fdfstepSize(m_prefix +
"fdfStepSize"),
79 m_option_lineTolerance(m_prefix +
"lineTolerance")
81 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
83 "produce help message for statistical inverse problem");
87 "max number of optimizer iterations to do");
89 "optimize until gradient is less than tolerance");
92 "if no deriv is given, do finite difference with this step size");
94 "which optimisation algorithm to use");
96 "sets the step size used in gradient-free solvers");
98 "sets the step size used in gradient-based solvers");
100 "sets the line minimisation tolerance");
122 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
129 m_prefix(rhs.m_prefix),
131 m_maxIterations(rhs.m_maxIterations),
132 m_tolerance(rhs.m_tolerance),
133 m_finiteDifferenceStepSize(rhs.m_finiteDifferenceStepSize),
134 m_solverType(rhs.m_solverType),
135 m_fstepSize(rhs.m_fstepSize),
136 m_fdfstepSize(rhs.m_fdfstepSize),
137 m_lineTolerance(rhs.m_lineTolerance),
138 m_parser(rhs.m_parser),
139 m_option_help(rhs.m_option_help),
140 m_option_maxIterations(rhs.m_option_maxIterations),
141 m_option_tolerance(rhs.m_option_tolerance),
142 m_option_finiteDifferenceStepSize(rhs.m_option_finiteDifferenceStepSize),
143 m_option_solverType(rhs.m_option_solverType),
144 m_option_fstepSize(rhs.m_option_fstepSize),
145 m_option_fdfstepSize(rhs.m_option_fdfstepSize),
146 m_option_lineTolerance(rhs.m_option_lineTolerance)
std::string m_solverType
The optimization algorithm to use. Default is bfgs2.
double m_tolerance
The tolerance at which optimization stops. Default is 1e-3.
#define UQ_OPT_FINITE_DIFFERENCE_STEP_SIZE
const GetPot & input() const
The GetPot input file parser.
std::string m_option_tolerance
Option name for OptimizerOptions::m_tolerance. Default is m_prefix + "optimizer_tolerance".
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
double m_fdfstepSize
The size of the first step when optimizing with gradients. Default is 1.0.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
unsigned int m_maxIterations
The maximum number of iterations to do for optimization. Default is 100.
BoostInputOptionsParser * m_parser
void getOption(std::string &name, T &value)
Get option name from the parser and set value to the parsed value.
#define UQ_OPT_LINE_TOLERANCE
OptimizerOptions()
Default constructor. All options have their default values.
std::string m_option_finiteDifferenceStepSize
Option name for OptimizerOptions::m_finiteDifferenceStepSize. Default is m_prefix + "optimizer_finite...
std::string m_option_lineTolerance
Option name for OptimizerOptions::m_lineTolerance. Default is m_prefix + "optimizer_lineTolerance".
std::string m_option_fdfstepSize
Option name for OptimizerOptions::m_fdfstepSize. Default is m_prefix + "optimizer_fdfStepSize".
This class provides options for a Optimizer.
#define UQ_OPT_MAX_ITERATIONS
std::string m_option_maxIterations
Option name for OptimizerOptions::m_maxIterations. Default is m_prefix + "optimizer_maxIterations".
void scanInputFile()
This is the method that parses the input file.
double m_lineTolerance
Accuracy to which to solve line minization to. Default is 0.1.
const BaseEnvironment * m_env
#define queso_require_greater_msg(expr1, expr2, msg)
virtual ~OptimizerOptions()
Destructor.
#define UQ_OPT_FDFSTEP_SIZE
void registerOption(std::string name, T defaultValue, std::string description)
Call this to register an option with the parser.
std::string m_option_help
double m_finiteDifferenceStepSize
The step size used to compute gradients from finite differencing. Default is 1e-4.
#define UQ_OPT_SOLVER_TYPE
double m_fstepSize
The size of the initial trial steps for optimizing without gradients. Default is 0.1.
std::string m_help
If this string is non-empty, options are print to the output file.
#define UQ_OPT_FSTEP_SIZE
std::string m_option_fstepSize
Option name for OptimizerOptions::m_fstepSize. Default is m_prefix + "optimizer_fstepSize".
std::string m_option_solverType
Option name for OptimizerOptions::m_solverType. Default is m_prefix + "optimizer_solverType".