protected List<Individual<A>> nextGeneration(List<Individual<A>> population,FitnessFunction<A> fitnessFn){
  List<Individual<A>> newPopulation=new ArrayList<Individual<A>>(population.size());
  for (int i=0; i < population.size(); i++) {
    Individual<A> x=randomSelection(population,fitnessFn);
    Individual<A> y=randomSelection(population,fitnessFn);
    Individual<A> child=reproduce(x,y);
    if (random.nextDouble() <= mutationProbability) {
      child=mutate(child);
    }
    newPopulation.add(child);
  }
  notifyProgressTracers(getIterations(),population);
  return newPopulation;
}

protected List < Individual < A > > nextGeneration ( List < Individual < A > > population , FitnessFunction < A > fitnessFn ) { List < Individual < A > > newPopulation = new ArrayList < Individual < A > > ( population . size ( ) ) ; for ( int i = 0 ; i < population . size ( ) ; i ++ ) { Individual < A > x = randomSelection ( population , fitnessFn ) ; Individual < A > y = randomSelection ( population , fitnessFn ) ; Individual < A > child = reproduce ( x , y ) ; if ( random . nextDouble ( ) <= mutationProbability ) { child = mutate ( child ) ; } newPopulation . add ( child ) ; } notifyProgressTracers ( getIterations ( ) , population ) ; return newPopulation ; }
primitive operation which is responsible for creating the next generation . override to get progress information !
