nrc.fuzzy
Class RightGaussianFunction

java.lang.Object
  |
  +--nrc.fuzzy.RightGaussianFunction
All Implemented Interfaces:
FuzzySetFunction, java.io.Serializable

public class RightGaussianFunction
extends java.lang.Object
implements FuzzySetFunction, java.io.Serializable

An implementation of the FuzzySetFunction interface to provide a class with the ability to generate a FuzzySet that is the right half of a gaussian-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 GaussianFuzzySet for example is constructed using the LeftGaussianFunction to create its left half and the RightGaussianFunction to create its right half.
The curves are defined by the following equation:



where a is the mean and sigma is the standard deviation.

See Also:
RFuzzySet, LRFuzzySet, GaussianFuzzySet, LeftGaussianFunction, Serialized Form

Constructor Summary
RightGaussianFunction()
          Creates an instance of an RightGaussianFunction that is used to generate Fuzzysets with a gaussian-shape for their left part.
RightGaussianFunction(int numPoints)
          Creates an instance of a RightGaussianFunction that is used to generate Fuzzysets with a gaussian-shape for its right part.
 
Method Summary
 nrc.fuzzy.FuzzySet generateFuzzySet(double leftX, double rightX)
          Creates a FuzzySet with an gaussian-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 gaussian-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 gaussian-shaped curve to be >= 5.
static void setDefaultNumberOfPoints(int numPoints)
          Sets the value of the rightGaussianFunctionDefaultNumPoints static (class) variable.
 void setNumPoints(int numPoints)
          Sets the value of the defaultNumPoints variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RightGaussianFunction

public RightGaussianFunction()
Creates an instance of an RightGaussianFunction that is used to generate Fuzzysets with a gaussian-shape for their left part. A FuzzySet created will have a 0 value at its left and a 1 value at its right.


RightGaussianFunction

public RightGaussianFunction(int numPoints)
Creates an instance of a RightGaussianFunction that is used to generate Fuzzysets with a gaussian-shape for its right part. A FuzzySet created will have a 1 value at its left and a 0 value at its right. When created with this constructor a value for the number of points to be used when creating the gaussian-shaped fuzzy set is set (defaultNumPoints).

Parameters:
numPoints - the number of points to use when creating the gaussian-shaped FuzzySet.
Method Detail

generateFuzzySet

public nrc.fuzzy.FuzzySet generateFuzzySet(double leftX,
                                           double rightX)
Creates a FuzzySet with an gaussian-shape such that the membership value is 1 at the leftX value and 0 at the rightX value. The number of points in the generated FuzzySet is determined by the settings of the local instance variable defaultNumPoints and the static class variable rightGaussianFunctionDefaultNumPoints.

Specified by:
generateFuzzySet in interface FuzzySetFunction
Parameters:
leftX - the upper left x value of the gaussian-shaped curve.
rightX - the lower right x value of the gaussian-shaped curve.
Returns:
a FuzzySet with X values between leftX and rightX

generateFuzzySet

public nrc.fuzzy.FuzzySet generateFuzzySet(double leftX,
                                           double rightX,
                                           int numberOfPoints)
Creates a FuzzySet with a gaussian-shape such that the membership value is 1 at the leftX value and 0 at the rightX value. The number of points in the generated FuzzySet is determined by the the paramter numberOfPoints if it is acceptable (>= 5) or it is set to 5. The right point is actually 4 standard deviations from the left (centre) point of the gaussian curve. The right point and all point to its right are assumed to be zero.
The equation for the gaussian curve is:


    f(x)  =  e ** ((-(x-c)**2)/(2*sigma))

    where c is the mean (centre) value and sigma is the standard deviation

 

Specified by:
generateFuzzySet in interface FuzzySetFunction
Parameters:
leftX - the upper left x value of the gaussian-shaped curve.
rightX - the bottom right x value of the gaussian-shaped curve.
numberOfPoints - the number of points to be used when generating the gaussian-shaped curve.
Returns:
a FuzzySet with X values between leftX and rightX

setNumPoints

public void setNumPoints(int numPoints)
Sets the value of the defaultNumPoints variable. This value is used to determine the number of points that will be in the gaussian-shaped fuzzy set generated by the generateFuzzySet(double leftX, double rightX) method, unless it has a value of < 5, in which case the value of static (class) variable, sFunctionDefaultNumPoints, will be used. This allows each instance of the RightGaussianFunction 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 rightGaussianFunctionDefaultNumPoints value is used.


setDefaultNumberOfPoints

public static void setDefaultNumberOfPoints(int numPoints)
Sets the value of the rightGaussianFunctionDefaultNumPoints static (class) variable. This value is used to determine the number of points that will be in the gaussian-shaped fuzzy set generated by the generateFuzzySet(double leftX, double rightX) method when the local instance variable defaultNumPoints has not been set or is < 5. Initially it is set to have the value 9.


returnCorrectedNumPoints

protected int returnCorrectedNumPoints(int numPoints)
Keeps the values for the number of points in the gaussian-shaped curve to be >= 5.

Parameters:
numPoints - the integer value to be constrained to be >= 5.