jFuzzyLogic: Open Source Fuzzy Logic (Java)

Java Classes

How this package works and how classes are organized is briefly explained here.

  • 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'
    Note: Each term can be either a RuleTerm or a RuleExpression, this definition is recursive, so arbitrarly complex expressions can be created.

  • Each RuleTerm is defined by a Variable and a LinguisticTermName. e.g.:
    service IS poor
    • Variable: service
    • LinguisticTermName: 'poor'
    • Connector: 'IS'
    It can also be 'negated' e.g.:
    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:
    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
    
    As you can see, for an output variable you need to specify an accumulation (or RuleAgrregationMethod) and a Defuzzifier. e.g.:
        ACCU : MAX;            // Use 'max' accumulation method
        METHOD : COG;        // Use 'Center Of Gravity' defuzzification method
    

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Author: Pablo Cingolani (pcingola@users.sourceforge.net)
Key words (for search engines):
Fuzzy logic
Fuzzy logic software
Fuzzy logic package
Fuzzy logic library
Fuzzy logic sourceforge sf.net
Open source
GNU
GPL LGPL
java
Windows Linux OSX
FCL
IEC 1131
IEC 61131
IEC 61131 part 7
IEC 61131-7
Fuzzy logic Wikipedia