rule
Class FuzzyRuleBase

java.lang.Object
  |
  +--rule.FuzzyRuleBase

public class FuzzyRuleBase
extends java.lang.Object
implements RuleBase

The FuzzyRuleBase class implements a set of rules and rule variables along with a method for forward chaining.


Field Summary
(package private) static int nextId
           
 
Constructor Summary
FuzzyRuleBase(java.lang.String name)
          Create a new fuzzy rule base.
 
Method Summary
 void addConditionalRule(FuzzyRule rule)
          Adds a conditional rule to this rule base.
 void addUnconditionalRule(FuzzyRule rule)
          Adds an unconditional rule to this rule base.
 void addVariable(FuzzyRuleVariable variable)
          Adds a variable to this rule base
 void backwardChain(java.lang.String goalVarName)
          Not supported in a fuzzy rule base.
 void clear()
          Clears the ruleset of all variables and rules, set the ruleset name to the empty string (""), and set all ruleset options to default values.
 FuzzyClause createClause(ContinuousFuzzyRuleVariable lhs, int oper, java.lang.String hedges, java.lang.String setName)
          Creates a fuzzy clause for use in constructing a rule.
 void displayRules(javax.swing.JTextArea textArea)
          Displays the rules in the given text area.
 void displayVariables(javax.swing.JTextArea textArea)
          Displays the variables in the given text area.
 void forwardChain()
          Perform the forward chaining processing of a fuzzy rulebase.
 double getAlphaCut()
          Retrieves the current alphacut threshold.
 int getCorrelationMethod()
          Retrieves the current correlation method.
 int getDefuzzifyMethod()
          Retrieves the current defuzzification method.
 java.util.Vector getGoalVariables()
          Not supported in a fuzzy rule base.
 int getInferenceMethod()
          Retrieves the current inference method.
 java.util.BitSet getInitialFactBase()
          Retrieves the initial fact base.
 java.lang.String getName()
          Retrieves the name of the rulebase.
 java.util.Hashtable getRules()
          Retrieve the list of rules.
 FuzzyRuleVariable getVariable(java.lang.String name)
          Retrives the fuzzy variable associated with the given name.
 java.util.Hashtable getVariables()
          Retrieve the list of variables.
 void reset()
          Reset the ruleset so that rules can be fired again by setting each variable is to 0.0 and all rules to their original state.
 void setAlphaCut(double alphaCut)
          Sets the alphacut threshold to the specified value.
 void setCorrelationMethod(int correlationMethod)
          Sets the correlation method to the specified type.
 void setDefuzzifyMethod(int defuzzifyMethod)
          Sets the defuzzification method to the specified type.
 void setDisplay(javax.swing.JTextArea textArea)
          Sets the text area for the display of information.
 void setInferenceMethod(int inferenceMethod)
          Sets the inference method to the specified type.
 void setName(java.lang.String name)
          Sets the name of the rulebase.
 void trace(java.lang.String text)
          Adds the given text to the trace information.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextId

static int nextId
Constructor Detail

FuzzyRuleBase

public FuzzyRuleBase(java.lang.String name)
Create a new fuzzy rule base.
Parameters:
name - the String object that contains the name of the rule base
Method Detail

setDisplay

public void setDisplay(javax.swing.JTextArea textArea)
Sets the text area for the display of information.
Specified by:
setDisplay in interface RuleBase
Parameters:
textArea - the JTextArea to be used for the display of information

trace

public void trace(java.lang.String text)
Adds the given text to the trace information.
Specified by:
trace in interface RuleBase
Parameters:
text - the String the text to be displayed as part of the trace information

forwardChain

public void forwardChain()
Perform the forward chaining processing of a fuzzy rulebase.

Fire the rules in the ruleset.

The order of processing is as follows:

  1. Determine whether the ruleset is executable. If it is, processing continues.
  2. The rules in the ruleset are reset. (See below.)
  3. All unconditional rules (facts or assertions) are fired.
  4. Conditional rules are fired until they quiesce.
Specified by:
forwardChain in interface RuleBase

reset

public void reset()
Reset the ruleset so that rules can be fired again by setting each variable is to 0.0 and all rules to their original state.
Specified by:
reset in interface RuleBase

setName

public void setName(java.lang.String name)
Sets the name of the rulebase.
Parameters:
name - the new name of the rulebase

getName

public java.lang.String getName()
Retrieves the name of the rulebase.
Returns:
the current name of the rulebase

setAlphaCut

public void setAlphaCut(double alphaCut)
Sets the alphacut threshold to the specified value.
Parameters:
alphaCut - the double value for the new alphacut threshold

getAlphaCut

public double getAlphaCut()
Retrieves the current alphacut threshold.
Returns:
the current alphacut value

setCorrelationMethod

public void setCorrelationMethod(int correlationMethod)
Sets the correlation method to the specified type.
Parameters:
correlationMethod - the integer that represents to new correlation mehtod type (enumerated in the FuzzyDefs class)

getCorrelationMethod

public int getCorrelationMethod()
Retrieves the current correlation method.
Returns:
the current correlation method

setDefuzzifyMethod

public void setDefuzzifyMethod(int defuzzifyMethod)
Sets the defuzzification method to the specified type.
Parameters:
defyzzifyMethod - the integer that represents the new defuzzification method (enumerated in FuzzyDefs class)

getDefuzzifyMethod

public int getDefuzzifyMethod()
Retrieves the current defuzzification method.
Returns:
the current defuzzification method

setInferenceMethod

public void setInferenceMethod(int inferenceMethod)
Sets the inference method to the specified type.
Parameters:
inferenceMethod - the new inference method (enumerated in the FuzzyDefs class)

getInferenceMethod

public int getInferenceMethod()
Retrieves the current inference method.
Returns:
the current inference method

addVariable

public void addVariable(FuzzyRuleVariable variable)
Adds a variable to this rule base
Parameters:
variable - the Variable to be added to the rule base

getVariable

public FuzzyRuleVariable getVariable(java.lang.String name)
Retrives the fuzzy variable associated with the given name.
Parameters:
name - the String that contains the name of the variable
Returns:
the variable associated with the given name

getVariables

public java.util.Hashtable getVariables()
Retrieve the list of variables.
Returns:
a list of variables defined in this ruleset

addConditionalRule

public void addConditionalRule(FuzzyRule rule)
Adds a conditional rule to this rule base.
Parameters:
rule - the FuzzyRule object to be added

addUnconditionalRule

public void addUnconditionalRule(FuzzyRule rule)
Adds an unconditional rule to this rule base.
Parameters:
rule - the FuzzyRule object to be added

getRules

public java.util.Hashtable getRules()
Retrieve the list of rules.
Returns:
a list of rules defined in this ruleset

createClause

public FuzzyClause createClause(ContinuousFuzzyRuleVariable lhs,
                                int oper,
                                java.lang.String hedges,
                                java.lang.String setName)
Creates a fuzzy clause for use in constructing a rule.
Parameters:
lhs - the ContinuousFuzzyRuleVariable object that is the lefthand side of the clause (must be a reference to an existing variable)
oper - the integer that represents the relation connecting the left- and righthand sides of the clause
hedges - the String object that contains the list of hedges to be applied to the fuzzy set (if not used in the rule, hedges must be the empty string, and not null)
setName - the String that contains the righthand side of the clause, the name of a fuzzy set.
Returns:
the FuzzyClause object created

getInitialFactBase

public java.util.BitSet getInitialFactBase()
Retrieves the initial fact base.
Returns:
Working memory as it exists at the start of inferencing.

clear

public void clear()
Clears the ruleset of all variables and rules, set the ruleset name to the empty string (""), and set all ruleset options to default values.

displayVariables

public void displayVariables(javax.swing.JTextArea textArea)
Displays the variables in the given text area.
Specified by:
displayVariables in interface RuleBase
Parameters:
textArea - the JTextArea object where the variables are displayed

displayRules

public void displayRules(javax.swing.JTextArea textArea)
Displays the rules in the given text area.
Specified by:
displayRules in interface RuleBase
Parameters:
textArea - the JTextArea object where the rules are displayed

backwardChain

public void backwardChain(java.lang.String goalVarName)
Not supported in a fuzzy rule base.
Specified by:
backwardChain in interface RuleBase
Parameters:
goalVarName - the String object

getGoalVariables

public java.util.Vector getGoalVariables()
Not supported in a fuzzy rule base.
Specified by:
getGoalVariables in interface RuleBase
Returns:
the Vector object