Mantid
Loading...
Searching...
No Matches
SimplexMinimizer.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2009 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
13#include "MantidCurveFitting/DllConfig.h"
14
15#include <gsl/gsl_multimin.h>
16
17namespace Mantid {
18namespace CurveFitting {
19namespace FuncMinimisers {
26class MANTID_CURVEFITTING_DLL SimplexMinimizer : public API::IFuncMinimizer {
27public:
30 SimplexMinimizer(const double epsabs = 1e-2);
32 ~SimplexMinimizer() override;
33
35 std::string name() const override { return "Simplex"; }
37 bool iterate(size_t) override;
39 double costFunctionVal() override;
41 void initialize(API::ICostFunction_sptr function, size_t maxIterations = 0) override;
42
43protected:
44 void resetSize(const double &size);
45
46private:
48 void clearMemory();
49
51 static double fun(const gsl_vector *x, void *params);
52
54 double m_epsabs;
55
58
60 double m_size;
61
63 gsl_vector *m_simplexStepSize;
64
66 gsl_vector *m_startGuess;
67
69 gsl_multimin_fminimizer *m_gslSolver;
70
72 gsl_multimin_function gslContainer;
73};
74
75} // namespace FuncMinimisers
76} // namespace CurveFitting
77} // namespace Mantid
An interface for function minimizers.
Implementing Simplex by wrapping the IFuncMinimizer interface around the GSL implementation of this a...
gsl_multimin_fminimizer * m_gslSolver
pointer to the GSL solver doing the work
double m_epsabs
Absolute value of the error that is considered a fit.
gsl_vector * m_startGuess
Starting parameter values.
std::string name() const override
Overloading base class methods.
gsl_multimin_function gslContainer
GSL simplex minimizer container.
API::ICostFunction_sptr m_costFunction
Function to minimize.
std::shared_ptr< ICostFunction > ICostFunction_sptr
define a shared pointer to a cost function
Definition: ICostFunction.h:60
Helper class which provides the Collimation Length for SANS instruments.