The Linear class is a linear polynomial Term expressed as \(f(x)= \mathbf{c}\mathbf{v}+k = \sum_i c_iv_i + k\), where variable \(x\) is not utilized, \(\mathbf{v}\) is a vector of values from the input variables, \(\mathbf{c}\) is a vector of coefficients, and \(k\) is a constant. More...
#include <Linear.h>
Public Member Functions | |
Linear (const std::string &name="", const std::vector< scalar > &coefficients=std::vector< scalar >(), const Engine *engine=fl::null) | |
virtual | ~Linear () FL_IOVERRIDE |
virtual std::string | className () const FL_IOVERRIDE |
Returns the name of the class of the term. More... | |
virtual std::string | parameters () const FL_IOVERRIDE |
Returns the vector \(\mathbf{c}^\star\). More... | |
virtual void | configure (const std::string ¶meters) FL_IOVERRIDE |
Configures the term with the values of \(\mathbf{c}^\star\). More... | |
virtual Complexity | complexity () const FL_IOVERRIDE |
Computes the estimated complexity of evaluating the membership function. More... | |
virtual scalar | membership (scalar x) const FL_IOVERRIDE |
Computes the linear function \(f(x)=\sum_i c_iv_i +k\), where \(v_i\) is the value of the input variable \(i\) registered in the Linear::getEngine() More... | |
virtual void | set (const std::vector< scalar > &coefficients, const Engine *engine) |
Sets the vector \(\mathbf{c}^\star\) and the Engine from which vector \(\mathbf{v}\) will be retrieved when necessary. More... | |
virtual void | setCoefficients (const std::vector< scalar > &coefficients) |
Sets the vector \(\mathbf{c}^\star\) of the linear function. More... | |
virtual const std::vector< scalar > & | coefficients () const |
Gets the immutable vector \(\mathbf{c}^\star\). More... | |
virtual std::vector< scalar > & | coefficients () |
Gets the mutable vector \(\mathbf{c}^\star\). More... | |
virtual void | setEngine (const Engine *engine) |
Sets the engine from which the vector \(\mathbf{v}\) will be obtained upon computing the Linear::membership() More... | |
virtual const Engine * | getEngine () const |
Gets the engine from which the vector \(\mathbf{v}\) will be obtained upon computing the Linear::membership() More... | |
virtual Linear * | clone () const FL_IOVERRIDE |
Creates a clone of the term. More... | |
virtual void | updateReference (const Engine *engine) FL_IOVERRIDE |
Updates the references (if any) to point to the current engine (useful when cloning engines or creating terms within Importer objects. More... | |
Public Member Functions inherited from fl::Term | |
Term (const std::string &name="", scalar height=1.0) | |
virtual | ~Term () |
virtual void | setName (const std::string &name) |
Sets the name of the term. More... | |
virtual std::string | getName () const |
Gets the name of the term. More... | |
virtual void | setHeight (scalar height) |
Sets the height of the term. More... | |
virtual scalar | getHeight () const |
Gets the height of the term. More... | |
virtual std::string | toString () const |
Returns the representation of the term in the FuzzyLite Language. More... | |
Static Public Member Functions | |
static Term * | constructor () |
template<typename T > | |
static Linear * | create (const std::string &name, const Engine *engine, T firstCoefficient,...) |
Creates a Linear term from a variadic set of coefficients. More... | |
Additional Inherited Members | |
Protected Attributes inherited from fl::Term | |
scalar | _height |
The Linear class is a linear polynomial Term expressed as \(f(x)= \mathbf{c}\mathbf{v}+k = \sum_i c_iv_i + k\), where variable \(x\) is not utilized, \(\mathbf{v}\) is a vector of values from the input variables, \(\mathbf{c}\) is a vector of coefficients, and \(k\) is a constant.
Hereinafter, the vector \(\mathbf{c}^\star=\{c_1, \ldots, c_i, \ldots, c_n, k\}\) refers to a vector containing the coefficients of \(\mathbf{c}\) and the constant \(k\).
|
explicit |
|
virtual |
|
virtual |
Returns the name of the class of the term.
Implements fl::Term.
|
virtual |
|
virtual |
Gets the immutable vector \(\mathbf{c}^\star\).
|
virtual |
Gets the mutable vector \(\mathbf{c}^\star\).
|
virtual |
Computes the estimated complexity of evaluating the membership function.
Implements fl::Term.
|
virtual |
Configures the term with the values of \(\mathbf{c}^\star\).
parameters | as "c1 ... ci ... cn k" |
Implements fl::Term.
|
static |
|
inlinestatic |
Creates a Linear term from a variadic set of coefficients.
Beware: this method is unsafe and must be used with care by ensuring:
int
(different from the others) and cause memory issues due to the difference in size between an int
and fl::scalar
; andname | is the name of the term |
engine | is the engine from which the vector \(\mathbf{v}\) will be obtained |
firstCoefficient | is the coefficient for the first input variable, namely \(c_1\) |
... | is a variadic number of coefficients whose type need to be the same as the first coefficient |
Definition at line 161 of file Linear.h.
References FL_AT.
|
virtual |
Gets the engine from which the vector \(\mathbf{v}\) will be obtained upon computing the Linear::membership()
Computes the linear function \(f(x)=\sum_i c_iv_i +k\), where \(v_i\) is the value of the input variable \(i\) registered in the Linear::getEngine()
x | is not utilized |
Implements fl::Term.
|
virtual |
|
virtual |
Sets the vector \(\mathbf{c}^\star\) and the Engine from which vector \(\mathbf{v}\) will be retrieved when necessary.
coefficients | is the vector \(\mathbf{c}^\star\) |
engine | is the engine from which \(\mathbf{v}\) will be retrieved when necessary |
|
virtual |
Sets the vector \(\mathbf{c}^\star\) of the linear function.
coefficients | is the vector \(\mathbf{c}^\star\) |
|
virtual |
Sets the engine from which the vector \(\mathbf{v}\) will be obtained upon computing the Linear::membership()
engine | is the engine from which the vector \(\mathbf{v}\) will be obtained |
|
virtual |