NSGA2Breeder extends SimpleBreeder { @Override public int numElites(EvolutionState state, int subpopulation) { if (breedingState != BreedingState.ARCHIVE_LOADED) state.output.fatal(String.format("%s: Tried to query numElites before loadElites() was called.", this.getClass().getSimpleName())); return numElites[subpopulation]; }  void setup(final EvolutionState state, final Parameter base); @Override int numElites(EvolutionState state, int subpopulation); @Override void postProcess(EvolutionState state); Population breedPopulation(EvolutionState state); ArrayList<Individual> buildArchive(final EvolutionState state, int subpop); ArrayList<ArrayList<Individual>> assignFrontRanks(Subpopulation subpop);  }
@Test public void testNumElites() { state.population = getTestPopulation(); final Population newpop = state.population.emptyClone(); final NSGA2Breeder instance = new NSGA2Breeder(); instance.setup(state, BASE); instance.loadElites(state, newpop); final int result = instance.numElites(state, 0); assertEquals(10, result); }