Package heart.uncertainty

Examples of heart.uncertainty.UncertainTrue


 

  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
View Full Code Here


   * @throws NotInTheDomainException
   */
  public UncertainTrue evaluate(WorkingMemory wm, UncertainTrueEvaluator ute) throws NotInTheDomainException{
    Debug.debug(Debug.heartTag, Level.RULES, "Checking conditions of rule "+this.getName()+" (ID: "+this.getId()+")");
    try{
      UncertainTrue finalResult = new UncertainTrue(1.0f); //TODO: max/min certainty
      for(Formulae f : conditions){
        Debug.debug(Debug.heartTag, Level.RULES, "Checking condition "+f);
        UncertainTrue partialResult = f.evaluate(wm, ute);
        Debug.debug(Debug.heartTag, Level.RULES,
            "Condition "+f+" satisfied with certainty ("+partialResult.getCertinatyFactor()+").");
     
        if(partialResult.getCertinatyFactor() < finalResult.getCertinatyFactor()){
          finalResult = partialResult;
          Debug.debug(Debug.heartTag, Level.RULES,
              "Changin the rule evaluation result to be true with certainty ("+finalResult.getCertinatyFactor()+").");
         
        }
View Full Code Here

TOP

Related Classes of heart.uncertainty.UncertainTrue

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.