Package net.sourceforge.jFuzzyLogic.membership

Examples of net.sourceforge.jFuzzyLogic.membership.MembershipFunction


    // Iterate over each linguistic term
    for( Iterator it = variable.getLinguisticTerms().keySet().iterator(); it.hasNext(); ) {
      String termName = (String) it.next();
      LinguisticTerm linguisticTerm = variable.getLinguisticTerm(termName);
      // Get membership function
      MembershipFunction membershipFunction = linguisticTerm.getMembershipFunction();

      // Guesstimate epsilon
      membershipFunction.estimateUniverse();
      double delta = membershipFunction.getUniverseMax() - membershipFunction.getUniverseMin();
      if( delta == 0 ) delta = variable.getUniverseMax() - variable.getUniverseMin();
      epsilon = delta / UNIVERSE_TO_EPSILON_RATIO;

      // Iterate over each membership funciotn's parameter
      for( int i = 0; i < membershipFunction.getParametersLength(); i++ ) {
        String paramName = variable.getName() + "_" + linguisticTerm.getTermName() + "_" + membershipFunction.getName() + "_" + i;
        ParameterMembershipFunction param = new ParameterMembershipFunction(paramName, epsilon, variable, membershipFunction, i);
        parameterList.add((Parameter) param);
      }
    }
  }
View Full Code Here


    // For each linguistic term...
    int j = 0;
    for( Iterator it = iteratorLinguisticTermNames(); it.hasNext(); j++ ) {
      // Add this linguistic term to dataset
      String termName = (String) it.next();
      MembershipFunction membershipFunction = getLinguisticTerm(termName).getMembershipFunction();
      discrete &= membershipFunction.isDiscrete();

      // Create a series and add points
      XYSeries series = new XYSeries(termName);
      if( membershipFunction.isDiscrete() ) {
        // Discrete case: Evaluate membership function and add points to dataset
        MembershipFunctionDiscrete membershipFunctionDiscrete = (MembershipFunctionDiscrete) membershipFunction;
        numberOfPoints = membershipFunctionDiscrete.size();
        for( int i = 0; i < numberOfPoints; i++ )
          series.add(membershipFunctionDiscrete.valueX(i), membershipFunctionDiscrete.membership(i));
      } else {
        // Continuous case: Add every membershipfunction's point
        numberOfPoints = PlotWindow.DEFAULT_CHART_NUMBER_OF_POINTS;
        double xx = universeMin;
        for( int i = 0; i < numberOfPoints; i++, xx += step )
          series.add(xx, membershipFunction.membership(xx));
      }

      // Add series to dataSet
      xyDataset.addSeries(series);
    }
View Full Code Here

    // Calculate max / min on every membership function
    double umin = Double.POSITIVE_INFINITY;
    double umax = Double.NEGATIVE_INFINITY;
    for( Iterator it = iteratorLinguisticTermNames(); it.hasNext(); ) {
      String lingTerm = (String) it.next();
      MembershipFunction membershipFunction = getMembershipFunction(lingTerm);
      membershipFunction.estimateUniverse();

      umin = Math.min(membershipFunction.getUniverseMin(), umin);
      umax = Math.max(membershipFunction.getUniverseMax(), umax);
    }

    // Set parameters (if not setted)
    if( Double.isNaN(universeMin) ) universeMin = umin;
    if( Double.isNaN(universeMax) ) universeMax = umax;
View Full Code Here

    return linguisticTerms;
  }

  /** Evaluate 'termName' membershipfunction at 'value' */
  public double getMembership(String termName) {
    MembershipFunction mf = getMembershipFunction(termName);
    if( mf == null ) throw new RuntimeException("No such termName: \"" + termName + "\"");
    return mf.membership(this.value);
  }
View Full Code Here

    child = child.getNextSibling();
    String leaveName = child.getText();
    Gpr.debug(debug, "Parsing: leaveName = " + leaveName);

    MembershipFunction membershipFunction = null;
    if( leaveName.equalsIgnoreCase("(") ) { // Piece-wise linear
      membershipFunction = fclTreeFuzzifyTermPieceWiseLinear(child);
    } else if( leaveName.equalsIgnoreCase("GAUSS") ) {
      membershipFunction = fclTreeFuzzifyTermGauss(child);
    } else if( leaveName.equalsIgnoreCase("TRIAN") ) {
View Full Code Here

   */
  private MembershipFunction fclTreeFuzzifyTermGauss(AST tree) {
    AST child = tree.getFirstChild();
    double mean = parseDouble(child);
    double stdev = parseDouble(child.getNextSibling());
    MembershipFunction membershipFunction = new MembershipFunctionGaussian(mean, stdev);
    return membershipFunction;
  }
View Full Code Here

  private MembershipFunction fclTreeFuzzifyTermGenBell(AST tree) {
    AST child = tree.getFirstChild();
    double a = parseDouble(child);
    double b = parseDouble(child.getNextSibling());
    double mean = parseDouble(child.getNextSibling().getNextSibling());
    MembershipFunction membershipFunction = new MembershipFunctionGenBell(a, b, mean);
    return membershipFunction;
  }
View Full Code Here

   */
  private MembershipFunction fclTreeFuzzifyTermSigmoidal(AST tree) {
    AST child = tree.getFirstChild();
    double gain = parseDouble(child);
    double t0 = parseDouble(child.getNextSibling());
    MembershipFunction membershipFunction = new MembershipFunctionSigmoidal(gain, t0);
    return membershipFunction;
  }
View Full Code Here

   * @param tree : Tree to parse
   * @return A new membership function
   */
  private MembershipFunction fclTreeFuzzifyTermSingleton(AST tree) {
    double singleTonValueX = parseDouble(tree);
    MembershipFunction membershipFunction = new MembershipFunctionSingleton(singleTonValueX, 1);
    return membershipFunction;
  }
View Full Code Here

    AST child = tree.getFirstChild();
    double min = parseDouble(child);
    double midLow = parseDouble(child.getNextSibling());
    double midHigh = parseDouble(child.getNextSibling().getNextSibling());
    double max = parseDouble(child.getNextSibling().getNextSibling().getNextSibling());
    MembershipFunction membershipFunction = new MembershipFunctionTrapetzoidal(min, midLow, midHigh, max);
    return membershipFunction;
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.jFuzzyLogic.membership.MembershipFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.