public MLMethodGeneticAlgorithm(final MethodFactory phenotypeFactory,
final CalculateScore calculateScore, final int populationSize) {
super(TrainingImplementationType.Iterative);
// Create the population
final Population population = new BasicPopulation(populationSize, null);
final Species defaultSpecies = population.createSpecies();
for (int i = 0; i < population.getPopulationSize(); i++) {
final MLEncodable chromosomeNetwork = (MLEncodable) phenotypeFactory
.factor();
final MLMethodGenome genome = new MLMethodGenome(chromosomeNetwork);
defaultSpecies.add(genome);
}
defaultSpecies.setLeader(defaultSpecies.getMembers().get(0));
population.setGenomeFactory(new MLMethodGenomeFactory(phenotypeFactory,
population));
// create the trainer
this.genetic = new MLMethodGeneticAlgorithmHelper(population,
calculateScore);