/** * @author Klaus Meffert * @since 2.4 */ public void testKeepPopSizeConstant_0() { Configuration conf = new Configuration(); assertEquals(true, conf.isKeepPopulationSizeConstant()); conf.setKeepPopulationSizeConstant(false); assertEquals(false, conf.isKeepPopulationSizeConstant()); conf.setKeepPopulationSizeConstant(true); assertEquals(true, conf.isKeepPopulationSizeConstant()); conf.setKeepPopulationSizeConstant(false); assertEquals(false, conf.isKeepPopulationSizeConstant()); assertEquals(JGAPFactory.class, conf.getJGAPFactory().getClass()); }
/** * Cares that population size is kept constant and does not exceed the desired size. * * @param a_pop Population * @param a_conf Configuration */ protected void keepPopSizeConstant(Population a_pop, Configuration a_conf) { if (a_conf.isKeepPopulationSizeConstant()) { try { a_pop.keepPopSizeConstant(); } catch (InvalidConfigurationException iex) { throw new RuntimeException(iex); } } }