The Rule class is a conditional statement that contributes to the control of an Engine. More...
#include <Rule.h>
| Public Member Functions | |
| Rule (const std::string &text="", scalar weight=1.0) | |
| Rule (const Rule &other) | |
| Rule & | operator= (const Rule &other) | 
| virtual | ~Rule () | 
| virtual void | setEnabled (bool enabled) | 
| Sets whether the rule is enabled.  More... | |
| virtual bool | isEnabled () const | 
| Gets whether the rule is enabled.  More... | |
| virtual void | setText (const std::string &text) | 
| Sets the text of the rule.  More... | |
| virtual std::string | getText () const | 
| Gets the text of the rule.  More... | |
| virtual void | setWeight (scalar weight) | 
| Sets the weight of the rule.  More... | |
| virtual scalar | getWeight () const | 
| Gets the weight of the rule.  More... | |
| virtual void | setAntecedent (Antecedent *antecedent) | 
| Sets the antecedent of the rule.  More... | |
| virtual Antecedent * | getAntecedent () const | 
| Gets the antecedent of the rule.  More... | |
| virtual void | setConsequent (Consequent *consequent) | 
| Sets the consequent of the rule.  More... | |
| virtual Consequent * | getConsequent () const | 
| Gets the consequent of the rule.  More... | |
| virtual void | setActivationDegree (scalar activationDegree) | 
| Sets the activation degree of the rule.  More... | |
| virtual scalar | getActivationDegree () const | 
| Gets the activation degree of the rule.  More... | |
| virtual scalar | activateWith (const TNorm *conjunction, const SNorm *disjunction) | 
| Activates the rule by computing its activation degree using the given conjunction and disjunction operators.  More... | |
| virtual void | deactivate () | 
| Deactivates the rule.  More... | |
| virtual void | trigger (const TNorm *implication) | 
| Triggers the rule's implication (if the rule is enabled) using the given implication operator and the underlying activation degree.  More... | |
| virtual bool | isTriggered () const | 
| Indicates whether the rule's implication was triggered.  More... | |
| virtual std::string | toString () const | 
| Returns a string representation of the rule in the FuzzyLite Language.  More... | |
| virtual bool | isLoaded () const | 
| Indicates whether the rule is loaded.  More... | |
| virtual void | unload () | 
| Unloads the rule.  More... | |
| virtual void | load (const Engine *engine) | 
| Loads the rule with the text from Rule::getText(), and uses the engine to identify and retrieve references to the input variables and output variables as required.  More... | |
| virtual void | load (const std::string &rule, const Engine *engine) | 
| Loads the rule with the given text, and uses the engine to identify and retrieve references to the input variables and output variables as required.  More... | |
| virtual Rule * | clone () const | 
| Creates a clone of the rule without the rule being loaded.  More... | |
| virtual Complexity | complexityOfActivation (const TNorm *conjunction, const SNorm *disjunction) const | 
| Computes the estimated complexity of calculating the activation degree of the rule.  More... | |
| virtual Complexity | complexityOfFiring (const TNorm *implication) const | 
| Computes the estimated complexity of firing the rule.  More... | |
| virtual Complexity | complexity (const TNorm *conjunction, const SNorm *disjunction, const TNorm *implication) const | 
| Returns the estimated complexity of activating and firing the rule.  More... | |
| Static Public Member Functions | |
| static Rule * | parse (const std::string &rule, const Engine *engine) | 
| Parses and creates a new rule based on the text passed.  More... | |
| static std::string | ifKeyword () | 
| Returns a string representation of the ifkeyword in rules.  More... | |
| static std::string | isKeyword () | 
| Returns a string representation of the iskeyword in rules.  More... | |
| static std::string | thenKeyword () | 
| Returns a string representation of the thenkeyword in rules.  More... | |
| static std::string | andKeyword () | 
| Returns a string representation of the andkeyword in rules.  More... | |
| static std::string | orKeyword () | 
| Returns a string representation of the orkeyword in rules.  More... | |
| static std::string | withKeyword () | 
| Returns a string representation of the withkeyword in rules.  More... | |
The Rule class is a conditional statement that contributes to the control of an Engine.
Each rule consists of an Antecedent and a Consequent, each of which comprises propositions in the form variable is term. The propositions in the Antecedent can be connected by the conjunctive and or the disjunctive or, both of which are fuzzy logic operators (TNorm and SNorm, respectively). Differently, the propositions in the Consequent are independent from each other and are separated with a symbolic and. The Term in any proposition can be preceded by a Hedge that modifies its membership function to model cases such as Very, Somewhat, Seldom and Not. Additionally, the contribution of a rule to the control of the engine can be determined by its weight \(w \in [0.0, 1.0]\), which is equal to 1.0 if omitted. The structure of a rule is the following: if (antecedent) then (consequent) [with weight]. The structures of the antecedent and the consequent are:
if variable is [hedge]* term [(and|or) variable is [hedge]* term]*
then variable is [hedge]* term [and variable is [hedge]* term]* [with w]?
where elements in brackets are optional, elements in parentheses are compulsory, *-marked elements may appear zero or more times, and ?-marked elements may appear once or not at all.
| 
 | explicit | 
| fl::Rule::Rule | ( | const Rule & | other | ) | 
| 
 | virtual | 
| 
 | virtual | 
Activates the rule by computing its activation degree using the given conjunction and disjunction operators.
| conjunction | is the conjunction operator | 
| disjunction | is the disjunction operator | 
| 
 | inlinestatic | 
| 
 | virtual | 
Creates a clone of the rule without the rule being loaded.
| 
 | virtual | 
Returns the estimated complexity of activating and firing the rule.
| conjunction | is the conjunction operator | 
| disjunction | is the disjunction operator | 
| implication | is the implication operator | 
| 
 | virtual | 
Computes the estimated complexity of calculating the activation degree of the rule.
| conjunction | is the conjunction operator | 
| disjunction | is the disjunction operator | 
| 
 | virtual | 
Computes the estimated complexity of firing the rule.
| implication | is the implication operator | 
| 
 | virtual | 
Deactivates the rule.
| 
 | virtual | 
Gets the activation degree of the rule.
| 
 | virtual | 
Gets the antecedent of the rule.
| 
 | virtual | 
Gets the consequent of the rule.
| 
 | virtual | 
Gets the text of the rule.
| 
 | virtual | 
Gets the weight of the rule.
| 
 | inlinestatic | 
| 
 | virtual | 
Gets whether the rule is enabled.
An enabled rule will be fired, whereas a disabled rule will not.
| 
 | inlinestatic | 
| 
 | virtual | 
Indicates whether the rule is loaded.
| 
 | virtual | 
Indicates whether the rule's implication was triggered.
| 
 | virtual | 
Loads the rule with the text from Rule::getText(), and uses the engine to identify and retrieve references to the input variables and output variables as required.
| engine | is the engine from which the rule is part of | 
| 
 | virtual | 
Loads the rule with the given text, and uses the engine to identify and retrieve references to the input variables and output variables as required.
| rule | is the rule in text | 
| engine | is the engine from which the rule is part of | 
| 
 | inlinestatic | 
Parses and creates a new rule based on the text passed.
| rule | is the rule in text | 
| engine | is the engine from which the rule is part of | 
| 
 | virtual | 
Sets the activation degree of the rule.
| activationDegree | is the activation degree of the rule | 
| 
 | virtual | 
Sets the antecedent of the rule.
| antecedent | is the antecedent of the rule | 
| 
 | virtual | 
Sets the consequent of the rule.
| consequent | the consequent of the rule | 
| 
 | virtual | 
Sets whether the rule is enabled.
An enabled rule will be fired, whereas a disabled rule will not.
| enabled | determines whether the rule is enabled | 
| 
 | virtual | 
Sets the text of the rule.
| text | is the text of the rule | 
| 
 | virtual | 
Sets the weight of the rule.
| weight | is the weight of the rule | 
| 
 | inlinestatic | 
| 
 | virtual | 
Returns a string representation of the rule in the FuzzyLite Language.
| 
 | virtual | 
Triggers the rule's implication (if the rule is enabled) using the given implication operator and the underlying activation degree.
| implication | is the implication operator | 
| 
 | virtual | 
Unloads the rule.
| 
 | inlinestatic |