|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nrc.fuzzy.ZFunction
An implementation of the FuzzySetFunction interface to provide
a class with the ability to generate a FuzzySet that is a
Z-shaped curve with membership value 1 on the upper left to 0 on the lower right.
This class is typically used when constructing instances of the classes
RFuzzySet and LRFuzzySet. The PIFuzzySet for example is constructed using
the SFunction to create its left half and the ZFunction to create its
right half.
The ZFunction membership values (y values) are calculated as follows:
leftX is the lower left X value
rightX is the upper right X value
midpoint is the x value half way between leftX and rightX
sqr is the square root function
if x is <= leftX then y = 1.0
if x is between leftX and the midpoint
then y = 1 - 2*sqr(((x - leftX)/(rightX - leftX)))
if x is midpoint then y = 0.5
if x is between the midpoint and rightX
then y = 2*sqr(((x - rightX)/(rightX - leftX)))
if x is >= rightX then y = 0.0
RFuzzySet
,
LRFuzzySet
,
PIFuzzySet
,
SFunction
,
Serialized FormConstructor Summary | |
ZFunction()
Creates an instance of a ZFunction that is used to generate Fuzzysets with a Z-shape. |
|
ZFunction(int numPoints)
Creates an instance of an SZFunction that is used to generate Fuzzysets with a Z-shape. |
Method Summary | |
nrc.fuzzy.FuzzySet |
generateFuzzySet(double leftX,
double rightX)
Creates a FuzzySet with a Z-shape such that the membership value is 1 at the leftX value and 0 at the rightX value. |
nrc.fuzzy.FuzzySet |
generateFuzzySet(double leftX,
double rightX,
int numberOfPoints)
Creates a FuzzySet with a Z-shape such that the membership value is 1 at the leftX value and 0 at the rightX value. |
protected int |
returnCorrectedNumPoints(int numPoints)
Keeps the values for the number of points in the S-shaped curve to be >= 3 and odd. |
static void |
setDefaultNumberOfPoints(int numPoints)
Sets the value of the zFunctionDefaultNumPoints static (class) variable. |
void |
setNumPoints(int numPoints)
Sets the value of the defaultNumPoints variable. |
protected static double |
zMembership(double x,
double leftX,
double flexPoint,
double rightX)
Calculates a membership value for an X value in the Z-shaped function. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZFunction()
public ZFunction(int numPoints)
numPoints
- the number of points to use when creating the Z-shaped FuzzySet.Method Detail |
public nrc.fuzzy.FuzzySet generateFuzzySet(double leftX, double rightX)
defaultNumPoints
and the static class variable
zFunctionDefaultNumPoints
.
generateFuzzySet
in interface FuzzySetFunction
leftX
- the bottom left x value of the Z-shaped curve.rightX
- the upper right x value of the Z-shaped curve.
public nrc.fuzzy.FuzzySet generateFuzzySet(double leftX, double rightX, int numberOfPoints)
generateFuzzySet
in interface FuzzySetFunction
leftX
- the bottom left x value of the Z-shaped curve.rightX
- the upper right x value of the Z-shaped curve.numberOfPoints
- the number of points to be used when generating the
Z-shaped curve.
protected static double zMembership(double x, double leftX, double flexPoint, double rightX)
x
- the x value at which we want to get the membership valueleftX
- the leftmost X value of the Z-shaped curveflexPoint
- the point of flex (symmetry) for the curverightX
- the rightmost X value of the Z-shaped curvepublic void setNumPoints(int numPoints)
generateFuzzySet(double leftX, double rightX)
method,
unless it has a value of < 3, in which case the value of static (class)
variable, zFunctionDefaultNumPoints, will be used. This allows
each instance of the ZFunction to determine its own value for the number
of points to be generated. Initially it is set to have the value 0 so
that the zFunctionDefaultNumPoints value is used. If the number
is even it will be set to the next higher odd value
(to maintain symmetry for the Z curve).
public static void setDefaultNumberOfPoints(int numPoints)
generateFuzzySet(double leftX, double rightX)
method
when the local instance variable defaultNumPoints has not been
set or is < 3. Initially it is set to have the value 9. If the number
is even it will be set to the next higher odd value
(to maintain symmetry for the Z curve).
protected int returnCorrectedNumPoints(int numPoints)
numPoints
- the integer value to be constrained to be >= 3 and odd.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |