fuzzylite  6.0
A Fuzzy Logic Control Library in C++
fl::Threshold Class Reference

The Threshold class is a RuleBlock Activation method that activates the rules whose activation degrees satisfy the equation given by the comparison operator and the threshold, and deactivates the rules which do not satisfy the equation. More...

#include <Threshold.h>

Inheritance diagram for fl::Threshold:
Collaboration diagram for fl::Threshold:

Public Types

enum  Comparison {
  LessThan, LessThanOrEqualTo, EqualTo, NotEqualTo,
  GreaterThanOrEqualTo, GreaterThan
}
 Comparison is an enumerator that provides six comparison operators between the activation degree \(a\) and the threshold \(\theta\). More...
 

Public Member Functions

 Threshold (Comparison comparison=GreaterThanOrEqualTo, scalar threshold=0.0)
 
 Threshold (const std::string &comparison, scalar threshold)
 
virtual ~Threshold ()
 
virtual std::string className () const FL_IOVERRIDE
 Returns the name of the activation method, which is also utilized to register the activation method in the ActivationFactory. More...
 
virtual std::string parameters () const FL_IOVERRIDE
 Returns the comparison operator followed by the threshold. More...
 
virtual void configure (const std::string &parameters) FL_IOVERRIDE
 Configures the activation method with the comparison operator and the threshold. More...
 
virtual void setComparison (Comparison comparison)
 Sets the comparison operator for the activation method. More...
 
virtual Comparison getComparison () const
 Gets the comparison operator for the activation method. More...
 
virtual std::string comparisonOperator () const
 Returns the comparison operator of the activation method. More...
 
virtual std::string comparisonOperator (Comparison comparison) const
 Returns the given comparison operator of the activation method. More...
 
virtual std::vector< std::string > availableComparisonOperators () const
 Returns the list of available comparison operators of the activation method. More...
 
virtual Comparison parseComparison (const std::string &comparisonOperator) const
 Parses the comparison operator, or throws an exception if the parameter does not correspond to a valid operator. More...
 
virtual void setValue (scalar value)
 Sets the threshold value of the activation method. More...
 
virtual scalar getValue () const
 Gets the threshold value of the activation method. More...
 
virtual void setThreshold (Comparison comparison, scalar value)
 Sets the comparison operator and the threshold for the activation method. More...
 
virtual void setThreshold (const std::string &comparison, scalar value)
 Sets the comparison operator and the threshold for the activation method. More...
 
virtual bool activatesWith (scalar activationDegree) const
 Returns whether the activation method will activate a rule with the given activation degree. More...
 
virtual Complexity complexity (const RuleBlock *ruleBlock) const FL_IOVERRIDE
 Computes the estimated complexity of activating the given rule block. More...
 
virtual void activate (RuleBlock *ruleBlock) FL_IOVERRIDE
 Activates the rules whose activation degrees satisfy the comparison equation with the given threshold, and deactivate the rules which do not. More...
 
virtual Thresholdclone () const FL_IOVERRIDE
 Clones the activation method. More...
 
- Public Member Functions inherited from fl::Activation
 Activation ()
 
virtual ~Activation ()
 

Static Public Member Functions

static Activationconstructor ()
 

Detailed Description

The Threshold class is a RuleBlock Activation method that activates the rules whose activation degrees satisfy the equation given by the comparison operator and the threshold, and deactivates the rules which do not satisfy the equation.

Author
Juan Rada-Vilela, Ph.D.
See also
Rule
RuleBlock
ActivationFactory
Since
6.0

Definition at line 41 of file Threshold.h.

Member Enumeration Documentation

◆ Comparison

Comparison is an enumerator that provides six comparison operators between the activation degree \(a\) and the threshold \(\theta\).

Enumerator
LessThan 

\(a < \theta\)

LessThanOrEqualTo 

\(a \leq \theta\)

EqualTo 

\(a = \theta\)

NotEqualTo 

\(a \neq \theta\)

GreaterThanOrEqualTo 

\(a \geq \theta\)

GreaterThan 

\(a > \theta\)

Definition at line 48 of file Threshold.h.

Constructor & Destructor Documentation

◆ Threshold() [1/2]

fl::Threshold::Threshold ( Comparison  comparison = GreaterThanOrEqualTo,
scalar  threshold = 0.0 
)
explicit

◆ Threshold() [2/2]

fl::Threshold::Threshold ( const std::string &  comparison,
scalar  threshold 
)
explicit

◆ ~Threshold()

virtual fl::Threshold::~Threshold ( )
virtual

Member Function Documentation

◆ activate()

virtual void fl::Threshold::activate ( RuleBlock ruleBlock)
virtual

Activates the rules whose activation degrees satisfy the comparison equation with the given threshold, and deactivate the rules which do not.

Parameters
ruleBlockis the rule block to activate

Implements fl::Activation.

◆ activatesWith()

virtual bool fl::Threshold::activatesWith ( scalar  activationDegree) const
virtual

Returns whether the activation method will activate a rule with the given activation degree.

Parameters
activationDegreean activation degree
Returns
whether the comparison equation is satisfied with the activation degree and the threshold

◆ availableComparisonOperators()

virtual std::vector<std::string> fl::Threshold::availableComparisonOperators ( ) const
virtual

Returns the list of available comparison operators of the activation method.

Returns
(==, !=, <, >, <=, >=)

◆ className()

virtual std::string fl::Threshold::className ( ) const
virtual

Returns the name of the activation method, which is also utilized to register the activation method in the ActivationFactory.

Returns
the name of the activation method
See also
ActivationFactory

Implements fl::Activation.

◆ clone()

virtual Threshold* fl::Threshold::clone ( ) const
virtual

Clones the activation method.

Returns
a clone of the activation method

Implements fl::Activation.

◆ comparisonOperator() [1/2]

virtual std::string fl::Threshold::comparisonOperator ( ) const
virtual

Returns the comparison operator of the activation method.

Returns
the comparison operator in (==, !=, <, >, <=, >=)

◆ comparisonOperator() [2/2]

virtual std::string fl::Threshold::comparisonOperator ( Comparison  comparison) const
virtual

Returns the given comparison operator of the activation method.

Parameters
comparisonis a valid enum value
Returns
the comparison operator for the given enum value
Exceptions
fl::Exceptionif the given comparison operator is not valid

◆ complexity()

virtual Complexity fl::Threshold::complexity ( const RuleBlock ruleBlock) const
virtual

Computes the estimated complexity of activating the given rule block.

Returns
the estimated complexity of activating the given rule block

Implements fl::Activation.

◆ configure()

virtual void fl::Threshold::configure ( const std::string &  parameters)
virtual

Configures the activation method with the comparison operator and the threshold.

Parameters
parametersis the comparison operator and threshold

Implements fl::Activation.

◆ constructor()

static Activation* fl::Threshold::constructor ( )
static

◆ getComparison()

virtual Comparison fl::Threshold::getComparison ( ) const
virtual

Gets the comparison operator for the activation method.

Returns
comparison operator for the activation method

◆ getValue()

virtual scalar fl::Threshold::getValue ( ) const
virtual

Gets the threshold value of the activation method.

Returns
the threshold value of the activation method

◆ parameters()

virtual std::string fl::Threshold::parameters ( ) const
virtual

Returns the comparison operator followed by the threshold.

Returns
comparison operator and threshold

Implements fl::Activation.

◆ parseComparison()

virtual Comparison fl::Threshold::parseComparison ( const std::string &  comparisonOperator) const
virtual

Parses the comparison operator, or throws an exception if the parameter does not correspond to a valid operator.

Parameters
comparisonOperatoris an operator in (==, !=, <, >, <=, >=)

◆ setComparison()

virtual void fl::Threshold::setComparison ( Comparison  comparison)
virtual

Sets the comparison operator for the activation method.

Parameters
comparisonis the operator for the activation method

◆ setThreshold() [1/2]

virtual void fl::Threshold::setThreshold ( Comparison  comparison,
scalar  value 
)
virtual

Sets the comparison operator and the threshold for the activation method.

Parameters
comparisonis the comparison enumerator
valueis the threshold of the activation method

◆ setThreshold() [2/2]

virtual void fl::Threshold::setThreshold ( const std::string &  comparison,
scalar  value 
)
virtual

Sets the comparison operator and the threshold for the activation method.

Parameters
comparisonis a valid comparison operator
valueis the threshold for activation degrees
Exceptions
fl::Exceptionif the comparison operator is not valid

◆ setValue()

virtual void fl::Threshold::setValue ( scalar  value)
virtual

Sets the threshold value of the activation method.

Parameters
valueis the threshold value for activation degrees

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