net.sourceforge.jFuzzyLogic.membership
Class MembershipFunctionPieceWiseLinear

java.lang.Object
  extended by net.sourceforge.jFuzzyLogic.membership.MembershipFunction
      extended by net.sourceforge.jFuzzyLogic.membership.MembershipFunctionContinuous
          extended by net.sourceforge.jFuzzyLogic.membership.MembershipFunctionPieceWiseLinear

public class MembershipFunctionPieceWiseLinear
extends MembershipFunctionContinuous

Piece-wise linear membership function

Author:
pcingola@users.sourceforge.net

Field Summary
(package private)  double[] x
          Piece wise linear function values x
(package private)  double[] y
          Piece wise linear function values y
 
Fields inherited from class net.sourceforge.jFuzzyLogic.membership.MembershipFunction
discrete, parameters, universeMax, universeMin
 
Constructor Summary
MembershipFunctionPieceWiseLinear(double[] x, double[] y)
          Default constructor
 
Method Summary
 boolean checkParamters(java.lang.StringBuffer errors)
           
 void estimateUniverse()
          Try to guess the universe (if not setted)
 double getParameter(int i)
          Need to override this method (we store parameters differently in this function)
 int getParametersLength()
          Need to override this method (we store parameters differently in this function)
 double membership(double in)
          Membership funcion is defined as: membership(x) = y[0] if x <= x[0] membership(x) = y[n] if x >= x[n] (where n = x.length) membership(x) = y[i - 1] + (y[i] - y[i - 1]) / (in - x[i]) if x[i-1] < x <= x[i]
 void setParameter(int i, double value)
          Need to override this method (we store parameters differently in this function)
 java.lang.String toString()
           
 java.lang.String toStringFCL()
          FCL representation
 
Methods inherited from class net.sourceforge.jFuzzyLogic.membership.MembershipFunctionContinuous
chart
 
Methods inherited from class net.sourceforge.jFuzzyLogic.membership.MembershipFunction
getName, getUniverseMax, getUniverseMin, isDiscrete, setDiscrete, setUniverseMax, setUniverseMin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

double[] x
Piece wise linear function values x


y

double[] y
Piece wise linear function values y

Constructor Detail

MembershipFunctionPieceWiseLinear

public MembershipFunctionPieceWiseLinear(double[] x,
                                         double[] y)
Default constructor

Parameters:
x - [] : x points array
y - [] : y points array A piecewise linear function is defined by 'n' points: (x_1,y_1) , (x_2,y2) , ... (x_n,y_n) ordered by x[] (increasing) See also 'membership()' for a precise definition.
Method Detail

checkParamters

public boolean checkParamters(java.lang.StringBuffer errors)
Specified by:
checkParamters in class MembershipFunction

estimateUniverse

public void estimateUniverse()
Description copied from class: MembershipFunction
Try to guess the universe (if not setted)

Specified by:
estimateUniverse in class MembershipFunction

getParameter

public double getParameter(int i)
Need to override this method (we store parameters differently in this function)

Overrides:
getParameter in class MembershipFunction

getParametersLength

public int getParametersLength()
Need to override this method (we store parameters differently in this function)

Overrides:
getParametersLength in class MembershipFunction

membership

public double membership(double in)
Membership funcion is defined as: membership(x) = y[0] if x <= x[0] membership(x) = y[n] if x >= x[n] (where n = x.length) membership(x) = y[i - 1] + (y[i] - y[i - 1]) / (in - x[i]) if x[i-1] < x <= x[i]

Specified by:
membership in class MembershipFunction
Parameters:
in - : Variable's 'x' value Note: Output mu be in range [0,1]
See Also:
MembershipFunction.membership(double)

setParameter

public void setParameter(int i,
                         double value)
Need to override this method (we store parameters differently in this function)

Overrides:
setParameter in class MembershipFunction

toString

public java.lang.String toString()
Overrides:
toString in class MembershipFunction
See Also:
Object.toString()

toStringFCL

public java.lang.String toStringFCL()
FCL representation

Specified by:
toStringFCL in class MembershipFunction