nxtfuzzylogic
Class NXTFuzzyLogic

java.lang.Object
  extended by nxtfuzzylogic.NXTFuzzyLogic

public class NXTFuzzyLogic
extends java.lang.Object

Class responsible for definition and execution of fuzzy logic controller.


Field Summary
static int BDIF
          AND operator - Bounded difference
static int COA
          Deffuzification method - Center of Area
static int COG
          Deffuzification method - Center of Gravity
static int LM
          Deffuzification method - Left Most Maximum
static int MIN
          AND operator - Minimum
static int PROD
          AND operator - Product
static int RM
          Deffuzification method - Right Most Maximum
 
Constructor Summary
NXTFuzzyLogic()
          Default constructor.
 
Method Summary
 void defineInputLinguisticVariable(java.lang.String name, float min, float max, float defaultValue)
          Defines input linguistic variable.
 void defineOutputLinguisticVariable(java.lang.String name, float min, float max, float defaultValue, int defuzzyficationMethod)
           Defines output linguistic variable.
 void defineRule(java.lang.String[] conditions, java.lang.String conclusion, int agregationMethod)
          Function to define fuzzy rules.
 void defineTermSingleton(java.lang.String name, java.lang.String linguisticVariableName, float value)
          Defines singleton term.
 void defineTermSType(java.lang.String name, java.lang.String linguisticVariableName, float left0, float left1)
          Defines S shape term.
 void defineTermTrapezoidal(java.lang.String name, java.lang.String linguisticVariableName, float left0, float left1, float right1, float right0)
           Defines trapezoidal term.
 void defineTermTriangular(java.lang.String name, java.lang.String linguisticVariableName, float left0, float middle, float right0)
           Defines triangular term
 void defineTermZType(java.lang.String name, java.lang.String linguisticVariableName, float right1, float right0)
          Defines Z shape term.
 void evaluate()
          Computes output of fuzzy controller.
 float getOutputValue(java.lang.String name)
          Gets output value of OutputLinguisticVariable.
 void init()
          Initializes the data defined by user.
 void setInputValue(java.lang.String name, float value)
          Sets input value of InputLinguisticVariable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COG

public static final int COG
Deffuzification method - Center of Gravity

See Also:
Constant Field Values

COA

public static final int COA
Deffuzification method - Center of Area

See Also:
Constant Field Values

LM

public static final int LM
Deffuzification method - Left Most Maximum

See Also:
Constant Field Values

RM

public static final int RM
Deffuzification method - Right Most Maximum

See Also:
Constant Field Values

MIN

public static final int MIN
AND operator - Minimum

See Also:
Constant Field Values

PROD

public static final int PROD
AND operator - Product

See Also:
Constant Field Values

BDIF

public static final int BDIF
AND operator - Bounded difference

See Also:
Constant Field Values
Constructor Detail

NXTFuzzyLogic

public NXTFuzzyLogic()
Default constructor.

Method Detail

setInputValue

public void setInputValue(java.lang.String name,
                          float value)
Sets input value of InputLinguisticVariable. Call before evaluate.

Parameters:
name - Input linguistic variable name
value - Value to set

getOutputValue

public float getOutputValue(java.lang.String name)
Gets output value of OutputLinguisticVariable. Call after evaluate.

Parameters:
name - Output linguistic variable name
Returns:
Value of output linguistic variable

defineOutputLinguisticVariable

public void defineOutputLinguisticVariable(java.lang.String name,
                                           float min,
                                           float max,
                                           float defaultValue,
                                           int defuzzyficationMethod)

Defines output linguistic variable.

Parameters:
name - linguistic variable name
min - the lowest value for this linguistic variable
max - the highest value
defaultValue - default value
defuzzyficationMethod - defuzzyfication method: COG COA LM RM

defineInputLinguisticVariable

public void defineInputLinguisticVariable(java.lang.String name,
                                          float min,
                                          float max,
                                          float defaultValue)
Defines input linguistic variable.

Parameters:
name - linguistic variable name
min - the lowest value
max - the highest value
defaultValue - default value

defineTermTriangular

public void defineTermTriangular(java.lang.String name,
                                 java.lang.String linguisticVariableName,
                                 float left0,
                                 float middle,
                                 float right0)

Defines triangular term

Parameters:
name - name of the term
linguisticVariableName - name of the linguistic variable described by this term
left0 - left bottom vertical of the triangle
middle - upper vertical of the triangle
right0 - right bottom vertical of the triangle

defineTermTrapezoidal

public void defineTermTrapezoidal(java.lang.String name,
                                  java.lang.String linguisticVariableName,
                                  float left0,
                                  float left1,
                                  float right1,
                                  float right0)

Defines trapezoidal term.

Parameters:
name - name of the term
linguisticVariableName - name of the linguistic variable described by this term
left0 - left bottom vertical of the trapezoid
left1 - left upper vertical of the trapezoid
right1 - right upper vertical of the trapezoid
right0 - right bottom vertical of the trapezoid

defineTermSingleton

public void defineTermSingleton(java.lang.String name,
                                java.lang.String linguisticVariableName,
                                float value)
Defines singleton term.

Parameters:
name - name of the term
linguisticVariableName - name of the linguistic variable described by this term
value - value in which member function is equal to one.

defineTermSType

public void defineTermSType(java.lang.String name,
                            java.lang.String linguisticVariableName,
                            float left0,
                            float left1)
Defines S shape term.

Parameters:
name - name of the term
linguisticVariableName - name of the linguistic variable described by this term
left0 - Maximum value in which membership function takes zero.
left1 - Minimum value in which membership function takes one.

defineTermZType

public void defineTermZType(java.lang.String name,
                            java.lang.String linguisticVariableName,
                            float right1,
                            float right0)
Defines Z shape term.

Parameters:
name - name of term
linguisticVariableName - name of the linguistic variable described by this term
right1 - Minimum value in which membership function takes one.
right0 - Maximum value in which membership function takes zero.

defineRule

public void defineRule(java.lang.String[] conditions,
                       java.lang.String conclusion,
                       int agregationMethod)
Function to define fuzzy rules. At least one rule have to be defined. Conditions are connected using AND operator. Example:
 defineRule(new String[] {"negSmall", "backSmall"}, "backFast", NXTFuzzyLogic.MIN) 

Parameters:
conditions - condtions terms names
conclusion - conclusion term name
agregationMethod - agregation method: MIN PROD BDIF

init

public void init()
Initializes the data defined by user. Execute this function at the end of controller definition.


evaluate

public void evaluate()
Computes output of fuzzy controller. Input variable values have to be set up before the call.