|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nrc.fuzzy.FuzzyVariable
This class defines a FuzzyVariable, which consists of a name (for example, temperature) the units of the variable if required (for example, degrees C), the universe of discourse for the variable (for example a range from 0 to 100), and a set of fuzzy terms that will be used when describing the fuzzy variable. The fuzzy terms are described using a term name such as hot, along with a FuzzySet that represents that term. The fuzzy variable terms along with a set of fuzzy modifiers, the operators 'and' and 'or' (fuzzy set intersection and union respectively) and the left and right parentheses provide the basis for a grammar that allows one to write fuzzy linguistic expressions that describe fuzzy concepts in an english-like manner. For example,
(very hot or warm) and slightly cold
consists of the terms hot, warm and cold, along with the fuzzy modifiers
very and slightly.
A FuzzyVariable is normally used in the creation of a FuzzyValue which associates a FuzzySet with a FuzzyVariable. This allows the FuzzySets to be described using the linguistic expressions definable with the FuzzyVaraible terms and restricted by the universe of discourse for the variable.
NOTE: linguistic expressions are case insensitive!!
NOTE ALSO: All names for terms must not have spaces, ) or ( in them. They must also not be AND or OR. They might be the same as some existing modifier and then would override the modifier (not generally a good thing to do).
The following incomplete set of code shows a simple example of creating a FuzzyVariable and a FuzzyValue:
double xHot[] = {25, 35};
double yHot[] = {0, 1};
double xCold[] = {5, 15};
double yCold[] = {1, 0};
FuzzyValue fval = null;
...
FuzzyVariable temp = new FuzzyVariable("temperature", 0, 100, "C");
...
temp.addTerm("hot", xHot, yHot, 2);
temp.addTerm("cold", xCold, yCold, 2);
// note: once a term is added it can be used to define other terms
temp.addTerm("medium", "not hot and not cold");
...
fval = new FuzzyValue(temp, "very hot or cold");
System.out.println(fval);
The output from this would be:
FuzzyVariable -> temperature [ 0.0, 100.0 ] C
Linguistic Expression -> very hot or cold
FuzzySet -> { 1/5 0/15 0/25 0.01/26 0.04/27 0.09/28 0.16/29 0.25/30
0.36/31 0.49/32 0.64/33 0.81/34 1/35 }
FuzzyValue
,
FuzzySet
,
Modifiers
,
ModifierFunction
,
FuzzyScanner
,
FuzzyValue
,
Serialized FormConstructor Summary | |
FuzzyVariable(java.lang.String n,
double UODlower,
double UODupper)
Create a FuzzyVariable (with no Fuzzy Terms) not specifying the units (defaults to empty string) |
|
FuzzyVariable(java.lang.String n,
double UODlower,
double UODupper,
java.lang.String u)
Create a FuzzyVariable (with no Fuzzy Terms) specifying units |
|
FuzzyVariable(java.lang.String n,
double UODlower,
double UODupper,
java.lang.String[] terms,
nrc.fuzzy.FuzzySet[] fuzzySets,
int numTerms)
Create a FuzzyVariable (with Fuzzy Terms) not specifying the units (defaults to empty string) |
|
FuzzyVariable(java.lang.String n,
double UODlower,
double UODupper,
java.lang.String u,
java.lang.String[] terms,
nrc.fuzzy.FuzzySet[] fuzzySets,
int numTerms)
Create a FuzzyVariable (with Fuzzy Terms) specifying units |
Method Summary | |
nrc.fuzzy.FuzzyValue |
addTerm(java.lang.String term,
double[] x,
double[] y,
int numPoints)
Add a term description to the FuzzyVariable. |
nrc.fuzzy.FuzzyValue |
addTerm(java.lang.String term,
nrc.fuzzy.FuzzySet fset)
Add a term description to the FuzzyVariable. |
nrc.fuzzy.FuzzyValue |
addTerm(java.lang.String term,
nrc.fuzzy.SetPoint[] setPoints,
int numPoints)
Add a term description to the FuzzyVariable. |
nrc.fuzzy.FuzzyValue |
addTerm(java.lang.String term,
java.lang.String linguisticExpr)
Add a term description to the FuzzyVariable. |
nrc.fuzzy.FuzzyValue |
findTerm(java.lang.String term)
Return the fuzzy value that represents a fuzzy term for the fuzzy variable. |
java.util.Enumeration |
findTermNames()
Return an enumeration that contains the names of the terms of the fuzzy variable. |
java.util.Enumeration |
findTerms()
Return an enumeration that contains the set of fuzzy values that represent the fuzzy terms of the fuzzy variable. |
double |
getMaxUOD()
Retrieve the maximum value of the Universe of Discourse of the FuzzyVariable |
double |
getMinUOD()
Retrieve the minimum value of the Universe of Discourse of the FuzzyVariable |
java.lang.String |
getName()
Retrieve the FuzzyVariable's name. |
java.lang.String |
getUnits()
Retrieve the FuzzyVariable's Units string |
nrc.fuzzy.FuzzyValue |
removeTerm(java.lang.String term)
Removes the fuzzy term identified by the term name from the fuzzy variable. |
void |
removeTerms()
Remove all terms from the fuzzy variable. |
java.lang.String |
toString()
Returns the String representation of the FuzzyVariable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FuzzyVariable(java.lang.String n, double UODlower, double UODupper, java.lang.String u) throws InvalidFuzzyVariableNameException, InvalidUODRangeException
n
- the name of the fuzzy variable (such as temperature)UODlower
- the lower limit of the Universe of Discourseu
- the units for the variable (such as Degrees C)
InvalidFuzzyVariableNameException
InvalidUODRangeException
public FuzzyVariable(java.lang.String n, double UODlower, double UODupper) throws InvalidFuzzyVariableNameException, InvalidUODRangeException
n
- the name of the fuzzy variable (such as temperature)UODlower
- the lower limit of the Universe of Discourse
InvalidUODRangeException
InvalidFuzzyVariableNameException
public FuzzyVariable(java.lang.String n, double UODlower, double UODupper, java.lang.String u, java.lang.String[] terms, nrc.fuzzy.FuzzySet[] fuzzySets, int numTerms) throws InvalidFuzzyVariableNameException, InvalidUODRangeException, XValueOutsideUODException, InvalidFuzzyVariableTermNameException
n
- the name of the fuzzy variable (such as temperature)UODlower
- the lower limit of the Universe of Discourseu
- the units for the variable (such as Degrees C)terms
- array of names of terms to be added to the FuzzyVariablefuzzySets
- array of FuzzySets of terms to be added to the FuzzyVariablenumTerms
- number of terms to be added
InvalidFuzzyVariableNameException
InvalidUODRangeException
XValueOutsideUODException
InvalidFuzzyVariableTermNameException
public FuzzyVariable(java.lang.String n, double UODlower, double UODupper, java.lang.String[] terms, nrc.fuzzy.FuzzySet[] fuzzySets, int numTerms) throws InvalidFuzzyVariableNameException, InvalidUODRangeException, XValueOutsideUODException, InvalidFuzzyVariableTermNameException
n
- the name of the fuzzy variable (such as temperature)UODlower
- the lower limit of the Universe of Discourseterms
- array of names of terms to be added to the FuzzyVariablefuzzySets
- array of FuzzySets of terms to be added to the FuzzyVariablenumTerms
- number of terms to be added
InvalidUODRangeException
InvalidFuzzyVariableNameException
XValueOutsideUODException
InvalidFuzzyVariableTermNameException
Method Detail |
public java.lang.String getName()
public java.lang.String getUnits()
public double getMinUOD()
public double getMaxUOD()
public nrc.fuzzy.FuzzyValue findTerm(java.lang.String term)
term
- the term name to be accessed (eg hot)
public java.util.Enumeration findTerms()
public java.util.Enumeration findTermNames()
public nrc.fuzzy.FuzzyValue removeTerm(java.lang.String term)
term
- the term name to be accessed (eg hot)
public void removeTerms()
public nrc.fuzzy.FuzzyValue addTerm(java.lang.String term, nrc.fuzzy.FuzzySet fset) throws XValueOutsideUODException, InvalidFuzzyVariableTermNameException
term
- the name of the term being addedfset
- the FuzzySet that represents the term
XValueOutsideUODException
InvalidFuzzyVariableTermNameException
public nrc.fuzzy.FuzzyValue addTerm(java.lang.String term, double[] x, double[] y, int numPoints) throws XValuesOutOfOrderException, YValueOutOfRangeException, XValueOutsideUODException, InvalidFuzzyVariableTermNameException
term
- the name of the term being addedx
- the x values of a FuzzySet that represents the termy
- the y values of a FuzzySet that represents the termnumPoints
- the number of points in these x and y arrays
XValuesOutOfOrderException
YValueOutOfRangeException
XValueOutsideUODException
InvalidFuzzyVariableTermNameException
public nrc.fuzzy.FuzzyValue addTerm(java.lang.String term, nrc.fuzzy.SetPoint[] setPoints, int numPoints) throws XValuesOutOfOrderException, YValueOutOfRangeException, XValueOutsideUODException, InvalidFuzzyVariableTermNameException
term
- the name of the term being addednumPoints
- the number of points in the setPoints arrays
XValuesOutOfOrderException
YValueOutOfRangeException
XValueOutsideUODException
InvalidFuzzyVariableTermNameException
SetPoint
public nrc.fuzzy.FuzzyValue addTerm(java.lang.String term, java.lang.String linguisticExpr) throws InvalidLinguisticExpressionException, InvalidFuzzyVariableTermNameException
term
- the name of the term being addedlinguisticExpr
- the english-like string that specifies a fuzzy value.
Uses the existing defined terms of the FuzzyVariable along with
defined fuzzy modifiers and the operators 'and' and 'or'.
InvalidLinguisticExpressionException
InvalidFuzzyVariableTermNameException
Modifiers
public java.lang.String toString()
For example:
FuzzyVariable -> temperature [ 0.0, 100.0 ] C Terms: hot -> { 0/25 1/35 } medium -> { 0/5 1/15 1/25 0/35 } cold -> { 1/5 0/15 }
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |