Fuzzy Logic Tools
v1.0.5.1
|
This class contains methods and attributes common to fuzzy Rules. More...
#include <rule.hpp>
Public Member Functions | |
size_t | n_inputs (void) const |
Extract the number of inputs of the Rule. | |
int | test (void) const |
This function checks the parameters of all Membership functions in the Rule, and corrects them if possible. More... | |
int | changeTSK (double value, size_t input) |
Changes a parameter in the TSK consequent. More... | |
void | changeTSK (const double *const TSK) |
Changes the TSK consequent. | |
double | readTSK (size_t input) const |
Reads a TSK parameter. More... | |
TNT::Array1D< double > | readTSK (void) const |
Reads the TSK consequent. | |
Membership * | readFunction (size_t input) |
Extracts a pointer to a Membership function. More... | |
int | changeFunction (const Membership &P, size_t input) |
Changes a Membership function of the Rule. More... | |
int | changeFunction (TYPE_MF type, size_t input) |
Changes the type af a Membership function. More... | |
void | initialize (size_t in) |
Initializes the Rule for in inputs. More... | |
size_t | NumberOfAntecedents (void) |
Gets the number of parameters stored in the antecedents of the Rule. More... | |
int | setAntecedents (const double *const parameters) |
Sets the parameters of the antecedents of the Rule. More... | |
TNT::Array1D< double > | getAntecedents (void) |
Gets the parameters of the antecedents of the Rule. | |
void | setConsequents (const double *const parameters) |
Sets the consequents of the Rule. | |
TNT::Array1D< double > | getConsequents (void) |
Gets the consequents of the Rule. | |
double | activation (const double *const point, double *dW=NULL) const |
Calculates the matching degree of the rule in point and, optionally, its derivative. More... | |
Rule & | operator= (const Rule &R) |
Rule (const Rule &R) | |
Rule (size_t in) | |
Private Member Functions | |
void | clean (void) |
Cleans the dynamic memory. | |
Private Attributes | |
size_t | in |
Number of inputs of the Rule. | |
double * | TSK |
TSK consequent of the Rule. | |
Membership ** | membership |
Membership functions of the Rule. | |
This class contains methods and attributes common to fuzzy Rules.
This class stores a completely general Takagi-Sugeno Rule.
double Rule::activation | ( | const double *const | point, |
double * | dW = NULL |
||
) | const |
Calculates the matching degree of the rule in point
and, optionally, its derivative.
Optionally, this function also calculates the derivative of the degree of activation of the rule with respect to the input at point
.
dW represents , and its length is equal to the number of entries in the rule.
The length of point
must match the number of inputs in the rule.
int Rule::changeFunction | ( | const Membership & | P, |
size_t | input | ||
) |
Changes a Membership function of the Rule.
int Rule::changeFunction | ( | TYPE_MF | type, |
size_t | input | ||
) |
Changes the type af a Membership function.
input
is greater than the number of Rule inputs (2).int Rule::changeTSK | ( | double | value, |
size_t | input | ||
) |
Changes a parameter in the TSK consequent.
void Rule::initialize | ( | size_t | in | ) |
Initializes the Rule for in
inputs.
Empty membership functions are used. You can change them with changeFunction
method or using the Membership class methods.
size_t Rule::NumberOfAntecedents | ( | void | ) |
Gets the number of parameters stored in the antecedents of the Rule.
NumberOfConsequents(void)
is not necessary because this value is in+1
. Membership * Rule::readFunction | ( | size_t | input | ) |
Extracts a pointer to a Membership function.
double Rule::readTSK | ( | size_t | input | ) | const |
Reads a TSK parameter.
input
is greater than the number of Rule inputs, an error is sent to the standard error stream and return 0. int Rule::setAntecedents | ( | const double *const | parameters | ) |
Sets the parameters of the antecedents of the Rule.
int Rule::test | ( | void | ) | const |
This function checks the parameters of all Membership functions in the Rule, and corrects them if possible.