BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
GSLMultiMinimizer.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Fit/Adapter/GSLMultiMinimizer.h
6 //! @brief Declares class GSLMultiMinimizer.
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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_FIT_ADAPTER_GSLMULTIMINIMIZER_H
21 #define BORNAGAIN_FIT_ADAPTER_GSLMULTIMINIMIZER_H
22 
24 
25 namespace ROOT::Math {
26 
27 class GSLMinimizer;
28 }
29 
30 //! Wrapper for the CERN ROOT facade of the GSL multi minimizer family (gradient descent based).
31 
33 public:
34  explicit GSLMultiMinimizer(const std::string& algorithmName = "ConjugateFR");
35  ~GSLMultiMinimizer() override;
36 
37  //! Sets minimizer internal print level.
38  void setPrintLevel(int value);
39  int printLevel() const;
40 
41  //! Sets maximum number of iterations. This is an internal minimizer setting which has
42  //! no direct relation to the number of objective function calls (e.g. numberOfIteraction=5
43  //! might correspond to ~100 objective function calls).
44  void setMaxIterations(int value);
45  int maxIterations() const;
46 
47  std::string statusToString() const override;
48 
49 protected:
50  void propagateOptions() override;
51  const root_minimizer_t* rootMinimizer() const override;
52 
53 private:
54  std::unique_ptr<ROOT::Math::GSLMinimizer> m_gsl_minimizer;
55 };
56 
57 #endif // BORNAGAIN_FIT_ADAPTER_GSLMULTIMINIMIZER_H
58 #endif // USER_API
Declares class MinimizerAdapter.
Wrapper for the CERN ROOT facade of the GSL multi minimizer family (gradient descent based).
void propagateOptions() override
std::unique_ptr< ROOT::Math::GSLMinimizer > m_gsl_minimizer
const root_minimizer_t * rootMinimizer() const override
std::string statusToString() const override
Returns string representation of current minimizer status.
void setMaxIterations(int value)
Sets maximum number of iterations. This is an internal minimizer setting which has no direct relation...
GSLMultiMinimizer(const std::string &algorithmName="ConjugateFR")
void setPrintLevel(int value)
Sets minimizer internal print level.
~GSLMultiMinimizer() override
Abstract base class that adapts the CERN ROOT minimizer to our IMinimizer.
std::string algorithmName() const override
Returns name of the minimization algorithm.