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

The InputVariable class is a Variable that represents an input of the fuzzy logic controller. More...

#include <InputVariable.h>

Inheritance diagram for fl::InputVariable:
Collaboration diagram for fl::InputVariable:

Public Member Functions

 InputVariable (const std::string &name="", scalar minimum=-fl::inf, scalar maximum=fl::inf)
 
virtual ~InputVariable () FL_IOVERRIDE
 
virtual std::string fuzzyInputValue () const
 Evaluates the membership function of the current input value \(x\) for each term \(i\), resulting in a fuzzy input value in the form \(\tilde{x}=\sum_i{\mu_i(x)/i}\). 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 InputVariableclone () 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 void setName (const std::string &name)
 Sets the name of the variable. More...
 
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 void setMinimum (scalar minimum)
 Sets the minimum value of the range of the variable. More...
 
virtual scalar getMinimum () const
 Gets the minimum value of the range of the variable. More...
 
virtual void setMaximum (scalar maximum)
 Sets the maximum 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 InputVariable class is a Variable that represents an input of the fuzzy logic controller.

Author
Juan Rada-Vilela, Ph.D.
See also
Variable
OutputVariable
Term
Since
4.0

Definition at line 34 of file InputVariable.h.

Constructor & Destructor Documentation

◆ InputVariable()

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

◆ ~InputVariable()

virtual fl::InputVariable::~InputVariable ( )
virtual

Member Function Documentation

◆ clone()

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

Creates a clone of the variable.

Returns
a clone of the variable

Reimplemented from fl::Variable.

◆ fuzzyInputValue()

virtual std::string fl::InputVariable::fuzzyInputValue ( ) const
virtual

Evaluates the membership function of the current input value \(x\) for each term \(i\), resulting in a fuzzy input value in the form \(\tilde{x}=\sum_i{\mu_i(x)/i}\).

This is equivalent to a call to Variable::fuzzify() passing \(x\) as input value

Returns
the fuzzy input value expressed as \(\sum_i{\mu_i(x)/i}\)

◆ toString()

virtual std::string fl::InputVariable::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::InputVariable::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: