Mantid
Loading...
Searching...
No Matches
IConstraint.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 <string>
14
15namespace Mantid {
16namespace API {
17//----------------------------------------------------------------------
18// Forward declarations
19//----------------------------------------------------------------------
20class Expression;
26class MANTID_API_DLL IConstraint : public ParameterReference {
27public:
29 virtual void initialize(IFunction *fun, const Expression &expr, bool isDefault = false) = 0;
30
35 virtual double check() = 0;
36
38 virtual double checkDeriv() = 0;
39
41 virtual double checkDeriv2() = 0;
42
47 virtual void setParamToSatisfyConstraint() = 0;
48
54 virtual void setPenaltyFactor(const double &c) = 0;
55
57 virtual double getPenaltyFactor() const = 0;
58
61 virtual std::string asString() const = 0;
62
64 static double getDefaultPenaltyFactor() { return m_defaultPenaltyFactor; }
65
66protected:
68 static constexpr double m_defaultPenaltyFactor = 1000;
69};
70
71} // namespace API
72} // namespace Mantid
This class represents an expression made up of names, binary operators and brackets.
Definition: Expression.h:36
An interface to a constraint.
Definition: IConstraint.h:26
virtual double checkDeriv()=0
Returns the derivative of the penalty for each active parameter.
virtual void initialize(IFunction *fun, const Expression &expr, bool isDefault=false)=0
Initialize the constraint from an expression.
virtual double getPenaltyFactor() const =0
get the penalty factor for the constraint
virtual std::string asString() const =0
Return the string that can be used in this->initialize() to recreate this constraint.
static double getDefaultPenaltyFactor()
Return the value for default fitting penalties.
Definition: IConstraint.h:64
virtual double checkDeriv2()=0
Returns the derivative of the penalty for each active parameter.
virtual double check()=0
Returns a penalty number which is bigger than or equal to zero If zero it means that the constraint i...
virtual void setPenaltyFactor(const double &c)=0
set the penalty factor for the constraint Set panelty factor.
virtual void setParamToSatisfyConstraint()=0
Set the parameters of IFitFunction to satisfy constraint.
This is an interface to a fitting function - a semi-abstarct class.
Definition: IFunction.h:163
A reference to a parameter in a function.
Helper class which provides the Collimation Length for SANS instruments.