queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
GslOptimizer.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_GSL_OPTIMIZER_H
26 #define UQ_GSL_OPTIMIZER_H
27 
28 #include <queso/Optimizer.h>
29 
30 namespace QUESO {
31 
42 class Vector;
43 class GslVector;
44 class GslMatrix;
45 class OptimizerMonitor;
46 
47 template <class V, class M>
48 class BaseScalarFunction;
49 
50 class GslOptimizer : public BaseOptimizer {
51 public:
53 
58 
59 
61 
68  const BaseScalarFunction<GslVector, GslMatrix> & objectiveFunction);
69 
71  virtual ~GslOptimizer();
72 
74 
77  virtual void minimize(OptimizerMonitor* monitor = NULL);
78 
81 
90 
92  void setInitialPoint(const GslVector & intialPoint);
93 
95 
99  const GslVector & minimizer() const;
100 
101  void set_solver_type( SolverType solver );
102 
103  void set_solver_type( std::string& solver );
104 
105  SolverType string_to_enum( std::string& solver );
106 
108 
113  void set_step_size( const GslVector& step_size );
114 
116 
120  void set_step_size( double step_size );
121 
123 
128  void set_line_tol( double tol );
129 
131  virtual std::string getSolverType() const;
132 
134  virtual double getFstepSize() const;
135 
137  virtual double getFdfstepSize() const;
138 
140  virtual double getLineTolerance() const;
141 
143  virtual void setSolverType(std::string solverType);
144 
146  virtual void setFstepSize(double fstepSize);
147 
149  virtual void setFdfstepSize(double fdfstepSize);
150 
152  virtual void setLineTolerance(double lineTolerance);
153 
154 private:
156 
159 
161 
164 
167 
169  double m_line_tol;
170 
172  bool solver_needs_gradient(SolverType solver);
173 
174  void minimize_with_gradient( unsigned int dim, OptimizerMonitor* monitor );
175 
176  void minimize_no_gradient( unsigned int dim, OptimizerMonitor* monitor );
177 
178 };
179 
180 } // End namespace QUESO
181 
182 #endif // UQ_GSL_OPTIMIZER_H
virtual void setSolverType(std::string solverType)
Sets the algorithm to use for minimisation.
Definition: GslOptimizer.C:556
const GslVector & minimizer() const
Return the point that minimizes the objective function.
Definition: GslOptimizer.C:251
GslOptimizer(const BaseScalarFunction< GslVector, GslMatrix > &objectiveFunction)
Constructs an object that will maximize a scalar function.
Definition: GslOptimizer.C:155
A templated (base) class for handling scalar functions.
virtual void setLineTolerance(double lineTolerance)
Sets the tolerance to use for line minimisation.
Definition: GslOptimizer.C:582
virtual void minimize(OptimizerMonitor *monitor=NULL)
Minimize the objective function, starting at m_initialPoint.
Definition: GslOptimizer.C:207
GslVector * m_minimizer
Definition: GslOptimizer.h:158
const BaseScalarFunction< GslVector, GslMatrix > & m_objectiveFunction
Definition: GslOptimizer.h:155
SolverType m_solver_type
Definition: GslOptimizer.h:160
A base class for handling optimisation of scalar functions.
Definition: Optimizer.h:47
double m_fdfstep_size
For use in gradient-based algorithms.
Definition: GslOptimizer.h:166
bool solver_needs_gradient(SolverType solver)
Helper function.
Definition: GslOptimizer.C:262
void minimize_with_gradient(unsigned int dim, OptimizerMonitor *monitor)
Definition: GslOptimizer.C:293
virtual double getLineTolerance() const
Gets the tolerance to use for line minimisation.
Definition: GslOptimizer.C:606
void set_solver_type(SolverType solver)
Definition: GslOptimizer.C:256
virtual ~GslOptimizer()
Destructor.
Definition: GslOptimizer.C:202
void setInitialPoint(const GslVector &intialPoint)
Set the point at which the optimization starts.
Definition: GslOptimizer.C:243
double m_line_tol
Line minimization tolerance in gradient-based algorithms.
Definition: GslOptimizer.h:169
void set_step_size(const GslVector &step_size)
Sets step size used in gradient-free solvers.
Definition: GslOptimizer.C:493
void minimize_no_gradient(unsigned int dim, OptimizerMonitor *monitor)
Definition: GslOptimizer.C:391
void set_line_tol(double tol)
Set GSL line minimization tolerance.
virtual std::string getSolverType() const
Gets the algorithm to use for minimisation.
Definition: GslOptimizer.C:588
Class for vector operations using GSL library.
Definition: GslVector.h:49
This class provides options for a Optimizer.
virtual void setFstepSize(double fstepSize)
Sets the step size to use in gradient-free solvers.
Definition: GslOptimizer.C:563
int dim
Definition: ann_test.cpp:472
virtual double getFdfstepSize() const
Gets the step to use in gradient-based solvers.
Definition: GslOptimizer.C:600
GslVector m_fstep_size
For use in gradient-free algorithms.
Definition: GslOptimizer.h:163
virtual void setFdfstepSize(double fdfstepSize)
Sets the step to use in gradient-based solvers.
Definition: GslOptimizer.C:575
Object to monitor convergence of optimizers.
const BaseScalarFunction< GslVector, GslMatrix > & objectiveFunction() const
Returns the objective function.
Definition: GslOptimizer.C:237
GslVector * m_initialPoint
Definition: GslOptimizer.h:157
virtual double getFstepSize() const
Gets the step size to use in gradient-free solvers.
Definition: GslOptimizer.C:594
SolverType string_to_enum(std::string &solver)
Definition: GslOptimizer.C:505
A base class for handling optimisation of scalar functions.
Definition: GslOptimizer.h:50

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