net.sourceforge.jFuzzyLogic.defuzzifier
Class DefuzzifierContinuous

java.lang.Object
  extended by net.sourceforge.jFuzzyLogic.defuzzifier.Defuzzifier
      extended by net.sourceforge.jFuzzyLogic.defuzzifier.DefuzzifierContinuous
Direct Known Subclasses:
DefuzzifierCenterOfArea, DefuzzifierCenterOfGravity, DefuzzifierLeftMostMax, DefuzzifierMeanMax, DefuzzifierRightMostMax

public abstract class DefuzzifierContinuous
extends Defuzzifier

Generic continuous defuzzifier (a defuzzifier for continuous membership functions)

Author:
pcingola@users.sourceforge.net

Field Summary
static int DEFAULT_NUMBER_OF_POINTS
          Default number of points for 'values[]'
(package private)  double max
          Where function ends
(package private)  double min
          Where function begins
(package private)  double stepSize
          Step size between each element in 'values[]' stepSize = (max - min) / values.length
(package private)  double[] values
          Funcion values: A generic continuous function y = f(x) where x : [min, max] Values are stored in 'values[]' array.
 
Fields inherited from class net.sourceforge.jFuzzyLogic.defuzzifier.Defuzzifier
discrete
 
Constructor Summary
DefuzzifierContinuous(Variable variable)
           
 
Method Summary
 void addValue(int index, double value)
           
 org.jfree.chart.JFreeChart chart(java.lang.String title, boolean showIt)
          Create a defuzzifier's chart
abstract  double defuzzify()
          Deffuzification function
 double getArea()
          Calculate function's area
 int getIndex(double d)
          Get 'values[]' index
 int getLength()
           
 double getMax()
           
 double getMin()
           
 double getStepSize()
           
 double getValue(double x)
          Get a value from 'values[]' using a double as index
 double getValue(int index)
           
 double[] getValues()
           
private  void init(double min, double max, int numberOfPoints)
          Initialize
 boolean isDiscrete()
           
 void reset()
          Reset values (in 'values[] array)
 void setDiscrete(boolean discrete)
           
 void setMax(double max)
           
 void setMin(double min)
           
 void setStepSize(double stepSize)
           
 void setValue(double valueX, double valueY)
           
 void setValue(int index, double value)
           
 void setValues(double[] values)
           
 
Methods inherited from class net.sourceforge.jFuzzyLogic.defuzzifier.Defuzzifier
getName, toString, toStringFCL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NUMBER_OF_POINTS

public static int DEFAULT_NUMBER_OF_POINTS
Default number of points for 'values[]'


max

double max
Where function ends


min

double min
Where function begins


stepSize

double stepSize
Step size between each element in 'values[]' stepSize = (max - min) / values.length


values

double[] values
Funcion values: A generic continuous function y = f(x) where x : [min, max] Values are stored in 'values[]' array. Array's index is calculated as: index = (x - min) / (max - min) * (values.length)

Constructor Detail

DefuzzifierContinuous

public DefuzzifierContinuous(Variable variable)
Method Detail

addValue

public void addValue(int index,
                     double value)

chart

public org.jfree.chart.JFreeChart chart(java.lang.String title,
                                        boolean showIt)
Create a defuzzifier's chart

Specified by:
chart in class Defuzzifier
Parameters:
title - : Title to show (if null => show membership function name)
showIt - : If true, plot is displayed

defuzzify

public abstract double defuzzify()
Deffuzification function

Specified by:
defuzzify in class Defuzzifier

getArea

public double getArea()
Calculate function's area


getIndex

public int getIndex(double d)
Get 'values[]' index


getLength

public int getLength()

getMax

public double getMax()

getMin

public double getMin()

getStepSize

public double getStepSize()

getValue

public double getValue(double x)
Get a value from 'values[]' using a double as index


getValue

public double getValue(int index)

getValues

public double[] getValues()

init

private void init(double min,
                  double max,
                  int numberOfPoints)
Initialize

Parameters:
min - : Minimum
max - : Maximum
numberOfPoints -

isDiscrete

public boolean isDiscrete()
Overrides:
isDiscrete in class Defuzzifier

reset

public void reset()
Reset values (in 'values[] array)

Specified by:
reset in class Defuzzifier

setDiscrete

public void setDiscrete(boolean discrete)
Overrides:
setDiscrete in class Defuzzifier

setMax

public void setMax(double max)

setMin

public void setMin(double min)

setStepSize

public void setStepSize(double stepSize)

setValue

public void setValue(double valueX,
                     double valueY)

setValue

public void setValue(int index,
                     double value)

setValues

public void setValues(double[] values)