Program: 21558
Project: 21558
Buggy source:
public DAG learnDAG(DataBase dataBase){
  StaticVariables modelHeader=new StaticVariables(dataBase.getAttributes());
  DAG dag=new DAG(modelHeader);
  BayesianNetwork bn=BayesianNetwork.newBayesianNetwork(dag);
  Domain huginNetwork=null;
  try {
    huginNetwork=ConverterToHugin.convertToHugin(bn);
    DataOnMemory dataOnMemory=ReservoirSampling.samplingNumberOfSamples(this.numSamplesOnMemory,dataBase);
    int numCases=dataOnMemory.getNumberOfDataInstances();
    huginNetwork.setNumberOfCases(numCases);
    huginNetwork.setConcurrencyLevel(this.numCores);
    NodeList nodeList=huginNetwork.getNodes();
    for (int i=0; i < nodeList.size(); i++) {
      Variable var=bn.getDAG().getStaticVariables().getVariableById(i);
      Node n=nodeList.get(i);
      if (n.getKind().compareTo(NetworkModel.H_KIND_DISCRETE) == 0) {
        ((DiscreteChanceNode)n).getExperienceTable();
        for (int j=0; j < numCases; j++) {
          int state=(int)dataOnMemory.getDataInstance(j).getValue(var);
          ((DiscreteChanceNode)n).setCaseState(j,state);
        }
      }
 else {
        ((ContinuousChanceNode)n).getExperienceTable();
        for (int j=0; j < numCases; j++) {
          double value=dataOnMemory.getDataInstance(j).getValue(var);
          ((ContinuousChanceNode)n).setCaseValue(j,(long)value);
        }
      }
    }
    Node root=huginNetwork.getNodeByName(nameRoot);
    Node target=huginNetwork.getNodeByName(nameTarget);
    huginNetwork.learnChowLiuTree(root,target);
    return (ConverterToAMIDST.convertToAmidst(huginNetwork)).getDAG();
  }
 catch (  ExceptionHugin exceptionHugin) {
    throw new IllegalStateException("String_Node_Str" + exceptionHugin.getMessage());
  }
}

Fixed version (ground truth):
public DAG learnDAG(DataBase dataBase){
  StaticVariables modelHeader=new StaticVariables(dataBase.getAttributes());
  DAG dag=new DAG(modelHeader);
  BayesianNetwork bn=BayesianNetwork.newBayesianNetwork(dag);
  Domain huginNetwork=null;
  try {
    huginNetwork=ConverterToHugin.convertToHugin(bn);
    DataOnMemory dataOnMemory=ReservoirSampling.samplingNumberOfSamples(this.numSamplesOnMemory,dataBase);
    int numCases=dataOnMemory.getNumberOfDataInstances();
    huginNetwork.setNumberOfCases(numCases);
    huginNetwork.setConcurrencyLevel(this.numCores);
    NodeList nodeList=huginNetwork.getNodes();
    for (int i=0; i < nodeList.size(); i++) {
      Variable var=bn.getDAG().getStaticVariables().getVariableById(i);
      Node n=nodeList.get(i);
      if (n.getKind().compareTo(NetworkModel.H_KIND_DISCRETE) == 0) {
        ((DiscreteChanceNode)n).getExperienceTable();
        for (int j=0; j < numCases; j++) {
          int state=(int)dataOnMemory.getDataInstance(j).getValue(var);
          ((DiscreteChanceNode)n).setCaseState(j,state);
        }
      }
 else {
        ((ContinuousChanceNode)n).getExperienceTable();
        for (int j=0; j < numCases; j++) {
          double value=dataOnMemory.getDataInstance(j).getValue(var);
          ((ContinuousChanceNode)n).setCaseValue(j,(long)value);
        }
      }
    }
    Node root=huginNetwork.getNodeByName(nameRoot);
    Node target=huginNetwork.getNodeByName(nameTarget);
    Stopwatch watch=Stopwatch.createStarted();
    huginNetwork.learnChowLiuTree(root,target);
    System.out.println("String_Node_Str" + watch.stop());
    return (ConverterToAMIDST.convertToAmidst(huginNetwork)).getDAG();
  }
 catch (  ExceptionHugin exceptionHugin) {
    throw new IllegalStateException("String_Node_Str" + exceptionHugin.getMessage());
  }
}