queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::BaseOptimizer Class Referenceabstract

A base class for handling optimisation of scalar functions. More...

#include <Optimizer.h>

Inheritance diagram for QUESO::BaseOptimizer:
QUESO::GslOptimizer

Public Member Functions

 BaseOptimizer ()
 Default constructor. More...
 
 BaseOptimizer (OptimizerOptions options)
 Constructor that takes an options object. More...
 
virtual ~BaseOptimizer ()
 Destructor. More...
 
virtual void minimize (OptimizerMonitor *monitor)=0
 Minimize the objective function, starting at m_initialPoint. More...
 
unsigned int getMaxIterations () const
 Returns the maximum number of iterations the optimizer will do. More...
 
double getTolerance () const
 Returns the tolerance used to test for an extremum in the optimizer. More...
 
double getFiniteDifferenceStepSize () const
 Returns the step size used in the finite difference formula. More...
 
virtual std::string getSolverType () const
 Gets the algorithm to use for minimisation. More...
 
virtual double getFstepSize () const
 Gets the step size to use in gradient-free solvers. More...
 
virtual double getFdfstepSize () const
 Gets the step to use in gradient-based solvers. More...
 
virtual double getLineTolerance () const
 Gets the tolerance to use for line minimisation. More...
 
void setMaxIterations (unsigned int maxIterations)
 Sets the maximum number of iterations to be used by the optimizer. More...
 
void setTolerance (double tolerance)
 Sets the tolerance the optimizer will use to test for an extremum. More...
 
void setFiniteDifferenceStepSize (double h)
 Sets the step to use in the finite difference derivative. More...
 
virtual void setSolverType (std::string solverType)
 Sets the algorithm to use for minimisation. More...
 
virtual void setFstepSize (double fstepSize)
 Sets the step size to use in gradient-free solvers. More...
 
virtual void setFdfstepSize (double fdfstepSize)
 Sets the step to use in gradient-based solvers. More...
 
virtual void setLineTolerance (double lineTolerance)
 Sets the tolerance to use for line minimisation. More...
 

Protected Attributes

unsigned int m_maxIterations
 
double m_tolerance
 
double m_finiteDifferenceStepSize
 
std::string m_solverType
 
double m_fstepSize
 
double m_fdfstepSize
 
double m_lineTolerance
 
ScopedPtr< OptimizerOptions >::Type m_optionsObj
 

Detailed Description

A base class for handling optimisation of scalar functions.

This class defines the interface every optimizer must adhere to. All optimizers should subclass this class.

Definition at line 47 of file Optimizer.h.

Constructor & Destructor Documentation

QUESO::BaseOptimizer::BaseOptimizer ( )

Default constructor.

Definition at line 29 of file Optimizer.C.

References m_optionsObj.

30  : m_maxIterations(UQ_OPT_MAX_ITERATIONS),
31  m_tolerance(UQ_OPT_TOLERANCE),
32  m_finiteDifferenceStepSize(UQ_OPT_FINITE_DIFFERENCE_STEP_SIZE),
33  m_solverType(UQ_OPT_SOLVER_TYPE),
34  m_fstepSize(UQ_OPT_FSTEP_SIZE),
35  m_fdfstepSize(UQ_OPT_FDFSTEP_SIZE),
36  m_lineTolerance(UQ_OPT_LINE_TOLERANCE)
37 {
38  m_optionsObj.reset(new OptimizerOptions);
39 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
std::string m_solverType
Definition: Optimizer.h:120
unsigned int m_maxIterations
Definition: Optimizer.h:117
double m_finiteDifferenceStepSize
Definition: Optimizer.h:119
QUESO::BaseOptimizer::BaseOptimizer ( OptimizerOptions  options)

Constructor that takes an options object.

Definition at line 41 of file Optimizer.C.

References m_optionsObj.

42 {
43  m_optionsObj.reset(new OptimizerOptions(options));
44 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
QUESO::BaseOptimizer::~BaseOptimizer ( )
virtual

Destructor.

Definition at line 46 of file Optimizer.C.

47 {
48 }

Member Function Documentation

double QUESO::BaseOptimizer::getFdfstepSize ( ) const
virtual

Gets the step to use in gradient-based solvers.

Reimplemented in QUESO::GslOptimizer.

Definition at line 81 of file Optimizer.C.

References m_optionsObj.

82 {
83  return this->m_optionsObj->m_fdfstepSize;
84 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
double QUESO::BaseOptimizer::getFiniteDifferenceStepSize ( ) const

Returns the step size used in the finite difference formula.

Default value is 1e-4

Definition at line 63 of file Optimizer.C.

References m_optionsObj.

Referenced by QUESO::c_evaluate_derivative().

64 {
65  return this->m_optionsObj->m_finiteDifferenceStepSize;
66 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
double QUESO::BaseOptimizer::getFstepSize ( ) const
virtual

Gets the step size to use in gradient-free solvers.

Reimplemented in QUESO::GslOptimizer.

Definition at line 75 of file Optimizer.C.

References m_optionsObj.

76 {
77  return this->m_optionsObj->m_fstepSize;
78 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
double QUESO::BaseOptimizer::getLineTolerance ( ) const
virtual

Gets the tolerance to use for line minimisation.

Reimplemented in QUESO::GslOptimizer.

Definition at line 87 of file Optimizer.C.

References m_optionsObj.

88 {
89  return this->m_optionsObj->m_lineTolerance;
90 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
unsigned int QUESO::BaseOptimizer::getMaxIterations ( ) const

Returns the maximum number of iterations the optimizer will do.

Default value is 100

Definition at line 51 of file Optimizer.C.

References m_optionsObj.

Referenced by QUESO::GslOptimizer::minimize_no_gradient(), and QUESO::GslOptimizer::minimize_with_gradient().

52 {
53  return this->m_optionsObj->m_maxIterations;
54 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
std::string QUESO::BaseOptimizer::getSolverType ( ) const
virtual

Gets the algorithm to use for minimisation.

Reimplemented in QUESO::GslOptimizer.

Definition at line 69 of file Optimizer.C.

References m_optionsObj.

70 {
71  return this->m_optionsObj->m_solverType;
72 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
double QUESO::BaseOptimizer::getTolerance ( ) const

Returns the tolerance used to test for an extremum in the optimizer.

Default value is 1e-3

Definition at line 57 of file Optimizer.C.

References m_optionsObj.

Referenced by QUESO::GslOptimizer::minimize_no_gradient().

58 {
59  return this->m_optionsObj->m_tolerance;
60 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
virtual void QUESO::BaseOptimizer::minimize ( OptimizerMonitor monitor)
pure virtual

Minimize the objective function, starting at m_initialPoint.

m_initialPoint is handled in the derived class

Implemented in QUESO::GslOptimizer.

void QUESO::BaseOptimizer::setFdfstepSize ( double  fdfstepSize)
virtual

Sets the step to use in gradient-based solvers.

Reimplemented in QUESO::GslOptimizer.

Definition at line 123 of file Optimizer.C.

References m_optionsObj.

124 {
125  this->m_optionsObj->m_fdfstepSize = fdfstepSize;
126 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
void QUESO::BaseOptimizer::setFiniteDifferenceStepSize ( double  h)

Sets the step to use in the finite difference derivative.

Definition at line 105 of file Optimizer.C.

References m_optionsObj.

106 {
107  this->m_optionsObj->m_finiteDifferenceStepSize = h;
108 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
void QUESO::BaseOptimizer::setFstepSize ( double  fstepSize)
virtual

Sets the step size to use in gradient-free solvers.

Reimplemented in QUESO::GslOptimizer.

Definition at line 117 of file Optimizer.C.

References m_optionsObj.

118 {
119  this->m_optionsObj->m_fstepSize = fstepSize;
120 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
void QUESO::BaseOptimizer::setLineTolerance ( double  lineTolerance)
virtual

Sets the tolerance to use for line minimisation.

Reimplemented in QUESO::GslOptimizer.

Definition at line 129 of file Optimizer.C.

References m_optionsObj.

130 {
131  this->m_optionsObj->m_lineTolerance = lineTolerance;
132 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
void QUESO::BaseOptimizer::setMaxIterations ( unsigned int  maxIterations)

Sets the maximum number of iterations to be used by the optimizer.

Definition at line 93 of file Optimizer.C.

References m_optionsObj.

94 {
95  this->m_optionsObj->m_maxIterations = maxIterations;
96 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
void QUESO::BaseOptimizer::setSolverType ( std::string  solverType)
virtual

Sets the algorithm to use for minimisation.

Reimplemented in QUESO::GslOptimizer.

Definition at line 111 of file Optimizer.C.

References m_optionsObj.

112 {
113  this->m_optionsObj->m_solverType = solverType;
114 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
void QUESO::BaseOptimizer::setTolerance ( double  tolerance)

Sets the tolerance the optimizer will use to test for an extremum.

Definition at line 99 of file Optimizer.C.

References m_optionsObj.

100 {
101  this->m_optionsObj->m_tolerance = tolerance;
102 }
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126

Member Data Documentation

double QUESO::BaseOptimizer::m_fdfstepSize
protected

Definition at line 122 of file Optimizer.h.

double QUESO::BaseOptimizer::m_finiteDifferenceStepSize
protected

Definition at line 119 of file Optimizer.h.

double QUESO::BaseOptimizer::m_fstepSize
protected

Definition at line 121 of file Optimizer.h.

double QUESO::BaseOptimizer::m_lineTolerance
protected

Definition at line 123 of file Optimizer.h.

unsigned int QUESO::BaseOptimizer::m_maxIterations
protected

Definition at line 117 of file Optimizer.h.

std::string QUESO::BaseOptimizer::m_solverType
protected

Definition at line 120 of file Optimizer.h.

double QUESO::BaseOptimizer::m_tolerance
protected

Definition at line 118 of file Optimizer.h.


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

Generated on Tue Jun 5 2018 19:49:11 for queso-0.57.1 by  doxygen 1.8.5