Mantid
Loading...
Searching...
No Matches
IFuncMinimizer.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//----------------------------------------------------------------------
12#include "MantidAPI/DllConfig.h"
15
16namespace Mantid {
17namespace API {
18// Forward declaration
19class IFitFunction;
20
26class MANTID_API_DLL IFuncMinimizer : public Kernel::PropertyManager {
27public:
31 virtual void initialize(API::ICostFunction_sptr function, size_t maxIterations = 1000) = 0;
32
34 virtual std::string name() const = 0;
35
40 virtual bool iterate(size_t iteration) = 0;
41
44 virtual bool minimize(size_t maxIterations = 1000);
45
47 virtual std::string getError() const { return m_errorString; }
48
50 virtual double costFunctionVal() = 0;
51
53 virtual void finalize() {}
54
55protected:
57 std::string m_errorString;
58};
59
60using IFuncMinimizer_sptr = std::shared_ptr<IFuncMinimizer>;
61
62} // namespace API
63} // namespace Mantid
An interface for function minimizers.
virtual bool iterate(size_t iteration)=0
Do one iteration.
virtual void initialize(API::ICostFunction_sptr function, size_t maxIterations=1000)=0
Initialize minimizer.
virtual std::string getError() const
Get the error string.
std::string m_errorString
Error string.
virtual void finalize()
Finalize minimization, eg store additional outputs.
virtual double costFunctionVal()=0
Get value of cost function.
virtual std::string name() const =0
Get name of minimizer.
Property manager helper class.
std::shared_ptr< IFuncMinimizer > IFuncMinimizer_sptr
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.