* @param population the population to evaluate
* @param previousBest the best solution from the previous iteration
* @return the new best solution.
*/
protected ParameterArray evaluatePopulation(List<ParameterArray> population, ParameterArray previousBest) {
ParameterArray bestFitness = previousBest;
for (ParameterArray p : population) {
double fitness;
if (optimizee_.evaluateByComparison()) {
fitness = optimizee_.compareFitness(p, previousBest);
} else {
fitness = optimizee_.evaluateFitness(p);
}
System.out.println("f="+fitness);
p.setFitness(fitness);
if (fitness > bestFitness.getFitness()) {
bestFitness = p;
// show it if better than what we had before
notifyOfChange(p);
ThreadUtil.sleep(500);
}
}
return bestFitness.copy();
}