FuzzyLite Language

The FuzzyLite Language fll is a new format designed to describe fuzzy logic controllers. It is simpler and better than most state-of-the-art formats such as the Fuzzy Control Language fcl and the Fuzzy Inference System fis. Furthermore, it provides additional functionality that is not available in the standards of fcl and fis. The FuzzyLite Language is the preferred format to save and load your fuzzy logic controllers using QtFuzzyLite.

The format of an Engine expressed in fll is the following.

Definition Example
#Comment: indent="  ", separator="\n"  
Engine: string
InputVariable: identifier
  enabled: boolean
  range: scalar scalar
  term: identifier Term [parameters]
OutputVariable: identifier
  enabled: boolean
  range: scalar scalar
  accumulation: SNorm|none
  defuzzifier: [Defuzzifier [parameter]]|none
  default: scalar
  #lock-valid: boolean #Deprecated. Use:
  lock-previous: boolean
  lock-range: boolean
  term: identifier Term [parameters]
RuleBlock: string
  enabled: boolean
  conjunction: TNorm|none
  disjunction: SNorm|none
  activation: TNorm|none
  rule: if antecedent then consequent
#from examples/mamdani/SimpleDimmer.fll"  
Engine: simple-dimmer
InputVariable: Ambient
  enabled: true
  range: 0.000 1.000
  term: DARK Triangle 0.000 0.250 0.500
  term: MEDIUM Triangle 0.250 0.500 0.750
  term: BRIGHT Triangle 0.500 0.750 1.000
OutputVariable: Power
  enabled: true
  range: 0.000 1.000
  accumulation: Maximum
  defuzzifier: Centroid 200
  default: nan
  #lock-valid: false
  lock-previous: false
  lock-range: false
  term: LOW Triangle 0.000 0.250 0.500
  term: MEDIUM Triangle 0.250 0.500 0.750
  term: HIGH Triangle 0.500 0.750 1.000
RuleBlock: 
  enabled: true
  conjunction: none
  disjunction: none
  activation: Minimum
  rule: if Ambient is DARK then Power is HIGH
  rule: if Ambient is MEDIUM then Power is MEDIUM
  rule: if Ambient is BRIGHT then Power is LOW

Comments start with # at any location. Indentation is not mandatory and does not provide any additional information. The statements are separated by line breaks \n. However, the fll format is flexible and both indentation and separator can be changed. For example, for indentation   and separator ;, the engine is expressed in a single line separated by semicolons, but then comments would only make sense at the end of the line.

The elements in fll are described as follows.

Element Description
Blocks
Engine: Keyword to indicate start of Engine
InputVariable: Keyword to indicate start of InputVariable
OutputVariable: Keyword to indicate start of OutputVariable
RuleBlock: Keyword to indicate start of RuleBlock
Properties
enabled: property to determine whether the input|output variable or rule block is enabled during Engine::process()
range: property to define the range of the input|output variable
term: property to add a term to the input|output variable
accumulation: property to define the S-Norm which accumulates the modified consequents of an output variable
defuzzifier: property to define the defuzzification method over the accumulated modified consequents
default: when the output variable is disabled or no rules are activated, the property determines the output value from the defuzzification of the variable
lock-previous:
lock-valid
when the output variable is disabled or no rules are activated, the property determines whether the output value obtained from the defuzzification of the variable is a valid output value from a previous defuzzification or else the value given by default property
lock-range: property to make the output values from any defuzzification of a variable always lie within the range of the variable
conjunction: property to define the T-Norm of conjunction used by the fuzzy logic operator and in the antecedent of a rule
disjunction: property to define the S-Norm of disjunction used by the fuzzy logic operator or in the antecedent of a rule
activation: property to define the T-Norm used to modify the consequents of a rule after its activation
rule: property to add a rule to the rule block
Types
string Any string of characters, possibly empty
identifier A non-empty string of characters that uniquely identifies the block with the following characters A-Z a-z _ .
boolean Accepts true or false
scalar A floating-point number or nan inf -inf (i.e. not-a-number, positive infinity and negative infinity, respectively)
none Some properties support a value none to leave the property empty
parameter A single parameter value
parameters Multiple parameter values separated by whitespaces
Term Name of a class that implements Term and is registered in the TermFactory of FactoryManager
TNorm Name of a class that implements TNorm and is registered in the TNormFactory of FactoryManager
SNorm Name of a class that implements SNorm and is registered in the SNormFactory of FactoryManager
Defuzzifier Name of a class that implements Defuzzifier and is registered in the DefuzzifierFactory of FactoryManager
antecedent ‘variable is [hedge] term [and|or variable is [hedge] term]‘, where elements in bold are rule keywords, within [brackets] are optional, and -marked may appear zero or more times
consequent ‘variable is [hedge] term [and variable is [hedge] term] [with scalar]?‘, where elements in bold are rule keywords, within [brackets] are optional, -marked may appear zero or more times, and ?-marked may appear once or not at all

FuzzyLite Dataset

The FuzzyLite Dataset fld is a format that describes the operation of a fuzzy logic controller according to its inputs and outputs. The format of the operation of an Engine expressed in fld is as follows, where a single white space is the basic unit of separation.

inputVariable1 inputVariable2 ... inputVariableP outputVariable1 outputVariable2 ... outputVariableQ #Variable names
inputValue1a inputValue2a ... inputValuePa outputValue1a outputValue2a ... outputValueQa #Variable values
.
.
.
inputValue1z inputValue2z ... inputValuePz outputValue1z outputValue2z ... outputValueQz #Variable values