BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
GSLLevenbergMarquardtMinimizer.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Fit/RootAdapter/GSLLevenbergMarquardtMinimizer.h
6 //! @brief Declares class GSLLevenbergMarquardtMinimizer.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #ifndef BORNAGAIN_FIT_ROOTADAPTER_GSLLEVENBERGMARQUARDTMINIMIZER_H
16 #define BORNAGAIN_FIT_ROOTADAPTER_GSLLEVENBERGMARQUARDTMINIMIZER_H
17 
19 
20 namespace ROOT
21 {
22 namespace Math
23 {
24 class GSLNLSMinimizer;
25 }
26 } // namespace ROOT
27 
28 //! It's a facade to ROOT::Math::GSLNLSMinimizer which, in turn, is a facade to the
29 //! actual GSL's gsl_multifit_fdfsolver_type
30 //! (http://www.gnu.org/software/gsl/manual/html_node/Nonlinear-Least_002dSquares-Fitting.html).
31 //! @ingroup fitting_internal
32 
34 {
35 public:
38 
39  //! Sets tolerance on the function value at the minimum.
40  void setTolerance(double value);
41  double tolerance() const;
42 
43  //! Sets minimizer internal print level.
44  void setPrintLevel(int value);
45  int printLevel() const;
46 
47  //! Sets maximum number of iterations. This is an internal minimizer setting which has
48  //! no direct relation to the number of objective function calls (e.g. numberOfIteraction=5
49  //! might correspond to ~100 objective function calls).
50  void setMaxIterations(int value);
51  int maxIterations() const;
52 
53  std::string statusToString() const override;
54  std::map<std::string, std::string> statusMap() const override;
55 
56  bool requiresResiduals() override { return true; }
57 
58 protected:
59  void propagateOptions() override;
60  const root_minimizer_t* rootMinimizer() const override;
61  void setParameter(unsigned int index, const Fit::Parameter& par) override;
62 
63 private:
64  std::unique_ptr<ROOT::Math::GSLNLSMinimizer> m_gsl_minimizer;
65 };
66 
67 #endif // BORNAGAIN_FIT_ROOTADAPTER_GSLLEVENBERGMARQUARDTMINIMIZER_H
Declares class RootMinimizerAdapter.
A fittable parameter with value, error, step, and limits.
Definition: Parameter.h:28
It's a facade to ROOT::Math::GSLNLSMinimizer which, in turn, is a facade to the actual GSL's gsl_mult...
void setMaxIterations(int value)
Sets maximum number of iterations.
~GSLLevenbergMarquardtMinimizer() override
void setTolerance(double value)
Sets tolerance on the function value at the minimum.
std::unique_ptr< ROOT::Math::GSLNLSMinimizer > m_gsl_minimizer
void setParameter(unsigned int index, const Fit::Parameter &par) override
std::string statusToString() const override
Returns string representation of current minimizer status.
bool requiresResiduals() override
Returns true if minimizer computations are residual-based, false otherwise.
const root_minimizer_t * rootMinimizer() const override
void setPrintLevel(int value)
Sets minimizer internal print level.
std::map< std::string, std::string > statusMap() const override
Returns map of string representing different minimizer statuses.
Pure virtual interface that adapts the CERN ROOT minimizer to our IMinimizer.
ROOT::Math::Minimizer root_minimizer_t