Java Classes
- A fuzzy inference system (FIS) is composed by one or more FuncionBlock class, like in FCL. E.g.:
FUNCTION_BLOCK functionBlock1 ... END_FUNCTION_BLOCK FUNCTION_BLOCK functionBlock2 ... END_FUNCTION_BLOCK
- Each FuncionBlock is composed by one or more RuleBlock class and some Variables, as well as Fuzzyfiers and Defuzzifiers. Again, like in FCL, e.g.:
FUNCTION_BLOCK functionBlockName VAR_INPUT ... END_VAR VAR_OUTPUT ... END_VAR FUZZIFY inputVariable ... END_FUZZIFY DEFUZZIFY outputVariable ... END_DEFUZZIFY RULEBLOCK No1 ... END_RULEBLOCK END_FUNCTION_BLOCK
- Each Rule class is composed by an antecedent (IF part) and a consequent (THEN part), e.g.:
RULE 1 : IF service IS poor OR food IS rancid THEN tip IS cheap;
- Antecedent: "service IS poor OR food IS rancid"
- Consequent: "tip IS cheap". Note that there may be more than one consequent.
- A rule implication (or activation) method can be defined (althought FCL does not allow different implication method for each rule, it can be defined at RULEBLOCK level).
e.g.:
ACT : MIN; // Use 'min' activation method
- Consequents are a 'collection' of RuleTerms classes (e.g. "tip IS cheap" is a RuleTerm)
- An Antecedent is represented by a RuleExpression class. A RuleExpression is just two terms connected by one RuleConnectionMethod (rule conectors are 'AND', 'OR' and 'NOT')
e.g.:service IS poor OR food IS rancid
- First term: "service IS poor"
- Second term: "food IS rancid"
- RuleConnectionMethod is 'OR'
- Each RuleTerm is defined by a Variable and a LinguisticTermName.
e.g.:
service IS poor - Variable: service
- LinguisticTermName: 'poor'
- Connector: 'IS'
service IS NOT excellent
- Each Variable has a name and some LinguisticTerms
e.g.: For an input variable:
FUZZIFY service // Fuzzify input variable 'service': {'poor', 'good' , 'excellent'} TERM poor := (0, 1) (4, 0) ; TERM good := (1, 0) (4,1) (6,1) (9,0); TERM excellent := (6, 0) (9, 1); END_FUZZIFY
e.g.: For an output variable:
As you can see, for an output variable you need to specify an accumulation (or RuleAgrregationMethod) and a Defuzzifier. e.g.:DEFUZZIFY tip // Defzzzify output variable 'tip' : {'cheap', 'average', 'generous' } TERM cheap := (0,0) (5,1) (10,0); TERM average := (10,0) (15,1) (20,0); TERM generous := (20,0) (25,1) (30,0); METHOD : COG; // Use 'Center Of Gravity' defuzzification method DEFAULT := 0; // Default value is 0 (if no rule activates defuzzifier) END_DEFUZZIFY
ACCU : MAX; // Use 'max' accumulation method METHOD : COG; // Use 'Center Of Gravity' defuzzification method
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -