Program: 3052
Project: 3052
Buggy source:
@Override public void run(){
  prog.clearEvalStats();
  DistMatrix distMatrix=new DistMatrix(nodeCount);
  net=new Net();
  Node[] nodeArray=new Node[nodeCount];
  for (int i=0; i < nodeCount; i++) {
    nodeArray[i]=net.addNode();
  }
  for (int i=0; i < edgeCount; i++) {
    double bestWeight=-1;
    int bestOrigIndex=-1;
    int bestTargIndex=-1;
    for (int j=0; j < trials; j++) {
      int origIndex=-1;
      int targIndex=-1;
      while ((origIndex == targIndex) || (distMatrix.getDist(origIndex,targIndex) < 2)) {
        origIndex=RandomGenerator.instance().random.nextInt(nodeCount);
        targIndex=RandomGenerator.instance().random.nextInt(nodeCount);
      }
      Node origNode=nodeArray[origIndex];
      Node targNode=nodeArray[targIndex];
      double directDistance=distMatrix.getDist(origNode.getId(),targNode.getId());
      double reverseDistance=distMatrix.getDist(targNode.getId(),origNode.getId());
      prog.vars[0]=(double)origIndex;
      prog.vars[1]=(double)targIndex;
      prog.vars[2]=(double)origNode.getInDegree();
      prog.vars[3]=(double)origNode.getOutDegree();
      prog.vars[4]=(double)targNode.getInDegree();
      prog.vars[5]=(double)targNode.getOutDegree();
      prog.vars[6]=directDistance;
      prog.vars[7]=reverseDistance;
      double weight=prog.eval(i);
      if (weight < 0) {
        weight=0;
      }
      if (weight > bestWeight) {
        bestWeight=weight;
        bestOrigIndex=origIndex;
        bestTargIndex=targIndex;
      }
    }
    Node origNode=nodeArray[bestOrigIndex];
    Node targNode=nodeArray[bestTargIndex];
    net.addEdge(origNode,targNode,i);
    distMatrix.updateDistances(net,bestOrigIndex,bestTargIndex);
    simulated=true;
  }
}

Fixed version (ground truth):
@Override public void run(){
  prog.clearEvalStats();
  DistMatrix distMatrix=new DistMatrix(nodeCount);
  net=new Net();
  Node[] nodeArray=new Node[nodeCount];
  for (int i=0; i < nodeCount; i++) {
    nodeArray[i]=net.addNode();
  }
  for (int i=0; i < edgeCount; i++) {
    double bestWeight=-1;
    int bestOrigIndex=-1;
    int bestTargIndex=-1;
    for (int j=0; j < trials; j++) {
      int origIndex=-1;
      int targIndex=-1;
      while ((origIndex == targIndex) || (distMatrix.getDist(origIndex,targIndex) < 2)) {
        origIndex=RandomGenerator.instance().random.nextInt(nodeCount);
        targIndex=RandomGenerator.instance().random.nextInt(nodeCount);
      }
      Node origNode=nodeArray[origIndex];
      Node targNode=nodeArray[targIndex];
      double directDistance=distMatrix.getDist(origNode.getId(),targNode.getId());
      double reverseDistance=distMatrix.getDist(targNode.getId(),origNode.getId());
      prog.vars[0]=(double)origIndex;
      prog.vars[1]=(double)targIndex;
      prog.vars[2]=(double)origNode.getInDegree();
      prog.vars[3]=(double)origNode.getOutDegree();
      prog.vars[4]=(double)targNode.getInDegree();
      prog.vars[5]=(double)targNode.getOutDegree();
      prog.vars[6]=directDistance;
      prog.vars[7]=reverseDistance;
      double weight=prog.eval(i);
      if (weight < 0) {
        weight=0;
      }
      if (Double.isNaN(weight)) {
        weight=0;
      }
      if (weight > bestWeight) {
        bestWeight=weight;
        bestOrigIndex=origIndex;
        bestTargIndex=targIndex;
      }
    }
    Node origNode=nodeArray[bestOrigIndex];
    Node targNode=nodeArray[bestTargIndex];
    net.addEdge(origNode,targNode,i);
    distMatrix.updateDistances(net,bestOrigIndex,bestTargIndex);
    simulated=true;
  }
}