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
43 virtual bool minimize(size_t maxIterations = 1000);
44
46 virtual std::string getError() const { return m_errorString; }
47
49 virtual double costFunctionVal() = 0;
50
52 virtual void finalize() {}
53
54protected:
56 std::string m_errorString;
57};
58
59using IFuncMinimizer_sptr = std::shared_ptr<IFuncMinimizer>;
60
61} // namespace API
62} // 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
Helper class which provides the Collimation Length for SANS instruments.