Program: 64649
Project: 64649
Buggy source:
/** 
 * Perform the crossover operation.
 * @param probability Crossover setProbability
 * @param parent1     The first parent
 * @param parent2     The second parent
 * @return An array containing the two offspring
 */
public List<BinarySolution> doCrossover(double probability,BinarySolution parent1,BinarySolution parent2){
  List<BinarySolution> offspring=new ArrayList<>(2);
  offspring.add((BinarySolution)parent1.copy());
  offspring.add((BinarySolution)parent2.copy());
  if (randomGenerator.nextDouble() < probability) {
    int totalNumberOfBits=parent1.getTotalNumberOfBits();
    int crossoverPoint=randomGenerator.nextInt(0,totalNumberOfBits - 1);
    int variable=0;
    int bitsAccount=parent1.getVariableValue(variable).getBinarySetLength();
    while (bitsAccount < (crossoverPoint + 1)) {
      variable++;
      bitsAccount+=parent1.getVariableValue(variable).getBinarySetLength();
    }
    int diff=bitsAccount - crossoverPoint;
    int intoVariableCrossoverPoint=parent1.getVariableValue(variable).getBinarySetLength() - diff;
    BinarySet offspring1, offspring2;
    offspring1=(BinarySet)parent1.getVariableValue(variable).clone();
    offspring2=(BinarySet)parent1.getVariableValue(variable).clone();
    for (int i=intoVariableCrossoverPoint; i < offspring1.getBinarySetLength(); i++) {
      boolean swap=offspring1.get(i);
      offspring1.set(i,offspring2.get(i));
      offspring2.set(i,swap);
    }
    offspring.get(0).setVariableValue(variable,offspring1);
    offspring.get(1).setVariableValue(variable,offspring2);
    for (int i=0; i < variable; i++) {
      offspring.get(0).setVariableValue(i,parent2.getVariableValue(i));
      offspring.get(1).setVariableValue(i,parent1.getVariableValue(i));
    }
  }
  return offspring;
}

Fixed version (ground truth):
/** 
 * Perform the crossover operation.
 * @param probability Crossover setProbability
 * @param parent1     The first parent
 * @param parent2     The second parent
 * @return An array containing the two offspring
 */
public List<BinarySolution> doCrossover(double probability,BinarySolution parent1,BinarySolution parent2){
  List<BinarySolution> offspring=new ArrayList<>(2);
  offspring.add((BinarySolution)parent1.copy());
  offspring.add((BinarySolution)parent2.copy());
  if (randomGenerator.nextDouble() < probability) {
    int totalNumberOfBits=parent1.getTotalNumberOfBits();
    int crossoverPoint=randomGenerator.nextInt(0,totalNumberOfBits - 1);
    int variable=0;
    int bitsAccount=parent1.getVariableValue(variable).getBinarySetLength();
    while (bitsAccount < (crossoverPoint + 1)) {
      variable++;
      bitsAccount+=parent1.getVariableValue(variable).getBinarySetLength();
    }
    int diff=bitsAccount - crossoverPoint;
    int intoVariableCrossoverPoint=parent1.getVariableValue(variable).getBinarySetLength() - diff;
    BinarySet offspring1, offspring2;
    offspring1=(BinarySet)parent1.getVariableValue(variable).clone();
    offspring2=(BinarySet)parent2.getVariableValue(variable).clone();
    for (int i=intoVariableCrossoverPoint; i < offspring1.getBinarySetLength(); i++) {
      boolean swap=offspring1.get(i);
      offspring1.set(i,offspring2.get(i));
      offspring2.set(i,swap);
    }
    offspring.get(0).setVariableValue(variable,offspring1);
    offspring.get(1).setVariableValue(variable,offspring2);
    for (int i=variable + 1; i < parent1.getNumberOfVariables(); i++) {
      offspring.get(0).setVariableValue(i,parent2.getVariableValue(i));
      offspring.get(1).setVariableValue(i,parent1.getVariableValue(i));
    }
  }
  return offspring;
}