Package net.sourceforge.jFuzzyLogic.ruleConnectionMethod

Examples of net.sourceforge.jFuzzyLogic.ruleConnectionMethod.RuleConnectionMethodAndMin


    RuleTerm term1 = new RuleTerm(service, "good", false); // Create 'terms'
    RuleTerm term2 = new RuleTerm(service, "excellent", false);
    RuleTerm term3 = new RuleTerm(food, "delicious", false);

    RuleExpression antecedentOr = new RuleExpression(term1, term2, new RuleConnectionMethodOrMax()); // Combine terms using connection methods: OR, AND
    RuleExpression antecedentAnd = new RuleExpression(antecedentOr, term3, new RuleConnectionMethodAndMin());
    rule3.setAntecedents(antecedentAnd); // Set antecedent

    rule3.addConsequent(tip, "generous", false);
    ruleBlock.add(rule3);
View Full Code Here


    if( debug ) Gpr.debug("Tree: " + tree.toStringTree());
    name = tree.getChild(0).getText();
    if( debug ) Gpr.debug("RuleBlock name: " + name);

    // Use 'default' methods
    RuleConnectionMethod and = new RuleConnectionMethodAndMin(), or = new RuleConnectionMethodOrMax();
    String ruleAccumulationMethodType = "SUM";

    // Explore each sibling in this level
    for( int childNum = 1; childNum < tree.getChildCount(); childNum++ ) {
      Tree child = tree.getChild(childNum);
      if( debug ) Gpr.debug("Parsing: " + child.toStringTree());
      String leaveName = child.getText();

      if( leaveName.equalsIgnoreCase("AND") ) {
        //---
        // Which 'AND' method to use? (Note: We also set 'OR' method accordingly to fulfill DeMorgan's law
        //---
        if( rulesAdded ) throw new RuntimeException("AND method must be defined prior to RULE definition");
        String type = child.getChild(0).getText();
        if( type.equalsIgnoreCase("MIN") ) {
          and = new RuleConnectionMethodAndMin();
          or = new RuleConnectionMethodOrMax();
        } else if( type.equalsIgnoreCase("PROD") ) {
          and = new RuleConnectionMethodAndProduct();
          or = new RuleConnectionMethodOrProbOr();
        } else if( type.equalsIgnoreCase("BDIF") ) {
          and = new RuleConnectionMethodAndBoundedDif();
          or = new RuleConnectionMethodOrBoundedSum();
        } else throw new RuntimeException("Unknown (or unimplemented) 'AND' method: " + type);
      } else if( leaveName.equalsIgnoreCase("OR") ) {
        //---
        // Which 'OR' method to use? (Note: We also set 'AND' method accordingly to fulfill DeMorgan's law
        //---
        if( rulesAdded ) throw new RuntimeException("OR method must be defined prior to RULE definition");
        String type = child.getChild(0).getText(); // Bug corrected by Arkadiusz M. amaterek@users.sourceforge.net
        if( type.equalsIgnoreCase("MAX") ) {
          or = new RuleConnectionMethodOrMax();
          and = new RuleConnectionMethodAndMin();
        } else if( type.equalsIgnoreCase("ASUM") ) {
          or = new RuleConnectionMethodOrProbOr();
          and = new RuleConnectionMethodAndProduct();
        } else if( type.equalsIgnoreCase("BSUM") ) {
          or = new RuleConnectionMethodOrBoundedSum();
View Full Code Here

   * Default Constructor
   */
  public RuleExpression() {
    setTerm1(null);
    setTerm2(null);
    ruleConnectionMethod = new RuleConnectionMethodAndMin(); // Default connection method: AND (minimum)
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.jFuzzyLogic.ruleConnectionMethod.RuleConnectionMethodAndMin

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.