NSGA-II Population Size Bug
SigmaX opened this issue · 1 comments
NSGA-II reduces the population down to the archive at the end of a generation, and then it is supposed to generate a new large population. But it's not doing that, so we end up with a tiny population after the first generation.
I was testing my application with NSGA2 and found an issue with population size which might be related to this one. Hopefully I can help.
NSGA2Breeder.buildArchive() always returns the archive with the same size as population.
SimpleBreeder.breedPopulation() gets the number of individuals to breed like this:
int length = newSubpopSize[x] - numElites;
Where numElites is the archive size in case of NSGA2, i.e. the same size as population. Therefore the number of individuals to breed is always 0 and new populations contains only the archive where all the individuals are from the previous population and already evaluated.
I did some dirty work-around which seem to work (but it might not work in all the cases and maybe even cause some issues elsewhere):
NSGA2Breeder.buildArchive() instead of:
int originalPopSize = state.population.subpops.get(subpop).individuals.size();
I used:
int originalPopSize = state.population.subpops.get(subpop).initialSize;
Meaning the archive size is always the size of the initial population. This can cause issues with some variable population size implementations.
And in SimpleBreeder.breedPopulation() instead of
int length = newSubpopSize[x] - numElites;
I used:
int length = newSubpopSize[x];
if (numElites < newSubpopSize[x]) {
length -= numElites;
}
So initially it doubles the size of the population (archive + initial size), but in next generations the size stays the same as archive is already included in the population.
As I mentioned, it's just a work-around to demonstrate it works in my specific case.