This section contains detailed information on the syntax of fuzzy rule language statements. Rule language statements may be entered into a file using any text editor, or you may use the special fuzzy ruleset editor for the purpose.
rule1: if Temp is very Hot then Pressure is High rule2: if Temp is very Hot then Pressure is High
: a = b // Unlabeled rule rule4a: c = d // Labeled rule rule4b : e=f // Labeled rule rule4b : f=g // causes parser exception: rule label already used!
rule7a: if boolVar = true // is valid syntax rule7b: if true = boolVar // causes parser exception!
rule5: boolVar = true // is valid syntax rule6: boolVar = True // is valid syntax rule7: boolVar = TRUE // is valid syntax rule8: boolVar = tRuE // is valid syntax
rule6a: numVar = 0.9 // is valid syntax rule6b: numVar = .9 // causes parser exception!
Pressure continuous(-100 to +100) .... rule01: Pressure = 100 // is valid rule02: Pressure = 1000 // causes exception: 1000 not between -100 and 100!
BondRating symbolic(A AA AAA) OtherRating symbolic(ABC DEF) rule01: BondRating = AA // is valid rule02: BondRating = ABC // causes parser exception: ABC not defined for BondRating
Temperature numeric(98.6) // Declare numeric variable SystemId numeric(0) // Declare numeric variable Sensors(getTemp) // Declare sensor sensorRule1 : Temperature = getTemp(SystemId) // is valid sensorRule2 : Temperature = getTemp(1) // causes parser exception!
sensorRule3 : Temperature = getTemp(SystemId) // may or may not be // valid depending on the number of // arguments expected by the method // represented by the sensor getTemp.
!= | not equal to; synonym of <> |
<> | not equal to; synonym of != |
Is | fuzzy assignment or comparison, depending on context; may be used only between a Continuous variable reference and a fuzzy set reference belonging to the same variable; a list of hedges may precede the set reference; case insensitive. |
Assertions are simply assignment statements. Since the inference engine evaluates all assertions before evaluating any conditional rules, you can use assertions to give initial values to variables. This is not very practical and therefore not recommended; you should assign initial values through an external input buffer (and these always take precedence over any assertions).
There are two exceptions to using assertions:
<ruleLabel> : booleanVariable = { booleanVariable | booleanLiteral | sensorName(<arg>*) } <ruleLabel> : numericVariable = { numericVariable | numericLiteral | sensorName(<arg>*) } <ruleLabel> : symbolicVariable = { <symbol> | sensorName(<arg>*) } <ruleLabel> : continuousVariable = { numericLiteral | sensorName(<arg>*) } <ruleLabel> : continuousVariable Is <hedge>* setNameReturn to top
Conditional, or IF-THEN, rules are evaluated conditionally, based on known data. The order of evaluation is determined by the inference engine, but if your ruleset is a pure fuzzy ruleset, all rules are essentially evaluated in parallel, each rule playing a part in the solution.
rule8: if male = true[0.5] and testScore is low then insuranceRisk is increased
Note that weights must be enclosed in square brackets ( [ and ] ).
<ruleLabel> : IF | = | booleanVariable | <> | { booleanVariable | booleanLiteral | sensorName(<arg>*) } [<[weight]>] AND | != | | = | | < | | <= | numericVariable | > | { numericVariable | numericLiteral | sensorName(<arg>*) } [<[weight]>] AND | >= | | <> | | != | | = | symbolicVariable | <> | { <symbol> | sensorName(<arg>*) } [<[weight]>] AND | != | | = | | < | | <= | continuousVariable | > | { numericVariable | numericLiteral | sensorName(<arg>*) } [<[weight]>] AND | >= | | <> | | != | continuousVariable Is <hedge>* setName THEN --- | | booleanVariable = { booleanVariable | booleanLiteral | effectorName(<arg>*) } | numericVariable = { numericVariable | numericLiteral | effectorName(<arg>*) } | symbolicVariable = { <symbol> | effectorName(<arg>*) } | continuousVariable = { numericLiteral | effectorName(<arg>*) } | continuousVariable Is <hedge>* setName | ---Return to top
The following hedges are available for qualifying a fuzzy set in a fuzzy clause. Multiple hedges may be used in any combination, but the rule author must be fully aware of what each hedge can do to the shape of a fuzzy set.
Approximation Hedges -- useful for all bell-shaped sets | |
CloseTo (1.2) | Narrow approximation. |
About (2.0) | General approximation; slightly broadens the fuzzy region |
InVicinityOf (4.0) | Broad approximation; produces a very wide fuzzy space. |
Restriction Hedges | ||
Above | Useful for decreasing linear and sigmoidal sets and for all bell-shaped sets; do not use with increasing linear and sigmoidal sets. | ![]() |
Below | Useful for increasing linear and sigmoidal sets and for all bell-shaped sets; do not use with decreasing linear and sigmoidal sets. | ![]() |
Concentration Hedges -- these hedges depress the surface of linear sets and concentrate or intensify bell-shaped sets; the candidate space is reduced; a domain element must occur farther to the right for an equivalent truth value. | ||
Very (2.0) | ![]() |
|
Extremely (3.0) | ![]() |
Dilution Hedges -- these hedges raise the surface of linear sets and dilute bell-shaped sets; the candidate space is increased; a domain element must occur farther to the left for an equivalent truth value. | ||
Somewhat (0.5) | Complement of very. | ![]() |
Slightly (0.3) | ![]() |
Contrast Intensification Hedge | ||
Positively (n2) | Truth values less than .5 are decreased, truth values greater than .5 are increased; complement of generally. | ![]() |
Contrast Diffusion Hedge | ||
Generally (n0.5) | Truth values less than .5 are increased, truth values greater than .5 are decreased; complement of positively. | ![]() |
Negation Hedge | ||
Not | The fuzzy region is inversed. | ![]() |