|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.data.AbleLhs | +--com.ibm.able.data.AbleVariable | +--com.ibm.able.data.AbleContinuousVariable | +--com.ibm.able.data.AbleFuzzyVariable
This class represents a FuzzySet value subject to a minimum and maximum value called the range of discource. An object of type AbleFuzzyVariable contains one or more FuzzySets defined over the variable, a Fuzzy value, as well as a crisp value whose type is double. Instances of AbleFuzzyVariable are used by the Able rules classes in clauses and expressions. In addition, this class provides methods for converting a Fuzzy value to other datatypes, setting a Fuzzy value using other datatypes, as well as other logical comparison and math operator methods useful when dealing with a Fuzzy value. *
Field Summary | |
---|---|
protected double |
myAlphaCut
The alphacut level associated with this fuzzy variable |
protected int |
myDefuzzifyMethod
Specifies the method used to turn a fuzzy value into a crisp number. |
protected java.util.Hashtable |
mySetList
A list of fuzzy sets defined over this variable. |
protected double |
myValCrisp
The crisp value of the fuzzy solution variable (if known). |
protected AbleFuzzySetWork |
myValFzy
The fuzzy solution variable. |
protected AbleFuzzySetWork |
myValFzyTmp
Fuzzy working space to hold temporary copies. |
protected boolean |
myValKnown
Indicates whether the crisp value is known (true) or undefined (false). |
Fields inherited from class com.ibm.able.data.AbleContinuousVariable |
---|
myDiscourseHi, myDiscourseLo, myInitialValue, myValue |
Fields inherited from class com.ibm.able.data.AbleVariable |
---|
myBoundFlag, myChgSupport, myComment, myContext, myDataType, myGlobalFlag, myId, myName, myPrompt, myReferences, myStaticFlag, myTemplateFlag, myValueInitial |
Constructor Summary | |
---|---|
AbleFuzzyVariable(java.lang.String theName,
boolean theStaticFlag,
boolean theGlobalFlag,
double theDiscourseLo,
double theDiscourseHi,
double theAlphaCut)
Create a new fuzzy variable with the specified universe of discourse. |
|
AbleFuzzyVariable(java.lang.String theName,
double theDiscourseLo,
double theDiscourseHi,
double theAlphaCut)
Create a new fuzzy variable with the specified universe of discourse. |
Method Summary | |
---|---|
void |
addSet(AbleFuzzySetBeta theSet)
|
void |
addSet(AbleFuzzySetGaussian theSet)
|
void |
addSet(AbleFuzzySetLinear theSet)
|
void |
addSet(AbleFuzzySetPi theSet)
|
void |
addSet(AbleFuzzySetSegments theSet)
|
void |
addSet(AbleFuzzySetShoulder theSet)
|
void |
addSet(AbleFuzzySetSigmoid theSet)
|
void |
addSet(AbleFuzzySetTrapezoid theSet)
|
void |
addSet(AbleFuzzySetTriangle theSet)
|
void |
addSetComplement(java.lang.String theSetName,
java.lang.String theCompName)
|
java.lang.String |
arlDclString()
Return a formal ARL "declaration" string that describes this data object. |
void |
asgnIs(AbleRd theRhs)
Assignment (fuzzy): assign the current value of theRhs to this data object. |
void |
asgnIs(AbleRd theRhs,
double theTruthValue)
Assignment (fuzzy): assign the current value of theRhs to this data object, correlated with the specified truth value. |
boolean |
cmpEq(AbleRd theRhs)
Comparison, equal to: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpGt(AbleRd theRhs)
Comparison, greater than: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpGtEq(AbleRd theRhs)
Comparison, greater than or equal to: compare the current value of this data object to the current value of theRhs. |
double |
cmpIs(AbleRd theRhs)
Comparison, fuzzy equal to: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpLt(AbleRd theRhs)
Comparison, less than: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpLtEq(AbleRd theRhs)
Comparison, less than or equal to: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpNeq(AbleRd theRhs)
Comparison, not equal to: compare the current value of this data object to the current value of theRhs. |
AbleLiteral |
compDivide(AbleRd theRhs)
Compute, divide the current value of this data object by the current value of theRhs. |
AbleLiteral |
compMinus(AbleRd theRhs)
Compute, subtract the current value of theRhs from the current value of this object. |
AbleLiteral |
compMultiply(AbleRd theRhs)
Compute, multiply the current value of this data object to the current value of theRhs. |
AbleLiteral |
compPlus(AbleRd theRhs)
Compute, add or concatenate the current value of this data object to the current value of theRhs. |
AbleLiteral |
compUnaryMinus(AbleRd theRhs)
Compute, the unary minus of the current value of this object. |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
boolean |
getBooleanValue()
Retrieve the value of this data object as a boolean value. |
java.lang.Class |
getDataTypeClass()
Retrieve the actual class of this object's underlying data type. |
java.lang.String |
getDataTypeClassName()
Retrieve the name of the class of this object's underlying data type. |
int |
getDefuzzifyMethod()
Retrieve the current defuzzification method. |
java.util.Hashtable |
getFuzzySets()
|
AbleFuzzySet |
getFuzzyValue()
Retrieve the value of this data object as a fuzzy value. |
AbleFuzzySet |
getFuzzyWorkArea()
Retrieve the fuzzy work area of this continuous variable. |
java.lang.Object |
getGenericValue()
Retrieve the value of this data object as an Object. |
double |
getNumericValue()
Retrieve the value of this data object as a numeric value. |
AbleFuzzySet |
getOrAddHedgedSet(java.lang.String theSetName,
java.lang.String theHedges)
|
AbleFuzzySet |
getSet(java.lang.String theSetName)
|
java.lang.String |
getStringValue()
Retrieve the value of this data object as a string value. |
AbleLiteral |
getValue()
Retrieve the value of this data object as a literal. |
java.lang.String |
getValueString()
Retrieve the variable's current (crisp) value as a string. |
void |
replaceSetSegments(java.lang.String theFuzzySetName,
double[] theTruthVector)
Replace the contents of an existing fuzzy set with new curve |
void |
reset()
Reset the variable to its intial state. |
void |
setAlphaCut(double theAlphaCut)
|
void |
setBooleanValue(boolean theNewValue)
Set the value of this data object from a boolean value. |
void |
setDefuzzifyMethod(int theDefuzzifyMethod)
Set the defuzzification method to the specified type. |
void |
setDiscourseRange(double theValueLo,
double theValueHi)
Set the variable's discourse range. |
boolean |
setExist(java.lang.String theSetName)
|
void |
setFuzzyValue(AbleFuzzySet theNewValue)
Set the value of this data object from a fuzzy value. |
void |
setGenericValue(java.lang.Object theNewValue)
Set the value of this data object from an object. |
void |
setNumericValue(double theNewValue)
Set the value of this data object from a numeric value. |
void |
setStringValue(java.lang.String theNewValue)
Set the value of this data object from a string value. |
void |
setValue(AbleLiteral theNewValue)
Set the value of this data object from a literal object. |
void |
setValueString(java.lang.String theNewValue)
Set the variable's current (crisp) value from a string. |
java.lang.String |
toString()
Retrieve a string describing (the contents of) the object. |
java.lang.String |
traceString(int theTraceStringFlavor)
Retrieve a string describing (the contents of) the object. |
protected void |
validateSetBasics(AbleFuzzySet theSet)
|
java.lang.String |
xmlCWrString()
Return a formal XML "clause write" string that describes this data object. |
java.lang.String |
xmlDclString()
Return a formal XML "declaration" string that describes this data object. |
Methods inherited from class com.ibm.able.data.AbleContinuousVariable |
---|
asgnEq, chkRange, getDataTypeName, getDiscourseHi, getDiscourseLo, getLiteralClass, init, setDiscourseHi, setDiscourseLo, setInitialValue, withinUniverseOfDiscourse |
Methods inherited from class com.ibm.able.data.AbleVariable |
---|
arlCRdString, arlInitializerString, getArlComment, getChgSupport, getComment, getContext, getDataType, getDataTypeAsString, getId, getName, getPrompt, getPromptString, getReferences, getReferent, getReferents, getTemplateString, isBound, isConstant, isGlobal, isLocal, isStatic, isTemplate, notStatic, setChgSupport, setComment, setContext, setId, setPrompt, setReferences, setStatic, setTemplate, xmlCRdString, xmlInitializerString |
Methods inherited from class com.ibm.able.data.AbleLhs |
---|
bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, bitwiseXOR, compModulo, logicalAND, logicalNOT, logicalOR |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.util.Hashtable mySetList
protected double myValCrisp
protected AbleFuzzySetWork myValFzy
protected boolean myValKnown
protected AbleFuzzySetWork myValFzyTmp
protected double myAlphaCut
protected int myDefuzzifyMethod
Constructor Detail |
public AbleFuzzyVariable(java.lang.String theName, double theDiscourseLo, double theDiscourseHi, double theAlphaCut)
The initial fuzzy value of this variable cannot be specified. Since there is no initial fuzzy value, the crisp value is set to Double.NaN.
theName
- The unique name of the variable.
theDiscourseLo
- The lowest value that this variable may assume.
theDiscourseHi
- The highest value that this variable may assume.
theAlphaCut
- The low truth value cutoff point. This is usually
taken from the variable's containing fuzzy ruleset.
public AbleFuzzyVariable(java.lang.String theName, boolean theStaticFlag, boolean theGlobalFlag, double theDiscourseLo, double theDiscourseHi, double theAlphaCut)
The initial fuzzy value of this variable cannot be specified. Since there is no initial fuzzy value, the crisp value is set to Double.NaN.
theName
- The unique name of the variable.
theStaticFlag
- Use true if this variable is to be marked as
static, which means that it will ignore future reset
requests; use false if the variable can be
reset to its initial value when requested.
theGlobalFlag
- Use true if this variable is to be considered
global;
use false if the variable is to be considered
local.
theDiscourseLo
- The lowest value that this variable may assume.
theDiscourseHi
- The highest value that this variable may assume.
theAlphaCut
- The low truth value cutoff point. This is usually
taken from the variable's containing fuzzy ruleset.
Method Detail |
public boolean getBooleanValue() throws AbleDataException
getBooleanValue
in class AbleContinuousVariable
AbleDataException
- If the value of this object cannot be represented as
a boolean value.public AbleFuzzySet getFuzzyValue() throws AbleDataException
getFuzzyValue
in class AbleContinuousVariable
AbleDataException
- If the value of this object cannot be represented as
a fuzzy value.public java.lang.Object getGenericValue() throws AbleDataException
getGenericValue
in class AbleContinuousVariable
AbleDataException
- If the value of this object cannot be represented as
an Object.public double getNumericValue() throws AbleDataException
getNumericValue
in class AbleContinuousVariable
AbleDataException
- If the value of this object cannot be represented as
a numeric value.public java.lang.String getStringValue() throws AbleDataException
getStringValue
in class AbleContinuousVariable
AbleDataException
- If the value of this object cannot be represented as
a string value.public AbleLiteral getValue() throws AbleDataException
getValue
in class AbleContinuousVariable
AbleDataException
- If the value of this object cannot be represented as
a literal.
public double cmpIs(AbleRd theRhs) throws AbleDataException
Fuzzy membership is used for the compare.
cmpIs
in class AbleLhs
theRhs
- The right-hand side of the comparison.
This must be a fuzzy set.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public void setBooleanValue(boolean theNewValue) throws AbleDataException
setBooleanValue
in class AbleContinuousVariable
theNewValue
- A boolean value.
AbleDataException
- If the value of this object cannot be represented as
a boolean value.public void setFuzzyValue(AbleFuzzySet theNewValue) throws AbleDataException
setFuzzyValue
in class AbleContinuousVariable
theNewValue
- A fuzzy set.
AbleDataException
- If the value of this object cannot be represented as
a fuzzy value.public void setGenericValue(java.lang.Object theNewValue) throws AbleDataException
setGenericValue
in class AbleContinuousVariable
theNewValue
- Any type of Object.
AbleDataException
- If the value of this object cannot be derived from
the specified Object.public void setNumericValue(double theNewValue) throws AbleDataException
setNumericValue
in class AbleContinuousVariable
theNewValue
- Any number. If the number is not within the universe
of discourse for this variable, an exception is
thrown. The crisp value is set.
AbleDataException
- If the value of this object cannot be represented as
a numeric value.public void setStringValue(java.lang.String theNewValue) throws AbleDataException
setStringValue
in class AbleContinuousVariable
theNewValue
- A string.
The variable is set to the value of the string, but
only if the string can be parsed to a double and that
number is within the universe of discourse for this
variable.
Otherwise an exception is thrown.
AbleDataException
- If the value of this object cannot be represented as
a string value.public void setValue(AbleLiteral theNewValue) throws AbleDataException
setValue
in class AbleContinuousVariable
theNewValue
- An Able literal of any type. An attempt is made to
convert the literal to an appropriate type before
assigning it to this "writable" object. The resulting
number must be within the universe of discourse for
this variable.
AbleDataException
- If the value of this object cannot be determined
from the literal object.public java.lang.String arlDclString()
arlDclString
in class AbleContinuousVariable
public java.lang.String xmlDclString()
xmlDclString
in class AbleContinuousVariable
public java.lang.String xmlCWrString()
xmlCWrString
in class AbleVariable
public void asgnIs(AbleRd theRhs) throws AbleDataException
asgnIs
in class AbleLhs
theRhs
- The right-hand, or source, side of the assignment.
This must be a fuzzy set.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and assigned to this data object.public void asgnIs(AbleRd theRhs, double theTruthValue) throws AbleDataException
asgnIs
in class AbleLhs
theRhs
- The right-hand, or source, side of the assignment.
This must be a fuzzy set.
theTruthValue
- the truth value with which theRhs is correlated.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and assigned to this data object.public boolean cmpEq(AbleRd theRhs) throws AbleDataException
"==" is used for numeric and boolean compares; equals() is used for Object compares; and Collator.equals() is used for String compares.
cmpEq
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpGt(AbleRd theRhs) throws AbleDataException
">" is used for numeric compares; Collator.compare() is used for String compares. Use of other data types on the left-hand side causes an exception.
cmpGt
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpGtEq(AbleRd theRhs) throws AbleDataException
">=" is used for numeric compares; Collator.compare() is used for String compares. Use of other data types on the left-hand side causes an exception.
cmpGtEq
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpLt(AbleRd theRhs) throws AbleDataException
"<" is used for numeric compares; Collator.compare() is used for String compares. Use of other data types on the left-hand side causes an exception.
cmpLt
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpLtEq(AbleRd theRhs) throws AbleDataException
"<=" is used for numeric compares; Collator.compare() is used for String compares. Use of other data types on the left-hand side causes an exception.
cmpLtEq
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpNeq(AbleRd theRhs) throws AbleDataException
"!=" is used for numeric and boolean compares; ! equals() is used for Object compares; and ! Collator.equals() is used for String compares.
cmpNeq
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compPlus(AbleRd theRhs) throws AbleDataException
"+" is used for numeric addtion and String concatenation.
compPlus
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compMinus(AbleRd theRhs) throws AbleDataException
"-" is used for numeric subtraction.
compMinus
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compMultiply(AbleRd theRhs) throws AbleDataException
"*" is used for numeric multiplication.
compMultiply
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compDivide(AbleRd theRhs) throws AbleDataException
"/" is used for numeric division.
compDivide
in class AbleContinuousVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compUnaryMinus(AbleRd theRhs) throws AbleDataException
"-" is used for numeric negation.
compUnaryMinus
in class AbleContinuousVariable
theRhs
- The right-hand side of the operation (ignored).
AbleDataException
- If the value of this data object cannot be negated.public void setValueString(java.lang.String theNewValue) throws AbleDataException
setValueString
in class AbleContinuousVariable
public java.lang.String getValueString()
getValueString
in class AbleContinuousVariable
public void reset() throws AbleDataException
reset
in class AbleContinuousVariable
public java.lang.Class getDataTypeClass()
AbleLhs
getDataTypeClass
in class AbleContinuousVariable
com.ibm.able.data.AbleLhs
public java.lang.String getDataTypeClassName()
AbleLhs
getDataTypeClassName
in class AbleContinuousVariable
com.ibm.able.data.AbleLhs
public java.util.Hashtable getFuzzySets()
public AbleFuzzySet getFuzzyWorkArea()
public boolean setExist(java.lang.String theSetName)
public AbleFuzzySet getSet(java.lang.String theSetName)
public AbleFuzzySet getOrAddHedgedSet(java.lang.String theSetName, java.lang.String theHedges) throws AbleDataException
public void addSet(AbleFuzzySetBeta theSet) throws AbleDataException
public void addSet(AbleFuzzySetGaussian theSet) throws AbleDataException
public void addSet(AbleFuzzySetLinear theSet) throws AbleDataException
public void addSet(AbleFuzzySetPi theSet) throws AbleDataException
public void addSet(AbleFuzzySetSegments theSet) throws AbleDataException
public void addSet(AbleFuzzySetShoulder theSet) throws AbleDataException
public void addSet(AbleFuzzySetSigmoid theSet) throws AbleDataException
public void addSet(AbleFuzzySetTrapezoid theSet) throws AbleDataException
public void addSet(AbleFuzzySetTriangle theSet) throws AbleDataException
protected void validateSetBasics(AbleFuzzySet theSet) throws AbleDataException
public void addSetComplement(java.lang.String theSetName, java.lang.String theCompName) throws AbleDataException
public void setAlphaCut(double theAlphaCut)
public final int getDefuzzifyMethod()
public void setDefuzzifyMethod(int theDefuzzifyMethod) throws AbleDataException
theDefuzzifyMethod
- The new defuzzification method.
AbleDataException
- If the specified defuzzification method is not
recognised.public void setDiscourseRange(double theValueLo, double theValueHi)
theValueLo
- The new minimum value that the variable may assume.
theValueHi
- The new maximum value that the variable may assume.
public void replaceSetSegments(java.lang.String theFuzzySetName, double[] theTruthVector) throws AbleDataException
theFuzzySetName
- The name of the fuzzy set we want to replace. It must already existtheTruthVector
- The array of truth valuespublic java.lang.String toString()
toString
in class AbleContinuousVariable
public java.lang.String traceString(int theTraceStringFlavor)
traceString
in class AbleContinuousVariable
theFlavor
- An Able.TraceStringFlavor value.
public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |