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