Program: 144007
Project: 144007
Buggy source:
public static void addGroundingsToBuilder(List<Rule> rules,Builder builder,LogicManager<Integer,Double> logicManager){
  List<Formula<Integer>> ruleFormulas=new ArrayList<>();
  for (  Rule rule : rules) {
    List<Formula<Integer>> disjunctionComponents=new ArrayList<>();
    for (int i=0; i < rule.bodyParts.size(); ++i)     if (rule.bodyParts.get(i) instanceof Negation)     disjunctionComponents.add(((Negation<Integer>)rule.bodyParts.get(i)).getFormula());
 else     disjunctionComponents.add(new Negation<>(rule.bodyParts.get(i)));
    for (int i=0; i < rule.headParts.size(); ++i)     disjunctionComponents.add(rule.headParts.get(i));
    ruleFormulas.add(new Disjunction<>(disjunctionComponents));
  }
  Grounding<Integer,Double> grounding=new ExhaustiveGrounding<>(logicManager);
  grounding.ground(ruleFormulas);
  Map<Integer,Set<List<GroundedPredicate<Integer,Double>>>> groundedRules=new HashMap<>();
  for (int ruleIndex=0; ruleIndex < rules.size(); ruleIndex++)   groundedRules.put(ruleIndex,grounding.getGroundedFormulas().get(ruleIndex));
  for (int ruleIndex=0; ruleIndex < rules.size(); ruleIndex++) {
    Set<List<GroundedPredicate<Integer,Double>>> predicateGroundings=groundedRules.get(ruleIndex);
    Disjunction<Integer> ruleFormula=((Disjunction<Integer>)ruleFormulas.get(ruleIndex));
    boolean[] variableNegations=new boolean[ruleFormula.getNumberOfComponents()];
    for (int i=0; i < ruleFormula.getNumberOfComponents(); ++i)     variableNegations[i]=ruleFormula.getComponent(i) instanceof Negation;
    if (variableNegations.length != 0) {
      for (      List<GroundedPredicate<Integer,Double>> groundedRulePredicates : predicateGroundings) {
        int[] variableIndexes=new int[ruleFormula.getNumberOfComponents()];
        for (int i=0; i < ruleFormula.getNumberOfComponents(); ++i)         variableIndexes[i]=(int)groundedRulePredicates.get(i).getIdentifier();
        if (Double.isNaN(rules.get(ruleIndex).weight))         builder.addRule(variableIndexes,variableNegations,1,1000);
 else         builder.addRule(variableIndexes,variableNegations,rules.get(ruleIndex).power,rules.get(ruleIndex).weight);
      }
    }
  }
}

Fixed version (ground truth):
public static void addGroundingsToBuilder(List<Rule> rules,Builder builder,LogicManager<Integer,Double> logicManager){
  List<Formula<Integer>> ruleFormulas=new ArrayList<>();
  for (  Rule rule : rules) {
    List<Formula<Integer>> disjunctionComponents=new ArrayList<>();
    for (int i=0; i < rule.bodyParts.size(); ++i)     if (rule.bodyParts.get(i) instanceof Negation)     disjunctionComponents.add(((Negation<Integer>)rule.bodyParts.get(i)).getFormula());
 else     disjunctionComponents.add(new Negation<>(rule.bodyParts.get(i)));
    for (int i=0; i < rule.headParts.size(); ++i)     disjunctionComponents.add(rule.headParts.get(i));
    ruleFormulas.add(new Disjunction<>(disjunctionComponents));
  }
  Grounding<Integer,Double> grounding=new ExhaustiveGrounding<>(logicManager);
  grounding.ground(ruleFormulas);
  for (int ruleIndex=0; ruleIndex < rules.size(); ruleIndex++) {
    Disjunction<Integer> ruleFormula=((Disjunction<Integer>)ruleFormulas.get(ruleIndex));
    boolean[] variableNegations=new boolean[ruleFormula.getNumberOfComponents()];
    for (int i=0; i < ruleFormula.getNumberOfComponents(); ++i)     variableNegations[i]=ruleFormula.getComponent(i) instanceof Negation;
    if (variableNegations.length != 0)     for (    List<GroundedPredicate<Integer,Double>> groundedRulePredicates : grounding.getGroundedFormulas().get(ruleIndex))     if (Double.isNaN(rules.get(ruleIndex).weight))     builder.addRule(groundedRulePredicates,variableNegations,1,1000);
 else     builder.addRule(groundedRulePredicates,variableNegations,rules.get(ruleIndex).power,rules.get(ruleIndex).weight);
  }
}