queso-0.56.0
Optimizer.C
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-2015 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 #include <queso/Optimizer.h>
26 
27 namespace QUESO {
28 
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 }
40 
42 {
43  m_optionsObj.reset(new OptimizerOptions(options));
44 }
45 
47 {
48 }
49 
50 unsigned int
52 {
53  return this->m_optionsObj->m_maxIterations;
54 }
55 
56 double
58 {
59  return this->m_optionsObj->m_tolerance;
60 }
61 
62 double
64 {
65  return this->m_optionsObj->m_finiteDifferenceStepSize;
66 }
67 
68 std::string
70 {
71  return this->m_optionsObj->m_solverType;
72 }
73 
74 double
76 {
77  return this->m_optionsObj->m_fstepSize;
78 }
79 
80 double
82 {
83  return this->m_optionsObj->m_fdfstepSize;
84 }
85 
86 double
88 {
89  return this->m_optionsObj->m_lineTolerance;
90 }
91 
92 void
93 BaseOptimizer::setMaxIterations(unsigned int maxIterations)
94 {
95  this->m_optionsObj->m_maxIterations = maxIterations;
96 }
97 
98 void
99 BaseOptimizer::setTolerance(double tolerance)
100 {
101  this->m_optionsObj->m_tolerance = tolerance;
102 }
103 
104 void
106 {
107  this->m_optionsObj->m_finiteDifferenceStepSize = h;
108 }
109 
110 void
111 BaseOptimizer::setSolverType(std::string solverType)
112 {
113  this->m_optionsObj->m_solverType = solverType;
114 }
115 
116 void
118 {
119  this->m_optionsObj->m_fstepSize = fstepSize;
120 }
121 
122 void
123 BaseOptimizer::setFdfstepSize(double fdfstepSize)
124 {
125  this->m_optionsObj->m_fdfstepSize = fdfstepSize;
126 }
127 
128 void
129 BaseOptimizer::setLineTolerance(double lineTolerance)
130 {
131  this->m_optionsObj->m_lineTolerance = lineTolerance;
132 }
133 
134 } // End namespace QUESO
BaseOptimizer()
Default constructor.
Definition: Optimizer.C:29
void setMaxIterations(unsigned int maxIterations)
Sets the maximum number of iterations to be used by the optimizer.
Definition: Optimizer.C:93
#define UQ_OPT_TOLERANCE
#define UQ_OPT_FINITE_DIFFERENCE_STEP_SIZE
virtual double getFdfstepSize() const
Gets the step to use in gradient-based solvers.
Definition: Optimizer.C:81
void setTolerance(double tolerance)
Sets the tolerance the optimizer will use to test for an extremum.
Definition: Optimizer.C:99
virtual double getLineTolerance() const
Gets the tolerance to use for line minimisation.
Definition: Optimizer.C:87
virtual std::string getSolverType() const
Gets the algorithm to use for minimisation.
Definition: Optimizer.C:69
#define UQ_OPT_LINE_TOLERANCE
ScopedPtr< OptimizerOptions >::Type m_optionsObj
Definition: Optimizer.h:126
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
This class provides options for a Optimizer.
#define UQ_OPT_MAX_ITERATIONS
void setFiniteDifferenceStepSize(double h)
Sets the step to use in the finite difference derivative.
Definition: Optimizer.C:105
virtual double getFstepSize() const
Gets the step size to use in gradient-free solvers.
Definition: Optimizer.C:75
double getTolerance() const
Returns the tolerance used to test for an extremum in the optimizer.
Definition: Optimizer.C:57
virtual void setFdfstepSize(double fdfstepSize)
Sets the step to use in gradient-based solvers.
Definition: Optimizer.C:123
virtual void setFstepSize(double fstepSize)
Sets the step size to use in gradient-free solvers.
Definition: Optimizer.C:117
#define UQ_OPT_FDFSTEP_SIZE
#define UQ_OPT_SOLVER_TYPE
#define UQ_OPT_FSTEP_SIZE
virtual ~BaseOptimizer()
Destructor.
Definition: Optimizer.C:46
double getFiniteDifferenceStepSize() const
Returns the step size used in the finite difference formula.
Definition: Optimizer.C:63
unsigned int getMaxIterations() const
Returns the maximum number of iterations the optimizer will do.
Definition: Optimizer.C:51

Generated on Tue Nov 29 2016 10:53:10 for queso-0.56.0 by  doxygen 1.8.5