BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MinimizerTestPlan.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Fit/TestEngine/MinimizerTestPlan.h
6 //! @brief Defines class MinimizerTestPlan
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_TESTENGINE_MINIMIZERTESTPLAN_H
21 #define BORNAGAIN_FIT_TESTENGINE_MINIMIZERTESTPLAN_H
22 
24 #include <vector>
25 
26 namespace mumufit {
27 class Parameter;
28 class Parameters;
29 class Minimizer;
30 } // namespace mumufit
31 
32 //! Defines objective function to fit, expected minimum, initial fit parameters and
33 //! expected values of fit parameters at minimum.
34 
36 public:
37  MinimizerTestPlan(const std::string& name);
38 
39  virtual ~MinimizerTestPlan();
40 
41  void addParameter(const mumufit::Parameter& param, double expected_value,
42  double tolerance = 0.01);
43 
44  std::string name() const { return m_name; }
45 
46  //! Runs minimization and check minimization result.
47  virtual bool checkMinimizer(mumufit::Minimizer& minimizer) = 0;
48 
49 protected:
51  std::vector<double> expectedValues() const;
52  bool valuesAsExpected(const std::vector<double>& values) const;
53 
54  std::string m_name; //!< plan name
55  std::vector<ParameterPlan> m_parameter_plan; //! initial/expected parameter values
56 };
57 
58 #endif // BORNAGAIN_FIT_TESTENGINE_MINIMIZERTESTPLAN_H
59 #endif // USER_API
Defines class ParameterPlan.
Defines objective function to fit, expected minimum, initial fit parameters and expected values of fi...
std::vector< double > expectedValues() const
Return vector of expected parameter values.
MinimizerTestPlan(const std::string &name)
bool valuesAsExpected(const std::vector< double > &values) const
Returns true if given values coincide with expected fit parameter values.
mumufit::Parameters parameters() const
Returns fit parameters which will be used as initial one for the minimization.
std::string m_name
plan name
virtual bool checkMinimizer(mumufit::Minimizer &minimizer)=0
Runs minimization and check minimization result.
virtual ~MinimizerTestPlan()
std::string name() const
std::vector< ParameterPlan > m_parameter_plan
void addParameter(const mumufit::Parameter &param, double expected_value, double tolerance=0.01)
A main class to run fitting.
Definition: Minimizer.h:37
A fittable parameter with value, error, step, and limits.
Definition: Parameter.h:26
A collection of fit parameters.
Definition: Parameters.h:26
The multi-library, multi-algorithm fit wrapper library.