|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nrc.fuzzy.SFunction
An implementation of the FuzzySetFunction interface to provide
a class with the ability to generate a FuzzySet that is an
S-shaped curve with membership value 0 on the lower left to 1 on the upper right.
This class is typically used when constructing instances of the classes
LFuzzySet 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 SFunction 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 = 0.0
if x is between leftX and the midpoint
then y = 2*sqr(((x - leftX)/(rightX - leftX)))
if x is midpoint then y = 0.5
if x is between the midpoint and rightX
then y = 1 - 2*sqr(((x - rightX)/(rightX - leftX)))
if x is >= rightX then y = 1.0
LFuzzySet
,
LRFuzzySet
,
PIFuzzySet
,
ZFunction
,
Serialized FormConstructor Summary | |
SFunction()
Creates an instance of an SFunction that is used to generate Fuzzysets with an S-shape. |
|
SFunction(int numPoints)
Creates an instance of an SFunction that is used to generate Fuzzysets with an S-shape. |
Method Summary | |
nrc.fuzzy.FuzzySet |
generateFuzzySet(double leftX,
double rightX)
Creates a FuzzySet with an S-shape such that the membership value is 0 at the leftX value and 1 at the rightX value. |
nrc.fuzzy.FuzzySet |
generateFuzzySet(double leftX,
double rightX,
int numberOfPoints)
Creates a FuzzySet with an S-shape such that the membership value is 0 at the leftX value and 1 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 sFunctionDefaultNumPoints static (class) variable. |
void |
setNumPoints(int numPoints)
Sets the value of the defaultNumPoints variable. |
protected static double |
sMembership(double x,
double leftX,
double flexPoint,
double rightX)
Calculates a membership value for an X value in the S-shaped function. |
protected static double |
sqr(double value)
Squares a double value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SFunction()
public SFunction(int numPoints)
numPoints
- the number of points to use when creating the S-shaped FuzzySet.Method Detail |
public nrc.fuzzy.FuzzySet generateFuzzySet(double leftX, double rightX)
defaultNumPoints
and the static class variable
sFunctionDefaultNumPoints
.
generateFuzzySet
in interface FuzzySetFunction
leftX
- the bottom left x value of the S-shaped curve.rightX
- the upper right x value of the S-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 S-shaped curve.rightX
- the upper right x value of the S-shaped curve.numberOfPoints
- the number of points to be used when generating the
S-shaped curve.
protected static double sMembership(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 S-shaped curveflexPoint
- the point of flex (symmetry) for the curverightX
- the rightmost X value of the S-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, sFunctionDefaultNumPoints, will be used. This allows
each instance of the SFunction 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 sFunctionDefaultNumPoints value is used. If the number
is even it will be set to the next higher odd value
(to maintain symmetry for the S 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 S curve).
protected static double sqr(double value)
value
- the value to be squared.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 |