|
ABLE, Version 1.1b | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.rmi.server.RemoteObject | +--java.rmi.server.RemoteServer | +--java.rmi.server.UnicastRemoteObject | +--com.ibm.able.AbleObject | +--com.ibm.able.beans.fuzzy.FsRuleSet
This class defines the Fuzzy System "RuleSet" class.
The FsRuleSet object is the primary interface into the Fuzzy System. Through an FsRuleSet object you can create variables, fuzzy sets, and rules, and then perform inferencing with the rules to solve problems. Input data and solution data are read from and written to program buffers so that an FsRuleSet can be embedded in other objects.
There are two ways to instantiate a fuzzy system ruleset. The first is to write a fuzzy program using the defined fuzzy rule language, and then ask an FsRuleSet object to instantiate itself from that source file. The second way is to use the methods of FsRuleSet to create an instantiated object programatically.
Once a ruleset is successfully instantiated, you can call the process() method to perform inferencing and obtain a solution.
Fields inherited from class com.ibm.able.AbleObject |
changed,
chgSupport,
comment,
dataFlowEnabled,
destBufferConnections,
eventQueue,
fileName,
inputBuffer,
listeners,
logger,
name,
outputBuffer,
parent,
propertyConnectionMgr,
sourceBufferConnections,
state,
stateChgSupport |
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Constructor Summary | |
FsRuleSet()
Create a new fuzzy system ruleset. |
|
FsRuleSet(FsTrace theBaseTracer,
FsTrace theInferenceTracer)
Create a new fuzzy system ruleset. |
Method Summary | |
void |
addAntecedentToRule(java.lang.Integer theRuleId,
java.lang.String theRuleLabel,
java.lang.String theClauseVarLhs,
int theClauseOperator,
java.lang.String theClauseHedges,
java.lang.String theClauseValue,
int theClauseValueType,
double theClauseWeight,
java.util.Vector theCallParms)
Create an antecedent (if) clause from the specified bits, and add the clause to the specified rule. |
void |
addBetaSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
double theSetPtCenter,
double theSetFlexFactor,
double theSetWeight)
Create a new beta fuzzy set and add it to the specified continuous variable. |
void |
addComplementSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
java.lang.String theSetNameComplement)
Create the complement of a previously created fuzzy set and add it to the specified continuous variable. |
void |
addConsequentToRule(java.lang.Integer theRuleId,
java.lang.String theRuleLabel,
java.lang.String theClauseVarLhs,
int theClauseOperator,
java.lang.String theClauseHedges,
java.lang.String theClauseValue,
int theClauseValueType,
java.util.Vector theCallParms)
Create a consequent (then) clause from the specified bits, and add the clause to the specified rule. |
void |
addEffector(AbleEffector theAbleEffector)
Add an effector to the list of managed effectors. |
void |
addFuzzyChangeListener(java.beans.PropertyChangeListener theListener)
Add a property change listener to the ruleset. |
void |
addGaussianSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
double theSetPtCenter,
double theSetWidthFactor)
Create a new gaussian fuzzy set and add it to the specified continuous variable. |
void |
addLinearSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
double theSetPtBegin,
double theSetPtEnd,
int theSetDirection)
Create a new linear fuzzy set and add it to the specified continuous variable. |
void |
addPiSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
double theSetPtCenter,
double theSetWidth)
Create a new pi fuzzy set and add it to the specified continuous variable. |
void |
addSegmentsSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
int theNumberOfSegments,
double[] theScalarVector,
double[] theTruthVector)
Create a new segments fuzzy set and add it to the specified continuous variable. |
void |
addSensor(AbleSensor theAbleSensor)
Add a sensor to the list of managed sensors. |
void |
addShoulderSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
double theSetPtBegin,
double theSetPtEnd,
int theSetDirection)
Create a new shoulder fuzzy set and add it to the specified continuous variable. |
void |
addSigmoidSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
double theSetPtBegin,
double theSetPtEnd,
double theSetPtFlex,
int theSetDirection)
Create a new sigmoid fuzzy set and add it to the specified continuous variable. |
void |
addTrapezoidSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
double theSetPtLeft,
double theSetPtLeftCore,
double theSetPtRightCore,
double theSetPtRight)
Create a new trapezoid fuzzy set and add it to the specified continuous variable. |
void |
addTriangleSetToContinuousVariable(java.lang.String theVariableName,
java.lang.String theSetName,
double theAlphaCut,
double theSetPtLeft,
double theSetPtCenter,
double theSetPtRight)
Create a new triangle fuzzy set and add it to the specified continuous variable. |
void |
addVariableToInputSequence(java.lang.String theVariableName)
Specify that a variable is to be added to the input sequence. |
void |
addVariableToOutputSequence(java.lang.String theVariableName)
Specify that a variable is to be added to the output sequence. |
void |
clear()
Clear the ruleset of all variables and rules, clear out the trace logs, set the ruleset name to the empty string (""), and set all ruleset options (alphacut, correlation method, and so on) to default values. |
boolean |
conditionalRuleIdExists(java.lang.Integer theRuleId)
Determine whether any rule in the ruleset contains the specified key. |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
boolean |
definedSensorEffector(java.lang.String theName,
boolean theSensorFlag)
Determine whether a sensor or an effector with the specified name already exists within the ruleset. |
void |
defineEffector(java.lang.String theEffectorName)
Define an effector that must be available at runtime. |
void |
defineSensor(java.lang.String theSensorName)
Define a sensor that must be available at runtime. |
boolean |
effectorNameAlreadyExists(java.lang.String theEffectorName)
Determine whether an effector with the specified name exists within the ruleset. |
boolean |
effectorNameIsUnused(java.lang.String theEffectorName)
Determine whether an effector with the specified name does not exist within the ruleset. |
double |
getAlphaCut()
Retrieve the current alphacut threshold. |
FsTrace |
getBaseTraceObject()
Retrieve the base tracer object. |
int |
getCorrelationMethod()
Retrieve the current correlation method. |
java.util.Hashtable |
getDefinedEffectors()
Get defined effectors. |
java.util.Hashtable |
getDefinedSensors()
Get defined sensors. |
int |
getDefuzzifyMethod()
Retrieve the current defuzzification method. |
java.util.Hashtable |
getEffectors()
Get all effectors registered with this effector manager. |
int |
getInferenceMethod()
Retrieve the current inference method. |
FsTrace |
getInfrTraceObject()
Retrieve the inferencing tracer object. |
java.util.BitSet |
getInitialFactBase()
Retrieve the initial fact base. |
int |
getNumOutputVars()
Retrieve the number of output variables. |
java.util.Vector |
getOutputVars()
Retrieve the output variables. |
java.util.Hashtable |
getRules()
Retrieve the list of rules. |
java.lang.String |
getRuleSetName()
Retrieve the name of the ruleset. |
java.util.Hashtable |
getSensors()
Get all sensors registered with this sensor manager. |
java.io.File |
getSrcFile()
Retrieve the name of the source file for this ruleset. |
java.lang.String |
getSrcFileName()
Retrieve the name of the source file for this ruleset. |
java.util.Hashtable |
getVariables()
Retrieve the list of variables. |
void |
instantiateFrom(java.io.DataInputStream theStream,
FsTrace theTracer,
boolean theStopOnFsExceptionFlag)
Instantiate the ruleset object by reading a fuzzy system rule source file contained in the specified input stream. |
void |
instantiateFrom(java.lang.String theFileName,
FsTrace theTracer,
boolean theStopOnFsExceptionFlag)
Instantiate the ruleset object by reading a fuzzy system rule source file contained in the specified input file. |
void |
instantiateFromXml(java.io.File theFile,
FsTrace theTracer,
boolean theStopOnFsExceptionFlag)
Instantiate the ruleset object by reading a fuzzy system XML document contained in the specified input file. |
void |
instantiateFromXml(java.io.InputStream theInputStream,
FsTrace theTracer,
boolean theStopOnFsExceptionFlag)
Instantiate the ruleset object by reading a fuzzy system XML document contained in the specified input stream. |
java.lang.Object |
invokeEffector(java.lang.String theEffectorName,
java.lang.Object[] theArgs)
Call the method that the effector name represents, passing in the array of argument objects. |
java.lang.Object |
invokeSensor(java.lang.String theSensorName,
java.lang.Object[] theArgs)
Call the method that the sensor name represents, passing in the array of argument objects. |
boolean |
ioBuffersOK()
Determine whether the input and output buffers are the expected object type (String[]) and that they have enough slots to hold the required input and output variables. |
boolean |
isBaseTraceActive()
Determine whether ruleset tracing is on. |
boolean |
isExecutable()
Determine whether the ruleset is executable. |
boolean |
isInferencingTraceActive()
Determine whether inference tracing is on. |
void |
makeBooleanVariable(java.lang.String theVariableName,
boolean theBooleanValue)
Create a boolean variable, give it an initial value, and add it to the ruleset. |
java.lang.Integer |
makeConditionalRule(java.lang.String theRuleLabel)
Create a conditional rule (that is, an if-then rule) with the specified label, and add the rule to the ruleset. |
void |
makeContinuousVariable(java.lang.String theVariableName,
double theLoValue,
double theHiValue)
Create a continuous (or fuzzy) variable over a range of values and add it to the ruleset. |
void |
makeNumericVariable(java.lang.String theVariableName,
double theNumericValue)
Create a numeric variable, give it an initial value, and add it to the ruleset. |
void |
makeSymbolicVariable(java.lang.String theVariableName,
java.util.Hashtable theSymbolList)
Create a symbolic variable and add it to the ruleset. |
void |
makeUnconditionalRule(java.lang.String theRuleLabel,
java.lang.String theRuleVarLhs,
int theRuleOperator,
java.lang.String theRuleHedges,
java.lang.String theRuleValue,
int theRuleValueType,
java.util.Vector theCallParms)
Create an unconditional rule (that is, an assertion) from the specified bits, and add the rule to the ruleset. |
void |
process()
Perform the standard processing function performed by this object. |
void |
process(java.util.Hashtable theInputBuffer,
java.util.Hashtable theOutputBuffer)
Fire the rules in the ruleset. |
void |
removeEffector(java.lang.String theEffectorName)
Remove an effector from the list of managed effectors. |
void |
removeFuzzyChangeListener(java.beans.PropertyChangeListener theListener)
Remove a property change listener from the ruleset. |
void |
removeSensor(java.lang.String theSensorName)
Remove a sensor from the list of managed sensors. |
void |
reset()
Reset the ruleset so that rules can be fired again. |
java.util.Vector |
resolveArgs(java.util.Vector theVariableNames)
Given a list of variable names, return a list of those names resolved to actual variable references. |
java.lang.String |
rlString()
Return a formal fuzzy rule language string. |
boolean |
ruleLabelAlreadyExists(java.lang.String theRuleLabel)
Determine whether any rule in the ruleset contains the specified label. |
boolean |
sensorNameAlreadyExists(java.lang.String theSensorName)
Determine whether a sensor with the specified name exists within the ruleset. |
boolean |
sensorNameIsUnused(java.lang.String theSensorName)
Determine whether a sensor with the specified name does not exist within the ruleset. |
void |
setAlphaCut(double theAlphaCut)
Set the alphacut threshold to the specified value. |
void |
setBaseTraceActive(boolean theTraceValue)
Turn ruleset tracing on or off. |
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 |
setEffectors(java.util.Hashtable theAbleEffectors)
Set all effectors for this manager. |
void |
setInferenceMethod(int theInferenceMethod)
Set the inference method to the specified type. |
void |
setInferencingTraceActive(boolean theTraceValue)
Turn inference tracing on or off. |
void |
setRuleSetName(java.lang.String theRuleSetName)
Specify the name of the ruleset. |
void |
setSensors(java.util.Hashtable theAbleSensors)
Set all sensors for this manager. |
void |
setSerFileName(java.lang.String theSerFileName)
Specify the name of the serialized file for this ruleset. |
void |
setSrcFile(java.io.File theSrcFile)
Specify the source file object for this ruleset. |
void |
setSrcFileName(java.lang.String theSrcFileName)
Specify the name of the source file for this ruleset. |
void |
setXmlFileName(java.lang.String theXmlFileName)
Specify the name of the XML document file for this ruleset. |
java.lang.String |
toString()
Retrieve a string describing (the contents of) the object. |
boolean |
variableNameAlreadyExists(java.lang.String theVariableName)
Determine whether a variable with the specified name exists within the ruleset. |
boolean |
variableNameIsUnused(java.lang.String theVariableName)
Determine whether a variable with the specified name does not exist within the ruleset. |
boolean |
variableNamesAlreadyExist(java.util.Vector theVariableNames)
Determine whether variables with the specified names exist within the ruleset. |
java.lang.String |
xmlString()
Return a formal XML fuzzy document string. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone,
exportObject,
exportObject,
exportObject,
unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost,
getLog,
setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals,
getRef,
hashCode,
toStub |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public FsRuleSet() throws java.rmi.RemoteException
public FsRuleSet(FsTrace theBaseTracer, FsTrace theInferenceTracer) throws java.rmi.RemoteException
theBaseTracer
- A trace object, used by the ruleset to record
interactions with other objects.
theInferenceTracer
- A trace object, used by the ruleset to record
information during the inferencing process.
Method Detail |
public void process() throws java.rmi.RemoteException
Fire the rules in the ruleset.
The order of processing is as follows:
isExecutable()
,
reset()
public void reset()
public void addEffector(AbleEffector theAbleEffector) throws java.rmi.RemoteException
theAbleEffector
- The actual effector to be added to the list of effectors.
removeEffector(java.lang.String)
public void removeEffector(java.lang.String theEffectorName) throws java.rmi.RemoteException
theEffectorName
- The name of the effector to be removed.
addEffector(com.ibm.able.beans.AbleEffector)
public java.lang.Object invokeEffector(java.lang.String theEffectorName, java.lang.Object[] theArgs) throws java.rmi.RemoteException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException, java.lang.SecurityException
theEffectorName
- The name of the effector containing an encapsulated method.
theArgs
- An array of arguments that the method expects.
addEffector(com.ibm.able.beans.AbleEffector)
,
setEffectors(java.util.Hashtable)
public java.util.Hashtable getEffectors() throws java.rmi.RemoteException
addEffector(com.ibm.able.beans.AbleEffector)
,
setEffectors(java.util.Hashtable)
public void setEffectors(java.util.Hashtable theAbleEffectors) throws java.rmi.RemoteException
theAbleEffectors
- A list of AbleEffector objects that are to be managed by
this effector manager. The input list is cloned.
addEffector(com.ibm.able.beans.AbleEffector)
,
getEffectors()
public void addSensor(AbleSensor theAbleSensor) throws java.rmi.RemoteException
theAbleSensor
- The actual sensor to be added to the list of sensors.
removeSensor(java.lang.String)
public void removeSensor(java.lang.String theSensorName) throws java.rmi.RemoteException
theSensorName
- The name of the sensor to be removed.
addSensor(com.ibm.able.beans.AbleSensor)
public java.lang.Object invokeSensor(java.lang.String theSensorName, java.lang.Object[] theArgs) throws java.rmi.RemoteException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException, java.lang.SecurityException
theSensorName
- The name of the sensor containing an encapsulated method.
theArgs
- An array of arguments that the method expects.
addSensor(com.ibm.able.beans.AbleSensor)
,
setSensors(java.util.Hashtable)
public java.util.Hashtable getSensors() throws java.rmi.RemoteException
addSensor(com.ibm.able.beans.AbleSensor)
,
setSensors(java.util.Hashtable)
public void setSensors(java.util.Hashtable theAbleSensors) throws java.rmi.RemoteException
theAbleSensors
- A list of AbleSensor objects that are to be managed by
this sensor manager. The input list is cloned.
addSensor(com.ibm.able.beans.AbleSensor)
,
getSensors()
public void instantiateFrom(java.io.DataInputStream theStream, FsTrace theTracer, boolean theStopOnFsExceptionFlag) throws FsException, antlr.ParserException, java.io.IOException
Note that if the ruleset contains any variables, fuzzy sets, and rules from a previous instantiation, these are removed from the ruleset before the source file is read. That is, the ruleset is cleared, and made to look like a newly created ruleset.
theStream
- The source from which a rule file is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
public void instantiateFrom(java.lang.String theFileName, FsTrace theTracer, boolean theStopOnFsExceptionFlag) throws FsException, antlr.ParserException, java.io.FileNotFoundException, java.io.IOException
Note that if the ruleset contains any variables, fuzzy sets, and rules from a previous instantiation, these are removed from the ruleset before the source file is read. That is, the ruleset is cleared, and made to look like a newly created ruleset.
theFileName
- The source from which a rule file is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
public void instantiateFromXml(java.io.InputStream theInputStream, FsTrace theTracer, boolean theStopOnFsExceptionFlag) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ClassNotFoundException, FsException, org.xml.sax.SAXException, java.io.IOException
Note that if the ruleset contains any variables, fuzzy sets, and rules from a previous instantiation, these are removed from the ruleset before the source file is read. That is, the ruleset is cleared, and made to look like a newly created ruleset.
theStream
- The source from which an XML document is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
public void instantiateFromXml(java.io.File theFile, FsTrace theTracer, boolean theStopOnFsExceptionFlag) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ClassNotFoundException, FsException, org.xml.sax.SAXException, java.io.FileNotFoundException, java.io.IOException
Note that if the ruleset contains any variables, fuzzy sets, and rules from a previous instantiation, these are removed from the ruleset before the source file is read. That is, the ruleset is cleared, and made to look like a newly created ruleset.
theFileName
- The source from which an XML document is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
public void setRuleSetName(java.lang.String theRuleSetName) throws FsException
theRuleSetName
- The new name of the ruleset.
getRuleSetName()
public java.lang.String getRuleSetName()
setRuleSetName(java.lang.String)
public void setSrcFile(java.io.File theSrcFile)
This, and the following few methods, are used by the Fuzzy RuleSet Customizer program. When the customizer is told to save the source rules, this method is called so that the source file object may be temporarily saved across customizer sessions. Then, when the user selects "customize" from the Able Editor, the fuzzy customizer will be able to retrieve the file object and reload the source rule file.
If there is no source rule file, the customizer will try to reconstitute the source rules from the existing instantiated ruleset variables.
Note that the variable containing the source file is transient. This is because serialized objects will likely be transferred from system to system with possibly different file systems and file naming conventions. When this happens, it is not likely that the source file will accompany the serialized file, and if it should, it is not likely that the source file would appear within the same directory structure as it did on the originating system!
theSrcFile
- The file object containing source rules.
public java.io.File getSrcFile()
public void setSrcFileName(java.lang.String theSrcFileName)
theSrcFileName
- The name of the file containing source rules.
public java.lang.String getSrcFileName()
public void setSerFileName(java.lang.String theSerFileName) throws java.rmi.RemoteException
theSerFileName
- The name of the file containing a serialized fuzzy ruleset.
public void setXmlFileName(java.lang.String theXmlFileName) throws java.rmi.RemoteException
theXmlFileName
- The name of the file containing a fuzzy XML document.
public void setAlphaCut(double theAlphaCut) throws FsException
theAlphaCut
- The new alphacut threshold.
getAlphaCut()
public double getAlphaCut()
setAlphaCut(double)
public void setCorrelationMethod(int theCorrelationMethod) throws FsException
theCorrelationMethod
- The new correlation method.
Correlation methods are enumerated in class Fs.
getCorrelationMethod()
,
Fs.Product
,
Fs.Minimise
public int getCorrelationMethod()
setCorrelationMethod(int)
public void setDefuzzifyMethod(int theDefuzzifyMethod) throws FsException
theDefuzzifyMethod
- The new defuzzification method.
Defuzzification methods are enumerated in class Fs.
getDefuzzifyMethod()
,
Fs.Centroid
,
Fs.MaxHeight
public int getDefuzzifyMethod()
setDefuzzifyMethod(int)
public void setInferenceMethod(int theInferenceMethod) throws FsException
theInferenceMethod
- The new inference method.
Inference methods are enumerated in class Fs.
getInferenceMethod()
,
Fs.FuzzyAdd
,
Fs.MinMax
,
Fs.ProductOr
public int getInferenceMethod()
setInferenceMethod(int)
public void makeBooleanVariable(java.lang.String theVariableName, boolean theBooleanValue) throws FsException
Boolean variables may only take on the value True or False.
theVariableName
- The name of the new variable.
theBooleanValue
- The initial value of the variable. This is also the
value of the variable after a ruleset reset().
reset()
public void makeContinuousVariable(java.lang.String theVariableName, double theLoValue, double theHiValue) throws FsException
Continuous variables may take on any value within a universe of discourse, or range of values, delimited by theLoValue and theHiValue. Continuous variables may be given an initial "crisp" value, but during inferencing, the value of a continuous variable represents a fuzzy number within the universe of discourse. After inferencing, a crisp value can once again be obtained from the fuzzy value.
theVariableName
- The name of the new variable.
theLoValue
- Defines the low end of the universe of discourse.
theHiValue
- Defines the high end of the universe of discourse.
public void makeNumericVariable(java.lang.String theVariableName, double theNumericValue) throws FsException
Numeric variables may take on any arbitrary numeric value.
theVariableName
- The name of the new variable.
theNumericValue
- The initial value of the variable. This is also the
value of the variable after a ruleset reset().
reset()
public void makeSymbolicVariable(java.lang.String theVariableName, java.util.Hashtable theSymbolList) throws FsException
Symbolic variables may take on only a value that occurs in the specified symbol list.
theVariableName
- The name of the new variable.
theSymbolList
- The list of Symbols, any one of which can be the
current value of the symbolic variable.
The symbol list is a hashtable where the keys and objects are identical String objects. For example, String foo = "bar"; theSymbolList.put(foo,foo);
public boolean variableNameAlreadyExists(java.lang.String theVariableName)
theVariableName
- The name of a variable that might exist.
public boolean variableNamesAlreadyExist(java.util.Vector theVariableNames)
theVariableNames
- A list of names of variables that might exist.
public boolean variableNameIsUnused(java.lang.String theVariableName)
theVariableName
- The name of a variable that might exist.
public java.util.Hashtable getVariables()
public java.util.Vector resolveArgs(java.util.Vector theVariableNames)
theVariableNames
- A list of names of variables that are known to exist.
Note that this list must have been validated
before calling this method!
public void addBetaSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, double theSetPtCenter, double theSetFlexFactor, double theSetWeight) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theSetPtCenter
- Specifies the point on which the fuzzy set is to be
centered.
This point must be within the universe of discourse
for the specified continuous variable.
theSetFlexFactor
- The distance from the center point to the curve's inflexion
point at the 0.5 truth value.
theSetWeight
- A number, 0.1 to 1.0, that can attenuate the shape of the
set. The default is 1.0, which means that set is
unchanged. The lower the number, the flatter the shape.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
public void addComplementSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, java.lang.String theSetNameComplement) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of an existing fuzzy set that is to be
complemented.
theSetNameComplement
- The name of the newly created complement fuzzy set.
This name must not already exist for the continuous
variable.
public void addGaussianSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, double theSetPtCenter, double theSetWidthFactor) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theSetPtCenter
- Specifies the point on which the fuzzy set is to be
centered.
This point must be within the universe of discourse
for the specified continuous variable.
theSetWidthFactor
- Influences the width of the curve; typical values are from
0.9 to 5, inclusive.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
public void addLinearSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, double theSetPtBegin, double theSetPtEnd, int theSetDirection) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theSetPtBegin
- The point at which the line is to begin.
This point must be within the universe of discourse
for the specified continuous variable.
theSetPtEnd
- The point at which the line is to end.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be greater than the value for theSetPtBegin.
Note that it is not possible to define a set that is a perfectly vertical line, but one can specify points that are very close together. Note also, that due to the way truth values are stored, care must be taken that the points aren't too close together.
theSetDirection
- Whether the line is to slope up or down.
If the line slopes up, the beginning point (and all
points to the left) will have a truth value of 0.0 and
the end point (and all points to the right) will have
a truth value of 1.0. If the line slopes down, the
truth values are reversed.
Set directions are enumerated in class Fs.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
,
addShoulderSetToContinuousVariable(java.lang.String, java.lang.String, double, double, double, int)
,
Fs.Up
,
Fs.Down
public void addPiSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, double theSetPtCenter, double theSetWidth) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theSetPtCenter
- Specifies the point on which the fuzzy set is to be
centered.
This point must be within the universe of discourse
for the specified continuous variable.
theSetWidth
- Specifies the width of the curve from the center point
to an endpoint at the 0.0 truth value.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
public void addSegmentsSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, int theNumberOfSegments, double[] theScalarVector, double[] theTruthVector) throws FsException
This type of fuzzy set lets you draw any type of curve desired; however, the number of points is limited to the value contained in Fs.MaxValues. You draw the set by specifying a series of points and their truth values. Lines are interpolated between the specified scalar points.
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theNumberOfSegments
- Specifies the number of points and their truth values.
theScalarVector
- Specifies an array of points between which lines are
interpolated.
Each point in the array must be greater than the
previous point.
The size of this array must be equal to theNumberOfSegments.
theTruthVector
- Specifies, for each scalar in theScalarVector, the
truth value at that location.
The size of this array must be equal to theNumberOfSegments.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
,
Fs.MaxValues
public void addShoulderSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, double theSetPtBegin, double theSetPtEnd, int theSetDirection) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theSetPtBegin
- The point at which the line is to begin.
This point must be within the universe of discourse
for the specified continuous variable.
theSetPtEnd
- The point at which the line is to end.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be greater than the value for theSetPtBegin.
theSetDirection
- Whether the shoulder is a left shoulder or a right
shoulder. Left shoulders slope down, right shoulders
slope up.
Set directions are enumerated in class Fs.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
,
addLinearSetToContinuousVariable(java.lang.String, java.lang.String, double, double, double, int)
,
Fs.Left
,
Fs.Right
public void addSigmoidSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, double theSetPtBegin, double theSetPtEnd, double theSetPtFlex, int theSetDirection) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theSetPtBegin
- The point at which the sigmoidal curve is to begin.
This point must be within the universe of discourse
for the specified continuous variable.
theSetPtEnd
- The point at which the sigmoidal curve is to end.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be greater than the value for theSetPtBegin.
theSetPtFlex
- The point at which the sigmoidal curve is to flex.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be between the values for theSetPtBegin
and theSetPtEnd.
theSetDirection
- Whether the sigmoidal curve is to slope up or down.
If the curve slopes up, the beginning point (and all
points to the left) will have a truth value of 0.0 and
the end point (and all points to the right) will have
a truth value of 1.0. If the curve slopes down, the
truth values are reversed.
Set directions are enumerated in class Fs.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
,
Fs.Up
,
Fs.Down
public void addTrapezoidSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, double theSetPtLeft, double theSetPtLeftCore, double theSetPtRightCore, double theSetPtRight) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theSetPtLeft
- The point at which the lower left corner of the
trapezoid is placed.
This point must be within the universe of discourse
for the specified continuous variable.
theSetPtLeftCore
- The point at which the upper left corner of the
trapezoid is placed.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be greater than the value for theSetPtLeft.
theSetPtRightCore
- The point at which the upper right corner of the
trapezoid is placed.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be greater than the value for theSetPtLeftCore.
theSetPtRight
- The point at which the lower right corner of the
trapezoid is placed.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be greater than the value for theSetPtRightCore.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
public void addTriangleSetToContinuousVariable(java.lang.String theVariableName, java.lang.String theSetName, double theAlphaCut, double theSetPtLeft, double theSetPtCenter, double theSetPtRight) throws FsException
theVariableName
- The name of the continuous variable that is to have a
new fuzzy set added to it.
theSetName
- The name of the new fuzzy set. This name must not
already exist for the continuous variable.
theAlphaCut
- The alphacut for the newly created fuzzy set.
---------------------------------
theSetPtLeft
- The point at which the lower left corner of the
triangle is placed.
This point must be within the universe of discourse
for the specified continuous variable.
theSetPtCenter
- The point at which the upper point of the
triangle is placed.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be greater than the value for theSetPtLeft.
theSetPtRight
- The point at which the lower right corner of the
triangle is placed.
This point must be within the universe of discourse
for the specified continuous variable.
The value must be greater than the value for theSetPtCenter.
addComplementSetToContinuousVariable(java.lang.String, java.lang.String, java.lang.String)
public void addVariableToInputSequence(java.lang.String theVariableName) throws FsException
Variables that are in the input sequence have their values taken from an input buffer before inferencing begins. Explicitly, all assertions are fired, variables appearing in the input sequence are assigned values from the user's supplied input buffer, and then all conditional rules are fired. In this way, data supplied at runtime always takes precedence over data "hardcoded" in a ruleset.
Note that a variable may appear in the input sequence more than once, but because the input buffer (where the values come from) is a Hashtable, this has no significance. It simply means that a variable's value is loaded more than once.
theVariableName
- The name of a variable whose value is to be taken from the
input buffer before inferencing begins.
process()
public void addVariableToOutputSequence(java.lang.String theVariableName) throws FsException
Variables that are in the output sequence have their values written to an output buffer after inferencing ends.
Note that a variable may appear in the output sequence more than once, but because the output buffer (to where the values are written) is a Hashtable, this has no significance. It simply means that a variable's value is written more than once to the same key.
theVariableName
- The name of a variable whose value is to be written to the
output buffer after inferencing ends.
process()
public int getNumOutputVars()
public java.util.Vector getOutputVars()
public void makeUnconditionalRule(java.lang.String theRuleLabel, java.lang.String theRuleVarLhs, int theRuleOperator, java.lang.String theRuleHedges, java.lang.String theRuleValue, int theRuleValueType, java.util.Vector theCallParms) throws FsException
Examples:
rs.makeUnconditionalRule("label1", "myBooleanVariable", Fs.AsgnEq, "", "false", Fs.ValueTypeBoolean); rs.makeUnconditionalRule("label2", "myContinuousVariable", Fs.AsgnIs, "V", "Hot", Fs.ValueTypeSetName); rs.makeUnconditionalRule("label3", "myNumericVariable", Fs.AsgnEq, "", "3.141", Fs.ValueTypeNumber); rs.makeUnconditionalRule("label4", "mySymbolicVariable", Fs.AsgnEq, "", "abc", Fs.ValueTypeName); rs.makeUnconditionalRule("", "myNumericVariable", Fs.AsgnEq, "", "myOtherNumericVar", Fs.ValueTypeName);
theRuleLabel
- A human readable label, or tag, for the rule. The label can be
the empty string (""), but it must not be null. If a label
other than the empty string is given, the label must be unique
among all rules. Labels appear in traces and exceptions.
theRuleVarLhs
- The lefthand side of the rule. Currently, this must be the
name of an existing variable.
theRuleOperator
- The relation connecting the left- and righthand sides of the
rule. For assertions, this may be only an assignment type of
relation. Relations are enumerated in class FsOp (see below).
theRuleHedges
- If theRuleOperator is a fuzzy assignment operator and
theRuleValue is a fuzzy set, this can be a list of
hedges to be applied to the fuzzy set. Hedges are enumerated
in class Fs (see below).
If hedges are not used in the rule, theRuleHedges must be the empty string (""), and not null.
theRuleValue
- The righthand side of the rule. Depending on the lefthand side
of the rule, this can be a boolean literal ("true" or
"false"), a numeric literal (for example, "6.5275"), a
symbolic literal (for example, "abc"), the name of a variable,
or the name of a fuzzy set.
theRuleValueType
- Indicates the type of the string specified in
theRuleValue above. Value types are enumerated in class
Fs (see below).
FsOp
,
FsOp.AsgnEq
,
FsOp.AsgnIs
,
Fs
,
Fs.ValueTypeBoolean
,
Fs.ValueTypeName
,
Fs.ValueTypeNumber
,
Fs.ValueTypeSetName
public java.lang.Integer makeConditionalRule(java.lang.String theRuleLabel) throws FsException
Note that this rule has no antededent or consequent clauses and cannot be fired until such clauses are added to the rule using the returned rule key.
theRuleLabel
- A human readable label, or tag, for the rule. The label can be
the empty string (""), but it must not be null. If a label
other than the empty string is given, the label must be unique
among all rules. Labels appear in traces and exceptions.
addAntecedentToRule(java.lang.Integer, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, int, double, java.util.Vector)
,
addConsequentToRule(java.lang.Integer, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, int, java.util.Vector)
public java.util.Hashtable getRules()
public void addAntecedentToRule(java.lang.Integer theRuleId, java.lang.String theRuleLabel, java.lang.String theClauseVarLhs, int theClauseOperator, java.lang.String theClauseHedges, java.lang.String theClauseValue, int theClauseValueType, double theClauseWeight, java.util.Vector theCallParms) throws FsException
Note that there is no limit to the number of antecedent clauses for a rule, and that all antecedent clauses are connected by "and". "Or" capability can be achieved by left factoring.
theRuleId
- The key to a conditional rule; the key must
have been obtained from makeConditionalRule().
theRuleLabel
- A human readable label, or tag, for the rule. The label
must match the original label for the rule
identified by the rule Id.
theClauseVarLhs
- The lefthand side of the clause. Currently, this must be the
name of an existing variable.
theClauseOperator
- The relation connecting the left- and righthand sides of the
clause. This may be any type of comparison relation.
Relations are enumerated in class FsOp (see below).
theClauseHedges
- If theClauseOperator is a fuzzy assignment operator and
theClauseValue is a fuzzy set, this can be a list of
hedges to be applied to the fuzzy set. Hedges are enumerated
in class Fs (see below).
If hedges are not used in the rule, theClauseHedges must be the empty string (""), and not null.
theClauseValue
- The righthand side of the clause. Depending on the lefthand side
of the clause, this can be a boolean literal ("true" or
"false"), a numeric literal (for example, "6.5275"), a
symbolic literal (for example, "abc"), the name of a variable,
or the name of a fuzzy set.
theClauseValueType
- Indicates the type of the string specified in
theClauseValue above. Value types are enumerated in class
Fs (see below).
theClauseWeight
- Specifies the weight the clause should be given when it
evaluates to "true". You normally wouldn't use this for fuzzy
clauses, but as boolean clauses can skew the outcome (they
evaluate to 1.0 when true) you can use theClauseWeight to soften
the influence of boolean clauses when mixed with fuzzy clauses.
FsOp
,
FsOp.CmpEq
,
FsOp.CmpIs
,
Fs
,
Fs.ValueTypeBoolean
,
Fs.ValueTypeName
,
Fs.ValueTypeNumber
,
Fs.ValueTypeSetName
,
makeConditionalRule(java.lang.String)
public void addConsequentToRule(java.lang.Integer theRuleId, java.lang.String theRuleLabel, java.lang.String theClauseVarLhs, int theClauseOperator, java.lang.String theClauseHedges, java.lang.String theClauseValue, int theClauseValueType, java.util.Vector theCallParms) throws FsException
Note that currently a rule may have only one consequent. If this method is called multiple times, the current clause is replaced by the new one.
theRuleId
- The key to a conditional rule; the key must
have been obtained from makeConditionalRule().
theRuleLabel
- A human readable label, or tag, for the rule. The label
must match the original label for the rule
identified by the rule Id.
theClauseVarLhs
- The lefthand side of the clause. Currently, this must be the
name of an existing variable.
theClauseOperator
- The relation connecting the left- and righthand sides of the
clause. This may be any type of comparison relation.
Relations are enumerated in class FsOp (see below).
theClauseHedges
- If theClauseOperator is a fuzzy assignment operator and
theClauseValue is a fuzzy set, this can be a list of
hedges to be applied to the fuzzy set. Hedges are enumerated
in class Fs (see below).
If hedges are not used in the rule, theClauseHedges must be the empty string (""), and not null.
theClauseValue
- The righthand side of the clause. Depending on the lefthand side
of the clause, this can be a boolean literal ("true" or
"false"), a numeric literal (for example, "6.5275"), a
symbolic literal (for example, "abc"), the name of a variable,
or the name of a fuzzy set.
theClauseValueType
- Indicates the type of the string specified in
theClauseValue above. Value types are enumerated in class
Fs (see below).
theClauseWeight
- Specifies the weight the clause should be given when it
evaluates to "true". You normally wouldn't use this for fuzzy
clauses, but as boolean clauses can skew the outcome (they
evaluate to 1.0 when true) you can use theClauseWeight to soften
the influence of boolean clauses when mixed with fuzzy clauses.
FsOp
,
FsOp.CmpEq
,
FsOp.CmpIs
,
Fs
,
Fs.ValueTypeBoolean
,
Fs.ValueTypeName
,
Fs.ValueTypeNumber
,
Fs.ValueTypeSetName
,
makeConditionalRule(java.lang.String)
public boolean ruleLabelAlreadyExists(java.lang.String theRuleLabel)
Note that all rule labels within a ruleset must be unique.
theRuleLabel
- Any string that might be a rule label.
public boolean conditionalRuleIdExists(java.lang.Integer theRuleId)
Note that a unique key is created for each rule when a rule is added to the ruleset..
theRuleId
- The key to be checked.
public java.util.BitSet getInitialFactBase()
public void defineEffector(java.lang.String theEffectorName) throws FsException
theEffectorName
- The name of an effector that will be available at runtime.
public java.util.Hashtable getDefinedEffectors() throws java.rmi.RemoteException
public boolean effectorNameAlreadyExists(java.lang.String theEffectorName)
theEffectorName
- The name of an effector that might exist.
public boolean effectorNameIsUnused(java.lang.String theEffectorName)
theEffectorName
- The name of an effector that might exist.
public void defineSensor(java.lang.String theSensorName) throws FsException
theSensorName
- The name of a sensor that will be available at runtime.
public java.util.Hashtable getDefinedSensors() throws java.rmi.RemoteException
public boolean sensorNameAlreadyExists(java.lang.String theSensorName)
theSensorName
- The name of a sensor that might exist.
public boolean sensorNameIsUnused(java.lang.String theSensorName)
theSensorName
- The name of a sensor that might exist.
public boolean definedSensorEffector(java.lang.String theName, boolean theSensorFlag)
theName
- The name of a sensor or an effector that might exist.
theSensorFlag
- If true, the name is checked against the list
of known sensors; otherwise the name is checked
against the list of known effectors. This method
checks one list or the other, not both!
public void process(java.util.Hashtable theInputBuffer, java.util.Hashtable theOutputBuffer) throws FsException
The order of processing is as follows:
theInputBuffer
- The key to each element in the input buffer is a String
containing the name of a variable. The object
associated with each key must be a Boolean, Double, or
String object which will become the value of the named
variable.
theOutputBuffer
- is an empty hashtable to which variable names and their
values will be written when inferencing is complete.
Note that any elements in this hashtable will be cleared before output is written to it.
isExecutable()
,
reset()
public boolean isExecutable()
The ruleset is executable if:
public boolean ioBuffersOK() throws java.rmi.RemoteException
public void clear()
public java.lang.String rlString()
public java.lang.String xmlString()
public FsTrace getBaseTraceObject()
public FsTrace getInfrTraceObject()
public void setBaseTraceActive(boolean theTraceValue)
theTraceValue
- Use true to turn tracing on, false to
turn it off.
FsTrace
,
isBaseTraceActive()
public boolean isBaseTraceActive()
FsTrace.isActive()
public void setInferencingTraceActive(boolean theTraceValue)
theTraceValue
- Use true to turn tracing on, false to
turn it off.
FsTrace
,
isBaseTraceActive()
public boolean isInferencingTraceActive()
FsTrace.isActive()
public void addFuzzyChangeListener(java.beans.PropertyChangeListener theListener)
theListener
- Any property change listener.
AbleObject.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removeFuzzyChangeListener(java.beans.PropertyChangeListener theListener)
theListener
- Any previously added property change listener.
AbleObject.addPropertyChangeListener(java.beans.PropertyChangeListener)
public java.lang.String toString()
public static java.lang.String Copyright()
|
ABLE, Version 1.1b | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |