Package heart.xtt

Examples of heart.xtt.Rule


  private static void runRules(Table table, Configuration cs) throws UnsupportedOperationException, NotInTheDomainException{
    ConflictSet conflictSet = new ConflictSet();
    try{
      UncertainTrue finalResult = new UncertainTrue(cs.getUncertainTrueEvaluator().getMinCertainty());
      Rule ruleToFire = null;
      for(Rule rule : table.getRules()){
        Debug.debug(Debug.heartTag, Level.RULES, "Processing rule "+rule.getName()+" (ID: "+rule.getId()+")");
        UncertainTrue partialResult = rule.evaluate(wm,cs.getUncertainTrueEvaluator());
        partialResult.setCertinatyFactor(partialResult.getCertinatyFactor()*rule.getCertaintyFactor());
        //TODO: add satisability threshold, or think how to do this
        if(finalResult.getCertinatyFactor() < partialResult.getCertinatyFactor()){
          finalResult = partialResult;
          ruleToFire = rule;
          conflictSet.clear();
        }else if(finalResult.getCertinatyFactor() == partialResult.getCertinatyFactor()){
          conflictSet.add(ruleToFire, finalResult);
          conflictSet.add(rule, partialResult);
        }
        Debug.debug(Debug.heartTag, Level.RULES, "Finished evaluating rule "+rule.getName()+" (ID: "+rule.getId()+"). "+
        "SATISFIED with ("+partialResult.getCertinatyFactor()+") certainty.");
       
       
      }
     
      //If the conflict set is empty, then fire the ruleToFire
      //Otherwise, launch conflict resolution mechanism
      if(conflictSet.isEmpty()){
        if(ruleToFire != null){
          if(ruleToFire.execute(wm))
            Debug.debug(Debug.heartTag, Level.RULES,
                "Rule "+ruleToFire.getName()+" (ID: "+ruleToFire.getId()+") fired.");
          else
            Debug.debug(Debug.heartTag, Level.RULES,
                "Rule "+ruleToFire.getName()+" (ID: "+ruleToFire.getId()+") execution failed.");
        }else{
          Debug.debug(Debug.heartTag, Level.RULES,
              "No rule to fire in table "+table.getName()+" (ID: "+table.getId()+").");
        }
       
View Full Code Here

TOP

Related Classes of heart.xtt.Rule

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.