Program: 149563
Project: 149563
Buggy source:
/** 
 * Evolve the population of individuals until convergence of the most fit individual in the population. <p> The population will grow until the desired population size by recombination of individual pairs chosen from the population by the selection strategy. Child sequences will be subject to mutation. The fitness of all the individuals in the new population is evaluated and convergence checked for the fittest individual. If the initial population is small (<2 or <Chromosome.length()) then mutation will be used to expand it before recombination. <p> The process of grow, evaluate, select is repeated until convergence. <p> Note: the subset of individuals selected for the next generation by the selection strategy will be unchanged (i.e. no mutation). This allows the fittest individuals to remain unchanged.
 * @param mutator
 * @param recombiner
 * @param checker
 * @throws InvalidPopulationSize if the population is less than 2 (this can occur after selection)
 * @return The best individual
 */
public Chromosome evolve(Mutator mutator,Recombiner recombiner,FitnessFunction fitnessFunction,SelectionStrategy selectionStrategy,ConvergenceChecker checker){
  grow(selectionStrategy,mutator,recombiner);
  Chromosome current=evaluateFitness(fitnessFunction);
  Chromosome previous;
  boolean converged=false;
  while (!converged) {
    previous=current;
    select(selectionStrategy);
    grow(selectionStrategy,mutator,recombiner);
    current=evaluateFitness(fitnessFunction);
    converged=checker.converged(previous,current);
  }
  return current;
}

Fixed version (ground truth):
/** 
 * Evolve the population of individuals until convergence of the most fit individual in the population. <p> The population will grow until the desired population size by recombination of individual pairs chosen from the population by the selection strategy. Child sequences will be subject to mutation. The fitness of all the individuals in the new population is evaluated and convergence checked for the fittest individual. If the initial population is small (<2 or <Chromosome.length()) then mutation will be used to expand it before recombination. <p> The process of grow, evaluate, select is repeated until convergence. <p> Note: the subset of individuals selected for the next generation by the selection strategy will be unchanged (i.e. no mutation). This allows the fittest individuals to remain unchanged.
 * @param mutator
 * @param recombiner
 * @param checker
 * @throws InvalidPopulationSize if the population is less than 2 (this can occur after selection)
 * @return The best individual
 */
public Chromosome evolve(Mutator mutator,Recombiner recombiner,FitnessFunction fitnessFunction,SelectionStrategy selectionStrategy,ConvergenceChecker checker){
  grow(selectionStrategy,mutator,recombiner);
  Chromosome current=evaluateFitness(fitnessFunction);
  Chromosome previous;
  boolean converged=false;
  while (!converged) {
    previous=current;
    select(selectionStrategy);
    grow(selectionStrategy,mutator,recombiner);
    current=evaluateFitness(fitnessFunction);
    converged=checker.converged(previous,current);
  }
  if (tracker != null)   tracker.status("String_Node_Str",iteration);
  return current;
}