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

The OutputVariable class is a Variable that represents an output of the fuzzy logic controller. More...

#include <OutputVariable.h>

Inheritance diagram for fl::OutputVariable:
Collaboration diagram for fl::OutputVariable:

Public Member Functions

 OutputVariable (const std::string &name="", scalar minimum=-fl::inf, scalar maximum=fl::inf)
 
 OutputVariable (const OutputVariable &other)
 
OutputVariableoperator= (const OutputVariable &other)
 
virtual ~OutputVariable () FL_IOVERRIDE
 
virtual AggregatedfuzzyOutput () const
 Gets the fuzzy output value \(\tilde{y}\). More...
 
virtual void setName (const std::string &name) FL_IOVERRIDE
 Sets the name of the variable. More...
 
virtual void setMinimum (scalar minimum) FL_IOVERRIDE
 Sets the minimum value of the range of the variable. More...
 
virtual void setMaximum (scalar maximum) FL_IOVERRIDE
 Sets the maximum value of the range of the variable. More...
 
virtual void setDefuzzifier (Defuzzifier *defuzzifier)
 Sets the defuzzifier of the output variable. More...
 
virtual DefuzzifiergetDefuzzifier () const
 Gets the defuzzifier of the output variable. More...
 
virtual void setAggregation (SNorm *aggregation)
 Sets the aggregation operator. More...
 
virtual SNormgetAggregation () const
 Gets the aggregation operator. More...
 
virtual void setPreviousValue (scalar previousValue)
 Sets the previous value of the output variable. More...
 
virtual scalar getPreviousValue () const
 Gets the previous value of the output variable. More...
 
virtual void setDefaultValue (scalar defaultValue)
 Sets the default value of the output variable. More...
 
virtual scalar getDefaultValue () const
 Gets the default value of the output variable. More...
 
virtual void setLockPreviousValue (bool lockPreviousValue)
 Sets whether to lock the previous value of the output variable. More...
 
virtual bool isLockPreviousValue () const
 Gets whether to lock the previous value of the output variable. More...
 
virtual Complexity complexity (const Activated &term) const
 Computes the estimated complexity of defuzzifying the activated term with the current configuration of the variable (namely aggregation and defuzzifier. More...
 
virtual Complexity complexityOfDefuzzification () const
 Computes the estimated complexity of aggregating and defuzzifying all the terms in the variable. More...
 
virtual Complexity currentComplexity () const
 Computes the estimated complexity of aggregating and defuzzifying the terms currently found in the fuzzy output variable. More...
 
virtual void defuzzify ()
 Defuzzifies the output variable and stores the output value and the previous output value. More...
 
virtual std::string fuzzyOutputValue () const
 Gets a string representation of the fuzzy output value \(\tilde{y}\). More...
 
virtual void clear ()
 Clears the output variable by setting \(\tilde{y}=\{\}\), \(y^{t}=\mbox{NaN}\), \(y^{t-1}=\mbox{NaN}\). More...
 
virtual Variable::Type type () const FL_IOVERRIDE
 Returns the type of the variable. More...
 
virtual std::string toString () const FL_IOVERRIDE
 Gets a string representation of the variable in the FuzzyLite Language. More...
 
virtual OutputVariableclone () const FL_IOVERRIDE
 Creates a clone of the variable. More...
 
- Public Member Functions inherited from fl::Variable
 Variable (const std::string &name="", scalar minimum=-fl::inf, scalar maximum=fl::inf)
 
 Variable (const Variable &other)
 
Variableoperator= (const Variable &other)
 
virtual ~Variable ()
 
virtual std::string getName () const
 Gets the name of the variable. More...
 
virtual std::string getDescription () const
 Gets the description of the variable. More...
 
virtual void setDescription (const std::string &description)
 Sets the description of the variable. More...
 
virtual void setValue (scalar value)
 Sets the value of the variable. More...
 
virtual scalar getValue () const
 Gets the value of the variable. More...
 
virtual void setRange (scalar minimum, scalar maximum)
 Sets the range of the variable between [minimum, maximum] More...
 
virtual scalar range () const
 Gets the magnitude of the range of the variable. More...
 
virtual scalar getMinimum () const
 Gets the minimum value of the range of the variable. More...
 
virtual scalar getMaximum () const
 Gets the maximum value of the range of the variable. More...
 
virtual void setEnabled (bool enabled)
 Sets whether the variable is enabled. More...
 
virtual bool isEnabled () const
 Gets whether the variable is enabled. More...
 
virtual void setLockValueInRange (bool lockValueInRange)
 Sets whether the variable locks the current value to the range of the variable. More...
 
virtual bool isLockValueInRange () const
 Gets whether the variable locks the current value to the range of the variable. More...
 
virtual Complexity complexity () const
 Computes the aggregated complexity of the underlying terms. More...
 
virtual std::string fuzzify (scalar x) const
 Evaluates the membership function of value \(x\) for each term \(i\), resulting in a fuzzy value in the form \(\tilde{x}=\sum_i{\mu_i(x)/i}\). More...
 
virtual TermhighestMembership (scalar x, scalar *yhighest=fl::null) const
 Gets the term which has the highest membership function value for \(x\). More...
 
virtual void sort ()
 Sorts the terms in ascending order according to their centroids. More...
 
virtual void addTerm (Term *term)
 Adds a term to the variable. More...
 
virtual void insertTerm (Term *term, std::size_t index)
 Inserts the term in the variable. More...
 
virtual TermgetTerm (std::size_t index) const
 Gets the term at the given index. More...
 
virtual TermgetTerm (const std::string &name) const
 Gets the term of the given name. More...
 
virtual bool hasTerm (const std::string &name) const
 Gets whether a term of the given name has been added. More...
 
virtual TermremoveTerm (std::size_t index)
 Removes the term at the given index. More...
 
virtual std::size_t numberOfTerms () const
 Gets the number of terms added to the variable. More...
 
virtual void setTerms (const std::vector< Term *> &terms)
 Sets the terms of the variable. More...
 
virtual const std::vector< Term * > & terms () const
 Gets an immutable vector of the terms. More...
 
virtual std::vector< Term * > & terms ()
 Gets a mutable vector of the terms. More...
 

Additional Inherited Members

- Public Types inherited from fl::Variable
enum  Type { None, Input, Output }
 Indicates the type of the variable to avoid costly dynamic_casts More...
 
- Protected Attributes inherited from fl::Variable
std::string _name
 
std::string _description
 
std::vector< Term * > _terms
 
scalar _value
 
scalar _minimum
 
scalar _maximum
 
bool _enabled
 
bool _lockValueInRange
 

Detailed Description

The OutputVariable class is a Variable that represents an output of the fuzzy logic controller.

During the activation of a RuleBlock, the Activated terms of each Rule will be Aggregated in the OutputVariable::fuzzyOutput(), which represents a fuzzy set hereinafter referred to as \(\tilde{y}\). The defuzzification of \(\tilde{y}\) translates the fuzzy output value \(\tilde{y}\) into a crisp output value \(y\), which can be retrieved using Variable::getValue(). The value of the OutputVariable is computed and automatically stored when calling OutputVariable::defuzzify(), but the value depends on the following properties (expressed in the FuzzyLite Language):

Author
Juan Rada-Vilela, Ph.D.
See also
Variable
InputVariable
RuleBlock::activate()
Term
Since
4.0

Definition at line 85 of file OutputVariable.h.

Constructor & Destructor Documentation

◆ OutputVariable() [1/2]

fl::OutputVariable::OutputVariable ( const std::string &  name = "",
scalar  minimum = -fl::inf,
scalar  maximum = fl::inf 
)
explicit

◆ OutputVariable() [2/2]

fl::OutputVariable::OutputVariable ( const OutputVariable other)
explicit

◆ ~OutputVariable()

virtual fl::OutputVariable::~OutputVariable ( )
virtual

Member Function Documentation

◆ clear()

virtual void fl::OutputVariable::clear ( )
virtual

Clears the output variable by setting \(\tilde{y}=\{\}\), \(y^{t}=\mbox{NaN}\), \(y^{t-1}=\mbox{NaN}\).

◆ clone()

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

Creates a clone of the variable.

Returns
a clone of the variable

Reimplemented from fl::Variable.

◆ complexity()

virtual Complexity fl::OutputVariable::complexity ( const Activated term) const
virtual

Computes the estimated complexity of defuzzifying the activated term with the current configuration of the variable (namely aggregation and defuzzifier.

Parameters
termis the activated term
Returns
the estimated complexity of defuzzifying the activated term with the current configuration of the variable

◆ complexityOfDefuzzification()

virtual Complexity fl::OutputVariable::complexityOfDefuzzification ( ) const
virtual

Computes the estimated complexity of aggregating and defuzzifying all the terms in the variable.

Returns
the estimated complexity of aggregating and defuzzifying all the terms in the variable.

◆ currentComplexity()

virtual Complexity fl::OutputVariable::currentComplexity ( ) const
virtual

Computes the estimated complexity of aggregating and defuzzifying the terms currently found in the fuzzy output variable.

Returns
the estimated complexity of aggregating and defuzzifying the terms currently found in the fuzzy output variable

◆ defuzzify()

virtual void fl::OutputVariable::defuzzify ( )
virtual

Defuzzifies the output variable and stores the output value and the previous output value.

◆ fuzzyOutput()

virtual Aggregated* fl::OutputVariable::fuzzyOutput ( ) const
virtual

Gets the fuzzy output value \(\tilde{y}\).

Returns
the fuzzy output value \(\tilde{y}\)

◆ fuzzyOutputValue()

virtual std::string fl::OutputVariable::fuzzyOutputValue ( ) const
virtual

Gets a string representation of the fuzzy output value \(\tilde{y}\).

Returns
a string representation of the fuzzy output value \(\tilde{y}\)

◆ getAggregation()

virtual SNorm* fl::OutputVariable::getAggregation ( ) const
virtual

Gets the aggregation operator.

Returns
the aggregation operator

◆ getDefaultValue()

virtual scalar fl::OutputVariable::getDefaultValue ( ) const
virtual

Gets the default value of the output variable.

Returns
the default value of the output variable

◆ getDefuzzifier()

virtual Defuzzifier* fl::OutputVariable::getDefuzzifier ( ) const
virtual

Gets the defuzzifier of the output variable.

Returns
the defuzzifier of the output variable

◆ getPreviousValue()

virtual scalar fl::OutputVariable::getPreviousValue ( ) const
virtual

Gets the previous value of the output variable.

Returns
the previous value of the output variable

◆ isLockPreviousValue()

virtual bool fl::OutputVariable::isLockPreviousValue ( ) const
virtual

Gets whether to lock the previous value of the output variable.

Returns
whether the previous output value of the output variable is locked

◆ operator=()

OutputVariable& fl::OutputVariable::operator= ( const OutputVariable other)

◆ setAggregation()

virtual void fl::OutputVariable::setAggregation ( SNorm aggregation)
virtual

Sets the aggregation operator.

Parameters
aggregationis the aggregation

◆ setDefaultValue()

virtual void fl::OutputVariable::setDefaultValue ( scalar  defaultValue)
virtual

Sets the default value of the output variable.

Parameters
defaultValueis the default value of the output variable

◆ setDefuzzifier()

virtual void fl::OutputVariable::setDefuzzifier ( Defuzzifier defuzzifier)
virtual

Sets the defuzzifier of the output variable.

Parameters
defuzzifieris the defuzzifier of the output variable

◆ setLockPreviousValue()

virtual void fl::OutputVariable::setLockPreviousValue ( bool  lockPreviousValue)
virtual

Sets whether to lock the previous value of the output variable.

Parameters
lockPreviousValueindicates whether to lock the previous value of the output variable

◆ setMaximum()

virtual void fl::OutputVariable::setMaximum ( scalar  maximum)
virtual

Sets the maximum value of the range of the variable.

Parameters
maximumis the maximum value of the range

Reimplemented from fl::Variable.

◆ setMinimum()

virtual void fl::OutputVariable::setMinimum ( scalar  minimum)
virtual

Sets the minimum value of the range of the variable.

Parameters
minimumis the minimum value of the range

Reimplemented from fl::Variable.

◆ setName()

virtual void fl::OutputVariable::setName ( const std::string &  name)
virtual

Sets the name of the variable.

Parameters
nameis the name of the variable

Reimplemented from fl::Variable.

◆ setPreviousValue()

virtual void fl::OutputVariable::setPreviousValue ( scalar  previousValue)
virtual

Sets the previous value of the output variable.

Parameters
previousValueis the previous value of the output variable

◆ toString()

virtual std::string fl::OutputVariable::toString ( ) const
virtual

Gets a string representation of the variable in the FuzzyLite Language.

Returns
a string representation of the variable in the FuzzyLite Language
See also
FllExporter

Reimplemented from fl::Variable.

◆ type()

virtual Variable::Type fl::OutputVariable::type ( ) const
virtual

Returns the type of the variable.

Returns
the type of the variable

Reimplemented from fl::Variable.


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