Program: 125207
Project: 125207
Buggy source:
private int computeMinCost(Vertex v) throws CannotResolveException {
  if (v._max_score != -1) {
    return v._max_score - maxEL;
  }
  if (optimizeDuploss) {
    if (v._el_num == -1) {
      if (taxonNameMap == null) {
        v._el_num=DeepCoalescencesCounter.getClusterCoalNum(trees,v._cluster,rooted);
      }
 else {
        v._el_num=DeepCoalescencesCounter.getClusterCoalNum(trees,v._cluster,taxonNameMap,rooted);
      }
    }
  }
 else {
    v._el_num=0;
  }
  int clusterSize=v._cluster.getClusterSize();
{
    if (clusterSize <= 1) {
      v._min_cost=0;
      v._max_score=maxEL - v._el_num;
      v._min_lc=(v._min_rc=null);
      return v._max_score - maxEL;
    }
  }
  Set<STBipartition> clusterBiPartitions=counter.getClusterBiPartitions(v._cluster);
  if (fast) {
    if (clusterBiPartitions == null) {
      if (v._cluster.getClusterSize() <= 3) {
        for (int j=0; j < v._cluster.getClusterSize(); j++) {
          STITreeCluster c1=new STITreeCluster(v._cluster.getTaxa());
          c1.addLeaf(v._cluster.getClusterLeaves()[j]);
          STITreeCluster c2=new STITreeCluster(v._cluster.getTaxa());
          for (int i=0; i < v._cluster.getClusterSize(); i++) {
            if (i != j) {
              c2.addLeaf(v._cluster.getClusterLeaves()[i]);
            }
          }
          if (clusterToVertex.containsKey(c2)) {
            STBipartition stb=new STBipartition(c1,c2,v._cluster);
            if (clusterBiPartitions == null)             clusterBiPartitions=new HashSet<STBipartition>(3);
            clusterBiPartitions.add(stb);
            System.err.println("String_Node_Str" + stb);
          }
        }
      }
    }
    if (clusterBiPartitions == null) {
      System.err.println("String_Node_Str" + v._cluster.getClusterSize() + "String_Node_Str"+ v._cluster);
      throw new CannotResolveException(v._cluster.toString());
    }
    for (    STBipartition stb : clusterBiPartitions) {
      Vertex lv=clusterToVertex.get(stb.cluster1);
      Vertex rv=clusterToVertex.get(stb.cluster2);
      try {
        int lscore=computeMinCost(lv);
        int rscore=computeMinCost(rv);
        int w=counter.getBiPartitionDPWeight(lv._cluster,rv._cluster,v._cluster);
        int z=optimizeDuploss ? 3 : 1;
        int c=z * w - v._el_num;
        if ((v._max_score != -1) && (lscore + rscore + c+ maxEL <= v._max_score)) {
          continue;
        }
        v._max_score=(lscore + rscore + c) + maxEL;
        v._min_cost=sigmaNs - (c + lv._max_score + rv._max_score - 2 * maxEL);
        v._min_lc=lv;
        v._min_rc=rv;
        v._c=c;
      }
 catch (      CannotResolveException c) {
        System.err.println("String_Node_Str" + c.getMessage());
      }
    }
  }
 else {
    for (int i=1; i <= (clusterSize / 2); i++) {
      Set<Vertex> leftList=clusters.get(i);
      if (leftList != null) {
        for (        Vertex lv : leftList) {
          if (v._cluster.containsCluster(lv._cluster)) {
            Set<Vertex> rightList=clusters.get(clusterSize - i);
            if (rightList != null) {
              for (              Vertex rv : rightList) {
                if (lv._cluster.isDisjoint(rv._cluster) && v._cluster.containsCluster(rv._cluster)) {
                  int lscore=computeMinCost(lv);
                  int rscore=computeMinCost(rv);
                  int w=counter.getBiPartitionDPWeight(lv._cluster,rv._cluster,v._cluster);
                  int z=optimizeDuploss ? 3 : 1;
                  int c=z * w - v._el_num;
                  if ((v._max_score != -1) && (lscore + rscore + c+ maxEL <= v._max_score)) {
                    continue;
                  }
                  v._max_score=(lscore + rscore + c) + maxEL;
                  v._min_cost=sigmaNs - (c + lv._max_score + rv._max_score - 2 * maxEL);
                  v._min_lc=lv;
                  v._min_rc=rv;
                  v._c=c;
                  break;
                }
              }
            }
          }
        }
      }
    }
  }
  if (v._min_lc == null) {
    System.out.println("String_Node_Str" + v._cluster.getClusterSize() + "String_Node_Str"+ v._cluster);
    throw new CannotResolveException(v._cluster.toString());
  }
  return v._max_score - maxEL;
}

Fixed version (ground truth):
private int computeMinCost(Vertex v) throws CannotResolveException {
  if (v._max_score != -1) {
    return v._max_score - maxEL;
  }
  if (optimizeDuploss) {
    if (v._el_num == -1) {
      if (taxonNameMap == null) {
        v._el_num=DeepCoalescencesCounter.getClusterCoalNum(trees,v._cluster,rooted);
      }
 else {
        v._el_num=DeepCoalescencesCounter.getClusterCoalNum(trees,v._cluster,taxonNameMap,rooted);
      }
    }
  }
 else {
    v._el_num=0;
  }
  int clusterSize=v._cluster.getClusterSize();
{
    if (clusterSize <= 1) {
      v._min_cost=0;
      v._max_score=maxEL - v._el_num;
      v._min_lc=(v._min_rc=null);
      return v._max_score - maxEL;
    }
  }
  Set<STBipartition> clusterBiPartitions=counter.getClusterBiPartitions(v._cluster);
  if (fast) {
    if (clusterBiPartitions == null) {
      if (v._cluster.getClusterSize() <= 3) {
        for (int j=0; j < v._cluster.getClusterSize(); j++) {
          STITreeCluster c1=new STITreeCluster(v._cluster.getTaxa());
          c1.addLeaf(v._cluster.getClusterLeaves()[j]);
          STITreeCluster c2=new STITreeCluster(v._cluster.getTaxa());
          for (int i=0; i < v._cluster.getClusterSize(); i++) {
            if (i != j) {
              c2.addLeaf(v._cluster.getClusterLeaves()[i]);
            }
          }
          if (clusterToVertex.containsKey(c2)) {
            STBipartition stb=new STBipartition(c1,c2,v._cluster);
            if (clusterBiPartitions == null)             clusterBiPartitions=new HashSet<STBipartition>(3);
            clusterBiPartitions.add(stb);
            System.err.println("String_Node_Str" + stb);
          }
        }
      }
    }
    if (clusterBiPartitions == null) {
      System.err.println("String_Node_Str" + v._cluster.getClusterSize() + "String_Node_Str"+ v._cluster);
      throw new CannotResolveException(v._cluster.toString());
    }
    for (    STBipartition stb : clusterBiPartitions) {
      Vertex lv=clusterToVertex.get(stb.cluster1);
      Vertex rv=clusterToVertex.get(stb.cluster2);
      try {
        int lscore=computeMinCost(lv);
        int rscore=computeMinCost(rv);
        int w=counter.getBiPartitionDPWeight(lv._cluster,rv._cluster,v._cluster);
        int z=optimizeDuploss ? 3 : 1;
        int c=z * w - v._el_num;
        if ((v._max_score != -1) && (lscore + rscore + c+ maxEL <= v._max_score)) {
          continue;
        }
        v._max_score=(lscore + rscore + c) + maxEL;
        v._min_cost=sigmaNs - (c + lv._max_score + rv._max_score - 2 * maxEL);
        v._min_lc=lv;
        v._min_rc=rv;
        v._c=c;
      }
 catch (      CannotResolveException c) {
        System.err.println("String_Node_Str" + c.getMessage());
      }
    }
  }
 else {
    for (int i=1; i <= (clusterSize / 2); i++) {
      Set<Vertex> leftList=clusters.get(i);
      if (leftList != null) {
        for (        Vertex lv : leftList) {
          if (v._cluster.containsCluster(lv._cluster)) {
            Set<Vertex> rightList=clusters.get(clusterSize - i);
            if (rightList != null) {
              for (              Vertex rv : rightList) {
                if (lv._cluster.isDisjoint(rv._cluster) && v._cluster.containsCluster(rv._cluster)) {
                  int lscore=computeMinCost(lv);
                  int rscore=computeMinCost(rv);
                  int w=counter.getBiPartitionDPWeight(lv._cluster,rv._cluster,v._cluster);
                  int z=optimizeDuploss ? 3 : 1;
                  int c=z * w - v._el_num;
                  if ((v._max_score != -1) && (lscore + rscore + c+ maxEL <= v._max_score)) {
                    continue;
                  }
                  v._max_score=(lscore + rscore + c) + maxEL;
                  v._min_cost=sigmaNs - (c + lv._max_score + rv._max_score - 2 * maxEL);
                  v._min_lc=lv;
                  v._min_rc=rv;
                  v._c=c;
                  break;
                }
              }
            }
          }
        }
      }
    }
  }
  if (v._min_lc == null) {
    System.err.println("String_Node_Str" + v._cluster.getClusterSize() + "String_Node_Str"+ v._cluster);
    throw new CannotResolveException(v._cluster.toString());
  }
  return v._max_score - maxEL;
}