ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.rules
Class AbleMutExEngine

java.lang.Object
  |
  +--com.ibm.able.rules.AbleInferenceEngine
        |
        +--com.ibm.able.rules.AbleMutExEngine
All Implemented Interfaces:
java.io.Serializable

public class AbleMutExEngine
extends AbleInferenceEngine
implements java.io.Serializable

This rule engine provides the control code and inferencing algorithms for processing a ruleblock and fires a single rule in the ruleblock. This is an experimental engine.

See Also:
Serialized Form

Fields inherited from class com.ibm.able.rules.AbleInferenceEngine
myDebugLevel, myRuleBlock, myRuleSet, myRulesFiredCount, myTracer, myWorkingMemory
 
Constructor Summary
AbleMutExEngine(AbleRuleSet theRuleSet, AbleLogger theTracer, AbleRuleBlock theRuleBlock)
          Create a new inference engine.
 
Method Summary
 void addRuleToConflictSet(java.util.Vector theConflictSet, AbleRule theRule)
          Inserts the Rule into the conflict set based on priority.
static java.lang.String Copyright()
          Determine the copyright of this class.
 java.lang.Object getControlParameter(java.lang.String theControlParameter)
          Returns the specified control parameter on the associated inference engine.
 void infer(AbleRuleBlock theRuleBlock)
          Fire the rules in the ruleset using boolean rules of forward chaining inferencing: work forward from an initial state to the goal state.
 boolean isRuleBlockValid(AbleRuleBlock theRuleBlock)
          Make sure the current ruleblock is "executable" by this inference engine.
protected  void logConflictSet(java.util.Vector conflictSet)
          Write the contents of the conflict set (triggered rules) to the Inference trace log
 void reevaluateClausesWithChangedVariable(AbleClauseReferences theClauseReferences)
          Re-evaluate, if necessary, the specified clauses that contain a reference to a variable whose current value has just changed.
 void setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue)
          Set the specified control parameter on the associated inference engine.
 
Methods inherited from class com.ibm.able.rules.AbleInferenceEngine
askUser, conditionalRulesValid, evalAntecedentClause, evalAntecedentExpression, evalAssertionClause, evalAssertionRule, evalConditionalRule, evalConsequentClause, evalDoUntilRule, evalDoWhileRule, evalForLoopRule, evalIfThenElseRule, evalPatternMatchRule, evaluateDoActions, evalWhileDoRule, fireEngineBreakpoint, firePropertyChange, getRuleSet, getRulesFiredCount, getWorkingMemory, init, processAssertions, processConsequent, processRuleBlock, resetRuleSet, setControlParameters, setDebugLevel, setRuleSet, setWorkingMemory, startDebugConsole, stopDebugConsole, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbleMutExEngine

public AbleMutExEngine(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 the ruleblock:

  • Predicate 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.

    Overrides:
    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 ruleset using boolean rules of forward chaining inferencing: work forward from an initial state to the goal state.

    The order of processing is as follows:

    1. If an "init" rule block exists and hasn't yet been processed, all rules in it are processed sequentially.
    2. If a "main" rule block exists, all assertions in it are fired sequentially.
    3. Variables identified in the ruleset's input sequence are assigned values from the ruleset's input buffer.
    4. If a "main" rule block exists, all conditional rules in it are evaluated using forward chaining.
    5. If an "idle" rule block exists, all rules in it are processed sequentially.
    6. Values of variables identified in the ruleset's output sequence are written to the ruleset's output buffer.
    Overrides:
    infer in class AbleInferenceEngine
    Parameters:
    theUnneededObject - The Object is ignored.

    Throws:
    AbleDataException - When any error occurs.

    reevaluateClausesWithChangedVariable

    public void reevaluateClausesWithChangedVariable(AbleClauseReferences theClauseReferences)
                                              throws AbleDataException
    Re-evaluate, if necessary, the specified clauses that contain a reference to a variable whose current value has just changed. This engine processes only antecedent clauses.
    Parameters:
    theClauseReferences - A collection of clauses that reference some variable whose current value has just changed.


    addRuleToConflictSet

    public void addRuleToConflictSet(java.util.Vector theConflictSet,
                                     AbleRule theRule)
                              throws AbleDataException
    Inserts the Rule into the conflict set based on priority.
    Parameters:
    conflictSet - the Vector to which the rule is added
    theRule - the Rule that needs to be added

    logConflictSet

    protected void logConflictSet(java.util.Vector conflictSet)
    Write the contents of the conflict set (triggered rules) to the Inference trace log

    setControlParameter

    public void setControlParameter(java.lang.String theControlParameter,
                                    java.lang.Object theValue)
                             throws AbleDataException
    Set the specified control parameter on the associated inference engine.
    Overrides:
    setControlParameter in class AbleInferenceEngine

    getControlParameter

    public java.lang.Object getControlParameter(java.lang.String theControlParameter)
                                         throws AbleDataException
    Returns the specified control parameter on the associated inference engine.
    Overrides:
    getControlParameter in class AbleInferenceEngine

    Copyright

    public static java.lang.String Copyright()
    Determine the copyright of this class.
    Returns:
    A String containing this class's copyright statement.

    ABLE 2.0.0 07/02/2003 10:25:01

    (C) Copyright IBM Corporation 1999, 2003