queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Optimizer.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2017 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_BASE_OPTIMIZER_H
26 #define UQ_BASE_OPTIMIZER_H
27 
28 #include <queso/ScopedPtr.h>
29 #include <queso/OptimizerOptions.h>
30 
31 namespace QUESO {
32 
44 class Vector;
45 class OptimizerMonitor;
46 
48 public:
50  BaseOptimizer();
51 
54 
56  virtual ~BaseOptimizer();
57 
59 
62  virtual void minimize(OptimizerMonitor* monitor) = 0;
63 
65 
68  unsigned int getMaxIterations() const;
69 
71 
74  double getTolerance() const;
75 
77 
80  double getFiniteDifferenceStepSize() const;
81 
83  virtual std::string getSolverType() const;
84 
86  virtual double getFstepSize() const;
87 
89  virtual double getFdfstepSize() const;
90 
92  virtual double getLineTolerance() const;
93 
95  void setMaxIterations(unsigned int maxIterations);
96 
98  void setTolerance(double tolerance);
99 
101  void setFiniteDifferenceStepSize(double h);
102 
104  virtual void setSolverType(std::string solverType);
105 
107  virtual void setFstepSize(double fstepSize);
108 
110  virtual void setFdfstepSize(double fdfstepSize);
111 
113  virtual void setLineTolerance(double lineTolerance);
114 
115 protected:
116 
117  unsigned int m_maxIterations;
118  double m_tolerance;
120  std::string m_solverType;
121  double m_fstepSize;
124 
125  // This is protected so that derived classes (optimizers) can access options
127 };
128 
129 } // End namespace QUESO
130 
131 #endif // UQ_BASE_OPTIMIZER_H
void setMaxIterations(unsigned int maxIterations)
Sets the maximum number of iterations to be used by the optimizer.
Definition: Optimizer.C:93
std::unique_ptr< T > Type
Definition: ScopedPtr.h:76
virtual void setLineTolerance(double lineTolerance)
Sets the tolerance to use for line minimisation.
Definition: Optimizer.C:129
virtual void setSolverType(std::string solverType)
Sets the algorithm to use for minimisation.
Definition: Optimizer.C:111
virtual std::string getSolverType() const
Gets the algorithm to use for minimisation.
Definition: Optimizer.C:69
virtual ~BaseOptimizer()
Destructor.
Definition: Optimizer.C:46
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
double getTolerance() const
Returns the tolerance used to test for an extremum in the optimizer.
Definition: Optimizer.C:57
A base class for handling optimisation of scalar functions.
Definition: Optimizer.h:47
virtual void setFstepSize(double fstepSize)
Sets the step size to use in gradient-free solvers.
Definition: Optimizer.C:117
double getFiniteDifferenceStepSize() const
Returns the step size used in the finite difference formula.
Definition: Optimizer.C:63
virtual void setFdfstepSize(double fdfstepSize)
Sets the step to use in gradient-based solvers.
Definition: Optimizer.C:123
std::string m_solverType
Definition: Optimizer.h:120
virtual void minimize(OptimizerMonitor *monitor)=0
Minimize the objective function, starting at m_initialPoint.
virtual double getFdfstepSize() const
Gets the step to use in gradient-based solvers.
Definition: Optimizer.C:81
This class provides options for a Optimizer.
unsigned int m_maxIterations
Definition: Optimizer.h:117
void setFiniteDifferenceStepSize(double h)
Sets the step to use in the finite difference derivative.
Definition: Optimizer.C:105
void setTolerance(double tolerance)
Sets the tolerance the optimizer will use to test for an extremum.
Definition: Optimizer.C:99
virtual double getFstepSize() const
Gets the step size to use in gradient-free solvers.
Definition: Optimizer.C:75
BaseOptimizer()
Default constructor.
Definition: Optimizer.C:29
Object to monitor convergence of optimizers.
double m_finiteDifferenceStepSize
Definition: Optimizer.h:119
unsigned int getMaxIterations() const
Returns the maximum number of iterations the optimizer will do.
Definition: Optimizer.C:51
virtual double getLineTolerance() const
Gets the tolerance to use for line minimisation.
Definition: Optimizer.C:87

Generated on Tue Jun 5 2018 19:48:54 for queso-0.57.1 by  doxygen 1.8.5