Program: 21379
Project: 21379
Buggy source:
public BayesianNetwork wrapperBNOneMonth(DataOnMemory<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  List<DataOnMemory<DataInstance>> splitData=this.splitTrainAndTest(data,66.0);
  DataOnMemory<DataInstance> trainingData=splitData.get(0);
  DataOnMemory<DataInstance> testData=splitData.get(1);
  List<Variable> NSF=new ArrayList<>(Vars.getListOfVariables());
  NSF.remove(classVariable);
  NSF.remove(classVariable_PM);
  int nbrNSF=NSF.size();
  List<Variable> SF=new ArrayList();
  Boolean stop=false;
  BayesianNetwork bNet=train(trainingData,Vars,SF);
  System.out.println(bNet.toString());
  double score=test(testData,bNet,posteriorsGlobal,false);
  int cont=0;
  while (nbrNSF > 0 && stop == false) {
    System.out.print(cont + "String_Node_Str" + score+ "String_Node_Str"+ SF.size()+ "String_Node_Str");
    SF.stream().forEach(v -> System.out.print(v.getName() + "String_Node_Str"));
    System.out.println();
    Map<Variable,Double> scores=new HashMap<>();
    for (    Variable V : NSF) {
      if (V.getVarID() > 5)       break;
      System.out.println("String_Node_Str" + V.getName());
      SF.add(V);
      bNet=train(trainingData,Vars,SF);
      scores.put(V,test(testData,bNet,posteriorsGlobal,false));
      SF.remove(V);
    }
    double maxScore=(Collections.max(scores.values()));
    if (maxScore - score > 0.001) {
      score=maxScore;
      for (      Map.Entry<Variable,Double> entry : scores.entrySet()) {
        if (entry.getValue() == maxScore) {
          Variable SelectedV=entry.getKey();
          SF.add(SelectedV);
          NSF.remove(SelectedV);
          break;
        }
      }
      nbrNSF=nbrNSF - 1;
    }
 else {
      stop=true;
    }
    cont++;
  }
  bNet=train(data,Vars,SF);
  test(data,bNet,posteriorsGlobal,true);
  return bNet;
}

Fixed version (ground truth):
public BayesianNetwork wrapperBNOneMonth(DataOnMemory<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  List<DataOnMemory<DataInstance>> splitData=this.splitTrainAndTest(data,66.0);
  DataOnMemory<DataInstance> trainingData=splitData.get(0);
  DataOnMemory<DataInstance> testData=splitData.get(1);
  List<Variable> NSF=new ArrayList<>(Vars.getListOfVariables());
  NSF.remove(classVariable);
  NSF.remove(classVariable_PM);
  int nbrNSF=NSF.size();
  List<Variable> SF=new ArrayList();
  Boolean stop=false;
  BayesianNetwork bNet=train(trainingData,Vars,SF);
  System.out.println(bNet.toString());
  double score=test(testData,bNet,posteriorsGlobal,false);
  int cont=0;
  while (nbrNSF > 0 && stop == false) {
    System.out.print(cont + "String_Node_Str" + score+ "String_Node_Str"+ SF.size()+ "String_Node_Str");
    SF.stream().forEach(v -> System.out.print(v.getName() + "String_Node_Str"));
    System.out.println();
    Map<Variable,Double> scores=new HashMap<>();
    for (    Variable V : NSF) {
      System.out.println("String_Node_Str" + V.getName());
      SF.add(V);
      bNet=train(trainingData,Vars,SF);
      scores.put(V,test(testData,bNet,posteriorsGlobal,false));
      SF.remove(V);
    }
    double maxScore=(Collections.max(scores.values()));
    if (maxScore - score > 0.001) {
      score=maxScore;
      for (      Map.Entry<Variable,Double> entry : scores.entrySet()) {
        if (entry.getValue() == maxScore) {
          Variable SelectedV=entry.getKey();
          SF.add(SelectedV);
          NSF.remove(SelectedV);
          break;
        }
      }
      nbrNSF=nbrNSF - 1;
    }
 else {
      stop=true;
    }
    cont++;
  }
  bNet=train(data,Vars,SF);
  test(data,bNet,posteriorsGlobal,true);
  return bNet;
}