Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.able.rules
Class AbleFuzzyInferenceEngine

    java.lang.Object
      com.ibm.able.rules.AbleInferenceEngine
          com.ibm.able.rules.AbleFuzzyInferenceEngine

All Implemented Interfaces:
  java.io.Serializable

public class AbleFuzzyInferenceEngine
extends AbleInferenceEngine
implements java.io.Serializable

This class provides the control code and inferencing algorithm for processing a set of conditional rules in a ruleblock containing Fuzzy linguistic variables and hedges using data-driven or forward chaining and fuzzy inferencing logic.

The AbleFuzzyInferenceEngine processes AbleAssertionRules and AbleConditionalRules and ignores all others.

The control parameter ARL.InferenceMethod can be used to specify several alternative fuzzy inference algorithms. These include:

1. FUZZY_ADD The default inference method.
2. MIN_MAX
3. PRODUCT_OR

*

The control parameter ARL.CorrelationMethod can be used to specify alternative correlation algorithms. These include:

1. Product The default correlation method.
2. Minimum

The control parameter ARL.DefuzzifyMethod can be used to specify several alternative defuzzification algorithms. These include:

1. Centriod The default defuzzification method.
2. MaxHeight

The major processing method is infer() which is called by the AbleRuleSet bean as part of the normal bean process() method.

Instances of this class are not directly constructed by the user but are dynamically created by the AbleRuleBlock init() method.

See Also:
  `AbleRuleSet`, `AbleRuleBlock`, `AbleAssertionRule`, `AbleConditionalRule`, Serialized Form

Field Summary
`protected double` | `myAlphaCut` Ruleset alphaCut is the default alphaCut for fuzzy sets.
`protected int` | `myCorrelationMethod` Specifies the manner in which a rule's consequent is correlated with the truth values of the rule's antecedents.
`protected int` | `myDefuzzifyMethod` Specifies the method used to turn a fuzzy value into a crisp number.
`protected int` | `myFuzzyInferenceMethod` Specifies the inference (implication) used to process fuzzy rules Value is a DefuzzifyMethod constant.

Fields inherited from class com.ibm.able.rules.AbleInferenceEngine
`myDebugLevel, myRuleBlock, myRuleSet, myRulesFiredCount, myTracer, myWorkingMemory`

Constructor Summary
`AbleFuzzyInferenceEngine(AbleRuleSet theRuleSet, AbleLogger theTracer, AbleRuleBlock theRuleBlock)` Create a new inference engine.

Method Summary
`protected void` | `evalAssertionClause(AbleAssertionClause theClause)` Evaluate the specified assertion clause.
`protected void` | `evaluateDoActions(AbleRule theRule, java.util.BitSet theFactBase, double theTruthValueMin)`
`double` | `getAlphaCut()` Retrieve the current alphacut threshold.
`java.lang.Object` | `getControlParameter(java.lang.String theControlParameter)` Returns the specified control parameter on the associated inference engine.
`int` | `getCorrelationMethod()` Retrieve the current correlation method.
`int` | `getDefuzzifyMethod()` Retrieve the current defuzzification method.
`int` | `getFuzzyInferenceMethod()` Retrieve the current fuzzy inference method.
`void` | `infer(AbleRuleBlock theRuleBlock)` Fire the rules in the ruleblock using fuzzy inferencing.
`boolean` | `isRuleBlockValid(AbleRuleBlock theRuleBlock)` Make sure the current ruleblock is "executable" by this inference engine.
`void` | `processRuleBlock(AbleRuleBlock theRuleBlock)` Fire all rules in the specified rule block in sequential order.
`void` | `setAlphaCut(double theAlphaCut)` Set the alphacut threshold to the specified value.
`void` | `setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue)` Set the specified control parameter on the associated inference engine.
`void` | `setCorrelationMethod(int theCorrelationMethod)` Set the correlation method to the specified type.
`void` | `setDefuzzifyMethod(int theDefuzzifyMethod)` Set the defuzzification method to the specified type.
`void` | `setFuzzyInferenceMethod(int theInferenceMethod)` Set the inference method to the specified type.

Methods inherited from class com.ibm.able.rules.AbleInferenceEngine
`allocateWorkingMemory, askUser, conditionalRulesValid, evalAntecedentClause, evalAntecedentExpression, evalAssertionRule, evalConditionalRule, evalConsequentClause, evalDoUntilRule, evalDoWhileRule, evalForLoopRule, evalIfThenElseRule, evalPatternMatchRule, evalSwitchRule, evaluateDoActions, evalWhileDoRule, fireEngineBreakpoint, firePropertyChange, getRuleSet, getRulesFiredCount, getWorkingMemory, init, processAssertions, processConsequent, processConsequent, processConsequentClauses, reset, resetRuleSet, setControlParameters, setDebugLevel, setInferenceContext, setInferenceContext, setInferenceContext, setRuleSet, setWorkingMemory, startDebugConsole, stopDebugConsole, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### myFuzzyInferenceMethod

    protected int myFuzzyInferenceMethod

  Specifies the inference (implication) used to process fuzzy rules Value is a DefuzzifyMethod constant. Initially set to FuzzyInferenceMethodDefault.

### myAlphaCut

    protected double myAlphaCut

  Ruleset alphaCut is the default alphaCut for fuzzy sets. Specifies the floor beneath which truth values are considered to be zero. Initially set to AlphaCutDefault.

### myCorrelationMethod

    protected int myCorrelationMethod

  Specifies the manner in which a rule's consequent is correlated with the truth values of the rule's antecedents. Value is a CorrelationMethod constant. Initially set to CorrelationMethodDefault.

### myDefuzzifyMethod

    protected int myDefuzzifyMethod

  Specifies the method used to turn a fuzzy value into a crisp number. Value is a DefuzzifyMethod constant. Initially set to DefuzzifyMethodDefault.

Constructor Detail

### AbleFuzzyInferenceEngine

    public AbleFuzzyInferenceEngine(AbleRuleSet theRuleSet,
                                    AbleLogger theTracer,
                                    AbleRuleBlock theRuleBlock)

  Create a new inference engine.

Parameters:
  `theRuleSet` - A ruleset whose context is used for inferencing by this inference engine.

  `theTracer` - A tracer object to which this inference engine can log information. This may be null, in which case no information is logged.

  `theRuleBlock` - A ruleblock whose rules are to be used for inferencing by this inference engine.

Method Detail

### isRuleBlockValid

    public boolean isRuleBlockValid(AbleRuleBlock theRuleBlock)

  Make sure the current ruleblock is "executable" by this inference engine.

  The ruleblock is invalid if any of the following are present in any ruleblock:

  - If-then-else rules
  - Pattern match rules
  - Predicate rules
  - Iteration rules

    All reasons for validation failures are appended to the AbleRuleSet's myIsExReason variable. If validation fails, the inference engine must call myRuleSet.addIsExReason(java.lang.String) to append the reason. Reasons are accumulatve.

  Specified by:
    `isRuleBlockValid` in class `AbleInferenceEngine`
  Returns:
    true, if the ruleset is OK; false, if the ruleset is not executable.

### infer

    public void infer(AbleRuleBlock theRuleBlock)
               throws AbleDataException

  Fire the rules in the ruleblock using fuzzy inferencing.

  The infer() method is invoked by the AbleRuleSet process() code.

  The order of processing is as follows:

  1. Evaluate all assertion rules sequentially.
  2. Evaluate all conditional rules using fuzzy inferencing.

  Specified by:
    `infer` in class `AbleInferenceEngine`
  Parameters:
    `theRuleBlock` - The ruleblock object to process.

  Throws:
    `AbleDataException` - When any error occurs.

### processRuleBlock

    public void processRuleBlock(AbleRuleBlock theRuleBlock)
                          throws AbleDataException

  Fire all rules in the specified rule block in sequential order.

  This method is called from a ruleset's invokeRuleBlock() method, and that method is called when a rule that uses the built-in invokeRuleBlock("name") call literal is evaluated.

  Overrides:
    `processRuleBlock` in class `AbleInferenceEngine`
  Parameters:
    `theRuleBlock` - The rule block from which rules are to be processed.

  Throws:
    `AbleDataException` - when the data types are incompatible, or when the relational operator is invalid for the current situation or unrecognized.

### evaluateDoActions

    protected void evaluateDoActions(AbleRule theRule,
                                     java.util.BitSet theFactBase,
                                     double theTruthValueMin)
                              throws AbleDataException

  Throws:
    `AbleDataException`

### evalAssertionClause

    protected void evalAssertionClause(AbleAssertionClause theClause)
                                throws AbleDataException

  Evaluate the specified assertion clause.

  Overrides:
    `evalAssertionClause` in class `AbleInferenceEngine`
  Parameters:
    `theClause` - an assertion clause to evaluate.

  Throws:
    `AbleDataException` - when the clause's data objects are incompatible, or when the relational operator is invalid for the current situation or unrecognized.

### setControlParameter

    public void setControlParameter(java.lang.String theControlParameter,
                                    java.lang.Object theValue)
                             throws AbleDataException

  Set the specified control parameter on the associated inference engine.

  Specified by:
    `setControlParameter` in class `AbleInferenceEngine`
  Throws:
    `AbleDataException`

### getControlParameter

    public java.lang.Object getControlParameter(java.lang.String theControlParameter)
                                         throws AbleDataException

  Returns the specified control parameter on the associated inference engine.

  Specified by:
    `getControlParameter` in class `AbleInferenceEngine`
  Throws:
    `AbleDataException`

### getAlphaCut

    public final double getAlphaCut()

  Retrieve the current alphacut threshold.

  Returns:
    The current alphacut.

### setAlphaCut

    public void setAlphaCut(double theAlphaCut)
                     throws AbleDataException

  Set the alphacut threshold to the specified value.

  Parameters:
    `theAlphaCut` - The new alphacut threshold.

  Throws:
    `AbleDataException` - If the specified alphacut value is not between 0.0 (exclusive) and 1.0 (exclusive).

### getCorrelationMethod

    public final int getCorrelationMethod()

  Retrieve the current correlation method.

  Returns:
    The current correlation method.

### setCorrelationMethod

    public void setCorrelationMethod(int theCorrelationMethod)
                              throws AbleDataException

  Set the correlation method to the specified type.

  Parameters:
    `theCorrelationMethod` - The new correlation method.

  Throws:
    `AbleDataException` - If the specified correlation method is not recognised.

### getDefuzzifyMethod

    public final int getDefuzzifyMethod()

  Retrieve the current defuzzification method.

  Returns:
    The current defuzzification method.

### setDefuzzifyMethod

    public void setDefuzzifyMethod(int theDefuzzifyMethod)
                            throws AbleDataException

  Set the defuzzification method to the specified type.

  Parameters:
    `theDefuzzifyMethod` - The new defuzzification method.

  Throws:
    `AbleDataException` - If the specified defuzzification method is not recognised.

### setFuzzyInferenceMethod

    public void setFuzzyInferenceMethod(int theInferenceMethod)
                                 throws AbleDataException

  Set the inference method to the specified type.

  Parameters:
    `theInferenceMethod` - The new fuzzy inference method. Fuzzy Inference methods are enumerated in this class.

  Throws:
    `AbleDataException` - If the specified fuzzy inference method is not recognised.
  See Also:
    `getFuzzyInferenceMethod()`

### getFuzzyInferenceMethod

    public final int getFuzzyInferenceMethod()

  Retrieve the current fuzzy inference method.

  Returns:
    The current fuzzy inference method.
  See Also:
    `setFuzzyInferenceMethod(int)`

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005