Program: 39282
Project: 39282
Buggy source:
/** 
 * Perform crossover between two TWEANN genotypes.
 * @param toModify = Copy of parent genotype. Is actually modified by the crossover, to be one of the offspring. It is modified via side-effects because it is not returned.
 * @param toReturn = The other parent. Not actually returned, but but the offspring that is returned by this method takes its basic structure from this genotype (unless excess crossover occurs)
 * @return One of the offspring of crossover is returned (the other modifiedvia side-effects)
 */
public Genotype<TWEANN> crossover(Genotype<TWEANN> toModify,Genotype<TWEANN> toReturn){
  includeExcess=RandomNumbers.randomGenerator.nextFloat() < includeExcessRate;
  TWEANNGenotype tg=(TWEANNGenotype)toReturn;
  TWEANNGenotype tm=(TWEANNGenotype)toModify;
  ArrayList<ArrayList<NodeGene>> alignedNodes=new ArrayList<ArrayList<NodeGene>>(2);
  try {
    alignedNodes.add(alignNodesToArchetype(tm.nodes,tg.archetypeIndex));
  }
 catch (  IllegalArgumentException e) {
    System.out.println("String_Node_Str" + tm.numOut);
    System.out.println("String_Node_Str" + tm.numModules);
    System.out.println("String_Node_Str" + tm.neuronsPerModule);
    e.printStackTrace();
    System.exit(1);
  }
  try {
    alignedNodes.add(alignNodesToArchetype(tg.nodes,tg.archetypeIndex));
  }
 catch (  IllegalArgumentException e) {
    System.out.println("String_Node_Str" + tg.numOut);
    System.out.println("String_Node_Str" + tg.numModules);
    System.out.println("String_Node_Str" + tg.neuronsPerModule);
    e.printStackTrace();
    System.exit(1);
  }
  ArrayList<ArrayList<NodeGene>> crossedNodes=cross(alignedNodes.get(0),alignedNodes.get(1));
  ArrayList<ArrayList<LinkGene>> alignedLinks=alignLinkGenes(((TWEANNGenotype)toModify).links,tg.links);
  ArrayList<ArrayList<LinkGene>> crossedLinks=cross(alignedLinks.get(0),alignedLinks.get(1));
  int[] originalAssociations=Arrays.copyOf(tm.moduleAssociations,tm.moduleAssociations.length);
  tm.nodes=crossedNodes.get(0);
  tm.links=crossedLinks.get(0);
  tm.calculateNumModules();
  if (CommonConstants.hierarchicalMultitask) {
    tm.crossModuleAssociations(originalAssociations,tg.moduleAssociations);
  }
  TWEANNGenotype result=new TWEANNGenotype(crossedNodes.get(1),crossedLinks.get(1),tg.neuronsPerModule,tg.standardMultitask,tg.hierarchicalMultitask,tg.archetypeIndex);
  result.setModuleUsage(Arrays.copyOf(tg.getModuleUsage(),tg.getModuleUsage().length));
  result.calculateNumModules();
  if (CommonConstants.hierarchicalMultitask) {
    result.crossModuleAssociations(tg.moduleAssociations,originalAssociations);
  }
  if (CommonConstants.meltAfterCrossover) {
    tm.meltNetwork();
    result.meltNetwork();
  }
 else {
    if (!tm.existsAlterableLink()) {
      if (Parameters.parameters.booleanParameter("String_Node_Str")) {
        new MeltThenFreezePreferenceMutation().mutate(tm);
      }
 else       if (Parameters.parameters.booleanParameter("String_Node_Str")) {
        new MeltThenFreezePolicyMutation().mutate(tm);
      }
 else {
        System.out.println("String_Node_Str");
        System.exit(1);
      }
    }
    if (!result.existsAlterableLink()) {
      if (Parameters.parameters.booleanParameter("String_Node_Str")) {
        new MeltThenFreezePreferenceMutation().mutate(result);
      }
 else       if (Parameters.parameters.booleanParameter("String_Node_Str")) {
        new MeltThenFreezePolicyMutation().mutate(result);
      }
 else {
        System.out.println("String_Node_Str");
        System.exit(1);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Perform crossover between two TWEANN genotypes.
 * @param toModify = Copy of parent genotype. Is actually modified by the crossover, to be one of the offspring. It is modified via side-effects because it is not returned.
 * @param toReturn = The other parent. Not actually returned, but but the offspring that is returned by this method takes its basic structure from this genotype (unless excess crossover occurs)
 * @return One of the offspring of crossover is returned (the other modifiedvia side-effects)
 */
public Genotype<TWEANN> crossover(Genotype<TWEANN> toModify,Genotype<TWEANN> toReturn){
}