queso-0.56.0
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-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 #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 setFstepSize(double fstepSize)
Sets the step size to use in gradient-free solvers.
Definition: GslOptimizer.C:567
void set_solver_type(SolverType solver)
Definition: GslOptimizer.C:260
SolverType string_to_enum(std::string &solver)
Definition: GslOptimizer.C:509
A templated (base) class for handling scalar functions.
void setInitialPoint(const GslVector &intialPoint)
Set the point at which the optimization starts.
Definition: GslOptimizer.C:247
int dim
Definition: ann2fig.cpp:81
A base class for handling optimisation of scalar functions.
Definition: Optimizer.h:47
GslOptimizer(const BaseScalarFunction< GslVector, GslMatrix > &objectiveFunction)
Constructs an object that will maximize a scalar function.
Definition: GslOptimizer.C:159
virtual void minimize(OptimizerMonitor *monitor=NULL)
Minimize the objective function, starting at m_initialPoint.
Definition: GslOptimizer.C:211
virtual void setLineTolerance(double lineTolerance)
Sets the tolerance to use for line minimisation.
Definition: GslOptimizer.C:586
Class for vector operations using GSL library.
Definition: GslVector.h:49
void minimize_with_gradient(unsigned int dim, OptimizerMonitor *monitor)
Definition: GslOptimizer.C:297
This class provides options for a Optimizer.
bool solver_needs_gradient(SolverType solver)
Helper function.
Definition: GslOptimizer.C:266
const GslVector & minimizer() const
Return the point that minimizes the objective function.
Definition: GslOptimizer.C:255
virtual ~GslOptimizer()
Destructor.
Definition: GslOptimizer.C:206
virtual double getLineTolerance() const
Gets the tolerance to use for line minimisation.
Definition: GslOptimizer.C:610
const BaseScalarFunction< GslVector, GslMatrix > & m_objectiveFunction
Definition: GslOptimizer.h:155
A base class for handling optimisation of scalar functions.
Definition: GslOptimizer.h:50
SolverType m_solver_type
Definition: GslOptimizer.h:160
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:579
double m_fdfstep_size
For use in gradient-based algorithms.
Definition: GslOptimizer.h:166
void set_step_size(const GslVector &step_size)
Sets step size used in gradient-free solvers.
Definition: GslOptimizer.C:497
void minimize_no_gradient(unsigned int dim, OptimizerMonitor *monitor)
Definition: GslOptimizer.C:395
Object to monitor convergence of optimizers.
void set_line_tol(double tol)
Set GSL line minimization tolerance.
virtual double getFdfstepSize() const
Gets the step to use in gradient-based solvers.
Definition: GslOptimizer.C:604
GslVector * m_minimizer
Definition: GslOptimizer.h:158
virtual std::string getSolverType() const
Gets the algorithm to use for minimisation.
Definition: GslOptimizer.C:592
virtual void setSolverType(std::string solverType)
Sets the algorithm to use for minimisation.
Definition: GslOptimizer.C:560
const BaseScalarFunction< GslVector, GslMatrix > & objectiveFunction() const
Returns the objective function.
Definition: GslOptimizer.C:241
double m_line_tol
Line minimization tolerance in gradient-based algorithms.
Definition: GslOptimizer.h:169
virtual double getFstepSize() const
Gets the step size to use in gradient-free solvers.
Definition: GslOptimizer.C:598
GslVector * m_initialPoint
Definition: GslOptimizer.h:157

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