Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
Mantid::API::IConstraint Class Referenceabstract

An interface to a constraint. More...

#include <IConstraint.h>

Inheritance diagram for Mantid::API::IConstraint:
Mantid::API::ParameterReference Mantid::CurveFitting::Constraints::BoundaryConstraint

Public Member Functions

virtual std::string asString () const =0
 Return the string that can be used in this->initialize() to recreate this constraint. More...
 
virtual double check ()=0
 Returns a penalty number which is bigger than or equal to zero If zero it means that the constraint is not penalized. More...
 
virtual double checkDeriv ()=0
 Returns the derivative of the penalty for each active parameter. More...
 
virtual double checkDeriv2 ()=0
 Returns the derivative of the penalty for each active parameter. More...
 
virtual double getPenaltyFactor () const =0
 get the penalty factor for the constraint More...
 
virtual void initialize (IFunction *fun, const Expression &expr, bool isDefault=false)=0
 Initialize the constraint from an expression. More...
 
virtual void setParamToSatisfyConstraint ()=0
 Set the parameters of IFitFunction to satisfy constraint. More...
 
virtual void setPenaltyFactor (const double &c)=0
 set the penalty factor for the constraint Set panelty factor. More...
 
- Public Member Functions inherited from Mantid::API::ParameterReference
IFunctiongetLocalFunction () const
 Return pointer to the local function. More...
 
std::size_t getLocalIndex () const
 Return parameter index in the local function. More...
 
double getParameter () const
 Get the value of the parameter. More...
 
bool isDefault () const
 Returns the default value flag. More...
 
bool isParameterOf (const IFunction *fun) const
 Find out if this refers to a parameter of a function: direct or via composite function member. More...
 
IFunctionownerFunction () const
 
std::size_t parameterIndex () const
 Return parameter index in the owning function. More...
 
std::string parameterName () const
 Return parameter name in the owning function. More...
 
 ParameterReference ()
 Default constructor. More...
 
 ParameterReference (IFunction *fun, std::size_t index, bool isDefault=false)
 Constructor. More...
 
void setParameter (const double &value, bool isExplicitlySet=true)
 Set the parameter. More...
 
virtual ~ParameterReference ()=default
 

Static Public Member Functions

static double getDefaultPenaltyFactor ()
 Return the value for default fitting penalties. More...
 

Static Protected Attributes

static constexpr double m_defaultPenaltyFactor = 1000
 default penalty factor for constraints More...
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::API::ParameterReference
void reset (IFunction *fun, std::size_t index, bool isDefault=false)
 Reset the reference. More...
 

Detailed Description

An interface to a constraint.

Author
Anders Markvardsen, ISIS, RAL
Date
12/11/2009

Definition at line 26 of file IConstraint.h.

Member Function Documentation

◆ asString()

virtual std::string Mantid::API::IConstraint::asString ( ) const
pure virtual

Return the string that can be used in this->initialize() to recreate this constraint.

Implemented in Mantid::CurveFitting::Constraints::BoundaryConstraint.

Referenced by MantidQt::MantidWidgets::PropertyHandler::initParameters().

◆ check()

virtual double Mantid::API::IConstraint::check ( )
pure virtual

Returns a penalty number which is bigger than or equal to zero If zero it means that the constraint is not penalized.

If larger than zero the constraint is penalized where the larger this number is the larger the penalty

Implemented in Mantid::CurveFitting::Constraints::BoundaryConstraint.

Referenced by Mantid::Crystal::PeakHKLErrors::function1D(), Mantid::CurveFitting::Functions::BivariateNormal::function1D(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::val(), and Mantid::CurveFitting::CostFunctions::CostFuncFitting::valDerivHessian().

◆ checkDeriv()

virtual double Mantid::API::IConstraint::checkDeriv ( )
pure virtual

Returns the derivative of the penalty for each active parameter.

Implemented in Mantid::CurveFitting::Constraints::BoundaryConstraint.

Referenced by Mantid::CurveFitting::gsl_f(), and Mantid::CurveFitting::CostFunctions::CostFuncFitting::valDerivHessian().

◆ checkDeriv2()

virtual double Mantid::API::IConstraint::checkDeriv2 ( )
pure virtual

Returns the derivative of the penalty for each active parameter.

Implemented in Mantid::CurveFitting::Constraints::BoundaryConstraint.

Referenced by Mantid::CurveFitting::gsl_df(), and Mantid::CurveFitting::CostFunctions::CostFuncFitting::valDerivHessian().

◆ getDefaultPenaltyFactor()

static double Mantid::API::IConstraint::getDefaultPenaltyFactor ( )
inlinestatic

Return the value for default fitting penalties.

Definition at line 64 of file IConstraint.h.

Referenced by Mantid::CurveFitting::Constraints::BoundaryConstraint::asString().

◆ getPenaltyFactor()

virtual double Mantid::API::IConstraint::getPenaltyFactor ( ) const
pure virtual

get the penalty factor for the constraint

Implemented in Mantid::CurveFitting::Constraints::BoundaryConstraint.

◆ initialize()

virtual void Mantid::API::IConstraint::initialize ( IFunction fun,
const Expression expr,
bool  isDefault = false 
)
pure virtual

Initialize the constraint from an expression.

Implemented in Mantid::CurveFitting::Constraints::BoundaryConstraint.

Referenced by Mantid::API::ConstraintFactoryImpl::createInitialized().

◆ setParamToSatisfyConstraint()

virtual void Mantid::API::IConstraint::setParamToSatisfyConstraint ( )
pure virtual

Set the parameters of IFitFunction to satisfy constraint.

For example for a BoundaryConstraint this if param value less than lower boundary it is set to that value and vice versa for if the param value is larger than the upper boundary value.

Implemented in Mantid::CurveFitting::Constraints::BoundaryConstraint.

Referenced by Mantid::CurveFitting::CostFunctions::CostFuncFitting::reset().

◆ setPenaltyFactor()

virtual void Mantid::API::IConstraint::setPenaltyFactor ( const double &  c)
pure virtual

set the penalty factor for the constraint Set panelty factor.

The larger the number to thigter the constraint. This number must be set to a number larger than zero

Parameters
c:: the penalt factor

Implemented in Mantid::CurveFitting::Constraints::BoundaryConstraint.

Referenced by Mantid::CurveFitting::Functions::BivariateNormal::function1D(), and Mantid::API::IFunction::setMatrixWorkspace().

Member Data Documentation

◆ m_defaultPenaltyFactor

constexpr double Mantid::API::IConstraint::m_defaultPenaltyFactor = 1000
staticconstexprprotected

default penalty factor for constraints

Definition at line 68 of file IConstraint.h.


The documentation for this class was generated from the following file: