// first put all the genomes into correct species
for (Genome genome : result.getGenomes()) {
NEATGenome neatGenome = (NEATGenome) genome;
int speciesId = (int) neatGenome.getSpeciesID();
Species species = speciesMap.get(speciesId);
if (species != null) {
species.getMembers().add(neatGenome);
}
neatGenome.setInputCount(result.getInputCount());
neatGenome.setOutputCount(result.getOutputCount());
}
// set the species leader links
for (Species species : leaderMap.keySet()) {
int leaderID = leaderMap.get(species);
Genome leader = genomeMap.get(leaderID);
species.setLeader(leader);
((BasicSpecies)species).setPopulation(result);
}
return result;
}