The Variable class is the base class for linguistic variables. More...
#include <Variable.h>
Public Types | |
enum | Type { None, Input, Output } |
Indicates the type of the variable to avoid costly dynamic_casts More... | |
Public Member Functions | |
Variable (const std::string &name="", scalar minimum=-fl::inf, scalar maximum=fl::inf) | |
Variable (const Variable &other) | |
Variable & | operator= (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 Term * | highestMembership (scalar x, scalar *yhighest=fl::null) const |
Gets the term which has the highest membership function value for \(x\). More... | |
virtual Type | type () const |
Returns the type of the variable. More... | |
virtual std::string | toString () const |
Gets a string representation of the variable in the FuzzyLite Language. 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 Term * | getTerm (std::size_t index) const |
Gets the term at the given index. More... | |
virtual Term * | getTerm (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 Term * | removeTerm (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... | |
virtual Variable * | clone () const |
Creates a clone of the variable. More... | |
Protected Attributes | |
std::string | _name |
std::string | _description |
std::vector< Term * > | _terms |
scalar | _value |
scalar | _minimum |
scalar | _maximum |
bool | _enabled |
bool | _lockValueInRange |
The Variable class is the base class for linguistic variables.
Definition at line 39 of file Variable.h.
enum fl::Variable::Type |
Indicates the type of the variable to avoid costly dynamic_casts
Enumerator | |
---|---|
None | |
Input | |
Output |
Definition at line 45 of file Variable.h.
|
explicit |
|
explicit |
|
virtual |
|
virtual |
Adds a term to the variable.
term | is the term to add |
|
virtual |
Creates a clone of the variable.
Reimplemented in fl::OutputVariable, and fl::InputVariable.
|
virtual |
Computes the aggregated complexity of the underlying terms.
|
virtual |
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}\).
x | is the value to fuzzify |
|
virtual |
Gets the description of the variable.
|
virtual |
Gets the maximum value of the range of the variable.
|
virtual |
Gets the minimum value of the range of the variable.
|
virtual |
Gets the name of the variable.
|
virtual |
Gets the term at the given index.
index | is the position of the term in the vector |
|
virtual |
Gets the term of the given name.
name | is the name of the term to retrieve |
Exception | if the term is not found |
|
virtual |
Gets the value of the variable.
|
virtual |
Gets whether a term of the given name has been added.
name | the name of the term |
|
virtual |
Gets the term which has the highest membership function value for \(x\).
x | is the value of interest | |
[out] | yhighest | is a pointer where the highest membership function value will be stored |
|
virtual |
Inserts the term in the variable.
term | is the term to insert |
index | is the index where the term will be inserted |
|
virtual |
Gets whether the variable is enabled.
|
virtual |
Gets whether the variable locks the current value to the range of the variable.
If enabled in an InputVariable \(i\), the input value \(x_i\) will be used when computing the Antecedent::activationDegree() as long as \(x_i \in [\mbox{min}, \mbox{max}]\). Else, for the case of \(x_i \not\in [\mbox{min}, \mbox{max}]\), the range values will be used instead but without changing the input value \(x_i\).
If enabled in an OutputVariable \(j\), the output value \(y_j\) will be overriden by the range values when \(y_j \not\in [\mbox{min}, \mbox{max}]\). See OutputVariable for more information.
|
virtual |
Gets the number of terms added to the variable.
|
virtual |
Gets the magnitude of the range of the variable.
maximum - minimum
|
virtual |
Removes the term at the given index.
index | the index of the term to remove |
|
virtual |
Sets the description of the variable.
description | is the description of the variable |
|
virtual |
Sets whether the variable is enabled.
enabled | determines whether to enable the variable |
|
virtual |
Sets whether the variable locks the current value to the range of the variable.
If enabled in an InputVariable \(i\), the input value \(x_i\) will be used when computing the Antecedent::activationDegree() as long as \(x_i \in [\mbox{min}, \mbox{max}]\). Else, for the case of \(x_i \not\in [\mbox{min}, \mbox{max}]\), the range values will be used instead but without changing the input value \(x_i\).
If enabled in an OutputVariable \(j\), the output value \(y_j\) will be overriden by the range values when \(y_j \not\in [\mbox{min}, \mbox{max}]\). See OutputVariable for more information.
lockValueInRange | indicates whether to lock the value to the range of the variable |
|
virtual |
Sets the maximum value of the range of the variable.
maximum | is the maximum value of the range |
Reimplemented in fl::OutputVariable.
|
virtual |
Sets the minimum value of the range of the variable.
minimum | is the minimum value of the range |
Reimplemented in fl::OutputVariable.
|
virtual |
Sets the name of the variable.
name | is the name of the variable |
Reimplemented in fl::OutputVariable.
Sets the range of the variable between [minimum, maximum]
minimum | is the minimum value in range |
maximum | is the maximum value in range |
|
virtual |
Sets the terms of the variable.
terms | is a vector of terms |
|
virtual |
Sets the value of the variable.
value | is the input value of an InputVariable, or the output value of an OutputVariable |
|
virtual |
Sorts the terms in ascending order according to their centroids.
|
virtual |
Gets an immutable vector of the terms.
|
virtual |
Gets a mutable vector of the terms.
|
virtual |
Gets a string representation of the variable in the FuzzyLite Language.
Reimplemented in fl::OutputVariable, and fl::InputVariable.
|
virtual |
Returns the type of the variable.
Reimplemented in fl::OutputVariable, and fl::InputVariable.
|
protected |
Definition at line 52 of file Variable.h.
|
protected |
Definition at line 56 of file Variable.h.
|
protected |
Definition at line 57 of file Variable.h.
|
protected |
Definition at line 55 of file Variable.h.
|
protected |
Definition at line 55 of file Variable.h.
|
protected |
Definition at line 51 of file Variable.h.
|
protected |
Definition at line 53 of file Variable.h.
|
protected |
Definition at line 54 of file Variable.h.