Program: 50119
Project: 50119
Buggy source:
/** 
 * Called once for each node, visited in topological order. This method contains the high level logic to make decisions about which child nodes to include as descendants in the synthesis subtree of the node <tt>n</tt>.
 */
@Override List<Relationship> selectRelsForNode(Node n){
  if (VERBOSE) {
    String name="String_Node_Str";
    Object ottId=n.getProperty(NodeProperty.TAX_UID.propertyName,null);
    if (ottId != null) {
      name=(String)n.getProperty(NodeProperty.NAME.propertyName) + "String_Node_Str" + ottId;
    }
    print("String_Node_Str",n,"String_Node_Str",name,"String_Node_Str");
  }
  initialize(n);
  boolean hasChildren=false;
  for (  Relationship r : availableRelsForSynth(n,RelType.STREECHILDOF)) {
    hasChildren=true;
    processIncomingRel(r);
  }
  if (VERBOSE && hasChildren) {
    print();
  }
  Set<Relationship> taxonomySingletonRels=new HashSet<Relationship>();
  Set<Node> taxonomySingletonNodes=new HashSet<Node>();
  for (  Relationship r : availableRelsForSynth(n,RelType.TAXCHILDOF)) {
    Node childNode=r.getStartNode();
    if (childNode.hasRelationship(Direction.INCOMING,RelType.TAXCHILDOF,RelType.STREECHILDOF)) {
      processIncomingRel(r);
    }
 else {
      taxonomySingletonRels.add(r);
      taxonomySingletonNodes.add(childNode);
    }
  }
  for (  Node child : children) {
    immediateSubtrees.put(child,new SynthesisSubtreeInfoUsingEdgeIds(n,child));
  }
  for (  Node child : taxonomySingletonNodes) {
    immediateSubtrees.put(child,new SynthesisSubtreeInfoUsingEdgeIds(n,child));
  }
  List<Integer> sortedRanks=new ArrayList<Integer>(observedRanks);
  Collections.sort(sortedRanks);
  Collections.reverse(sortedRanks);
  if (VERBOSE) {
    print("String_Node_Str",sortedRanks);
  }
  bestSet=new CandidateRelSet(n);
  for (  int currentRank : sortedRanks) {
    if (VERBOSE) {
      print("String_Node_Str" + currentRank);
    }
    Set<EdgeSet> overlappingSets=new HashSet<EdgeSet>();
    Set<EdgeSet> nonOverlappingSets=new HashSet<EdgeSet>();
    for (    EdgeSet edgeSet : edgeSetsByRankAndEdgeId.get(currentRank).values()) {
      if (bestSet.info().overlapsWith(edgeSet.info(),currentRank)) {
        overlappingSets.add(edgeSet);
      }
 else {
        nonOverlappingSets.add(edgeSet);
      }
    }
    while (overlappingSets.size() > 0) {
      if (VERBOSE) {
        print("String_Node_Str");
        for (        EdgeSet x : overlappingSets) {
          print(x,x.info());
        }
      }
      PrunableCPSupersetIterator<Relationship> combinations=new CartesianProduct<Relationship>((Set<Set<Relationship>>)(Set<?>)overlappingSets).withMissingElements().prunableIterator();
      while (combinations.hasNext()) {
        Set<Relationship> c=combinations.next();
        if (c.size() < 1) {
          continue;
        }
        CandidateRelSet proposed=new CandidateRelSet(c);
        if (!internallyDisjoint(proposed)) {
          combinations.prune();
          continue;
        }
        if (VERBOSE) {
          print("String_Node_Str",bestSet,"String_Node_Str",bestSet.info(),"String_Node_Str",proposed,"String_Node_Str",proposed.info());
        }
        CandidateRelSet candidate=(CandidateRelSet)updateSet(n,proposed,bestSet,currentRank);
        if (candidate == null) {
          combinations.prune();
          continue;
        }
        if (VERBOSE) {
          print("String_Node_Str",candidate,"String_Node_Str",bestSet);
        }
        if (candidate.info().improvesUpon(bestSet.info(),currentRank)) {
          bestSet=candidate;
        }
      }
      overlappingSets=new HashSet<EdgeSet>();
      Iterator<EdgeSet> nonOverlappingIter=nonOverlappingSets.iterator();
      while (nonOverlappingIter.hasNext()) {
        EdgeSet edgeSet=nonOverlappingIter.next();
        if (bestSet.info().overlapsWith(edgeSet.info(),currentRank)) {
          overlappingSets.add(edgeSet);
          nonOverlappingIter.remove();
        }
      }
      if (!nonOverlappingSets.isEmpty()) {
        if (VERBOSE) {
          print("String_Node_Str");
        }
        bestSet=augmentFromNonOverlappingSets(bestSet,nonOverlappingSets,currentRank);
      }
      if (VERBOSE) {
        print("String_Node_Str",bestSet,"String_Node_Str",bestSet.info());
      }
    }
    if (!nonOverlappingSets.isEmpty()) {
      if (VERBOSE) {
        print("String_Node_Str");
      }
      bestSet=augmentFromNonOverlappingSets(bestSet,nonOverlappingSets,currentRank);
    }
  }
  for (  Relationship t : taxonomySingletonRels) {
    if (!bestSet.info().overlapsWith(completedSubtree(t),0)) {
      bestSet.add(t);
    }
  }
  bestSet.info().complete();
  print("String_Node_Str" + n,"String_Node_Str",bestSet + "String_Node_Str" + bestSet.info());
  updateCompletedSubtreeInfo(n,bestSet.info());
  if (n.getId() == root.getId()) {
    completeRootInfo=bestSet.info();
  }
  return new ArrayList<Relationship>(bestSet);
}

Fixed version (ground truth):
/** 
 * Called once for each node, visited in topological order. This method contains the high level logic to make decisions about which child nodes to include as descendants in the synthesis subtree of the node <tt>n</tt>.
 */
@Override List<Relationship> selectRelsForNode(Node n){
  if (VERBOSE) {
    String name="String_Node_Str";
    Object ottId=n.getProperty(NodeProperty.TAX_UID.propertyName,null);
    if (ottId != null) {
      name=(String)n.getProperty(NodeProperty.NAME.propertyName) + "String_Node_Str" + ottId;
    }
    print("String_Node_Str",n,"String_Node_Str",name,"String_Node_Str");
  }
  initialize(n);
  boolean hasChildren=false;
  for (  Relationship r : availableRelsForSynth(n,RelType.STREECHILDOF)) {
    hasChildren=true;
    processIncomingRel(r);
  }
  if (VERBOSE && hasChildren) {
    print();
  }
  Set<Relationship> taxonomySingletonRels=new HashSet<Relationship>();
  Set<Node> taxonomySingletonNodes=new HashSet<Node>();
  for (  Relationship r : availableRelsForSynth(n,RelType.TAXCHILDOF)) {
    Node childNode=r.getStartNode();
    if (childNode.hasRelationship(Direction.INCOMING,RelType.TAXCHILDOF,RelType.STREECHILDOF)) {
      processIncomingRel(r);
    }
 else {
      taxonomySingletonRels.add(r);
      taxonomySingletonNodes.add(childNode);
    }
  }
  for (  Node child : children) {
    immediateSubtrees.put(child,new SynthesisSubtreeInfoUsingEdgeIds(n,child));
  }
  for (  Node child : taxonomySingletonNodes) {
    immediateSubtrees.put(child,new SynthesisSubtreeInfoUsingEdgeIds(n,child));
  }
  List<Integer> sortedRanks=new ArrayList<Integer>(observedRanks);
  Collections.sort(sortedRanks);
  Collections.reverse(sortedRanks);
  if (VERBOSE) {
    print("String_Node_Str",sortedRanks);
  }
  bestSet=new CandidateRelSet(n);
  for (  int currentRank : sortedRanks) {
    if (VERBOSE) {
      print("String_Node_Str" + currentRank);
    }
    Set<EdgeSet> overlappingSets=new HashSet<EdgeSet>();
    Set<EdgeSet> nonOverlappingSets=new HashSet<EdgeSet>();
    for (    EdgeSet edgeSet : edgeSetsByRankAndEdgeId.get(currentRank).values()) {
      if (bestSet.info().overlapsWith(edgeSet.info(),currentRank)) {
        overlappingSets.add(edgeSet);
      }
 else {
        nonOverlappingSets.add(edgeSet);
      }
    }
    while (overlappingSets.size() > 0) {
      if (VERBOSE) {
        print("String_Node_Str");
        for (        EdgeSet x : overlappingSets) {
          print(x,x.info());
        }
      }
      PrunableCPSupersetIterator<Relationship> combinations=new CartesianProduct<Relationship>((Set<Set<Relationship>>)(Set<?>)overlappingSets).withMissingElements().prunableIterator();
      while (combinations.hasNext()) {
        Set<Relationship> c=combinations.next();
        if (c.size() < 1) {
          continue;
        }
        CandidateRelSet proposed=new CandidateRelSet(c);
        if (!internallyDisjoint(proposed)) {
          combinations.prune();
          continue;
        }
        if (VERBOSE) {
          print("String_Node_Str",bestSet,"String_Node_Str",bestSet.info(),"String_Node_Str",proposed,"String_Node_Str",proposed.info());
        }
        CandidateRelSet candidate=(CandidateRelSet)updateSet(n,proposed,bestSet,currentRank);
        if (candidate == null) {
          combinations.prune();
          continue;
        }
        if (VERBOSE) {
          print("String_Node_Str",candidate,"String_Node_Str",bestSet);
        }
        if (candidate.info().improvesUpon(bestSet.info(),currentRank)) {
          bestSet=candidate;
        }
      }
      overlappingSets=new HashSet<EdgeSet>();
      Iterator<EdgeSet> nonOverlappingIter=nonOverlappingSets.iterator();
      while (nonOverlappingIter.hasNext()) {
        EdgeSet edgeSet=nonOverlappingIter.next();
        if (bestSet.info().overlapsWith(edgeSet.info(),currentRank)) {
          overlappingSets.add(edgeSet);
          nonOverlappingIter.remove();
        }
      }
      if (!nonOverlappingSets.isEmpty()) {
        if (VERBOSE) {
          print("String_Node_Str");
        }
        bestSet=augmentFromNonOverlappingSets(bestSet,nonOverlappingSets,currentRank);
      }
      if (VERBOSE) {
        print("String_Node_Str",bestSet,"String_Node_Str",bestSet.info());
      }
    }
    if (!nonOverlappingSets.isEmpty()) {
      if (VERBOSE) {
        print("String_Node_Str");
      }
      bestSet=augmentFromNonOverlappingSets(bestSet,nonOverlappingSets,currentRank);
    }
  }
  bestSet.info().complete();
  print("String_Node_Str" + n,"String_Node_Str",bestSet + "String_Node_Str" + bestSet.info());
  updateCompletedSubtreeInfo(n,bestSet.info());
  if (n.getId() == root.getId()) {
    completeRootInfo=bestSet.info();
  }
  return new ArrayList<Relationship>(bestSet);
}