nrc.fuzzy
Class LeftGaussianFunction

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

public class LeftGaussianFunction
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 left half of a gaussian-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 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:
LFuzzySet, LRFuzzySet, GaussianFuzzySet, RightGaussianFunction, Serialized Form

Constructor Summary
LeftGaussianFunction()
          Creates an instance of an LeftGaussianFunction that is used to generate Fuzzysets with a gaussian-shape for their left part.
LeftGaussianFunction(int numPoints)
          Creates an instance of a LeftGaussianFunction that is used to generate Fuzzysets with a gaussian-shape for its left part.
 
Method Summary
 nrc.fuzzy.FuzzySet generateFuzzySet(double leftX, double rightX)
          Creates a FuzzySet with an gaussian-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 a gaussian-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 gaussian-shaped curve to be >= 5.
static void setDefaultNumberOfPoints(int numPoints)
          Sets the value of the leftGaussianFunctionDefaultNumPoints 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

LeftGaussianFunction

public LeftGaussianFunction()
Creates an instance of an LeftGaussianFunction 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.


LeftGaussianFunction

public LeftGaussianFunction(int numPoints)
Creates an instance of a LeftGaussianFunction that is used to generate Fuzzysets with a gaussian-shape for its left part. A FuzzySet created will have a 0 value at its left and a 1 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 0 at the leftX value and 1 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 leftGaussianFunctionDefaultNumPoints.

Specified by:
generateFuzzySet in interface FuzzySetFunction
Parameters:
leftX - the bottom left x value of the gaussian-shaped curve.
rightX - the upper 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 0 at the leftX value and 1 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 left point is actually 4 standard deviations from the right (centre) point of the gaussian curve. The left point and all point to its left 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 bottom left x value of the gaussian-shaped curve.
rightX - the upper 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 LeftGaussianFunction 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 leftGaussianFunctionDefaultNumPoints value is used.


setDefaultNumberOfPoints

public static void setDefaultNumberOfPoints(int numPoints)
Sets the value of the leftGaussianFunctionDefaultNumPoints 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.