/* Copyright 2006 by Sean Luke Licensed under the Academic Free License version 3.0 See the file "LICENSE" for more information */ package ec.steadystate; import ec.simple.*; import ec.*; import ec.util.*; import java.util.*; /* * SteadyStateBreeder.java * */ /** * This subclass of Breeder performs the evaluation portion of Steady-State Evolution and (in distributed form) * Asynchronous Evolution. The procedure is as follows. We begin with an empty Population and one by * one create new Indivdiuals and send them off to be evaluated. In basic Steady-State Evolution the * individuals are immediately evaluated and we wait for them; but in Asynchronous Evolution the individuals are evaluated * for however long it takes and we don't wait for them to finish. When individuals return they are * added to the Population until it is full. No duplicate individuals are allowed. * *

At this point the system switches to its "steady state": individuals are bred from the population * one by one, and sent off to be evaluated. Once again, in basic Steady-State Evolution the * individuals are immediately evaluated and we wait for them; but in Asynchronous Evolution the individuals are evaluated * for however long it takes and we don't wait for them to finish. When an individual returns, we * mark an individual in the Population for death, then replace it with the new returning individual. * Note that during the steady-state, Asynchronous Evolution could be still sending back some "new" individuals * created during the initialization phase, not "bred" individuals. * *

The determination of how an individual is marked for death is done by the SteadyStateBreeder. This is * a SelectionMethod. Note that this SelectionMethod probably should not be selecting for the "fittest" * individuals, but rather for either random individuals (the standard approach) or for "bad" individuals. *

Parameters
deselector
classname, inherits and != ec.SelectionMethod
(The SelectionMethod used to pick individuals for death)
* @author Sean Luke * @version 1.0 */ public class SteadyStateBreeder extends SimpleBreeder { /** If st.firstTimeAround, this acts exactly like SimpleBreeder. Else, it only breeds one new individual per subpopulation, to place in position 0 of the subpopulation. */ BreedingPipeline[] bp; public static final String P_DESELECTOR = "deselector"; // public static final String P_RETRIES = "duplicate-retries"; /** Loaded during the first iteration of breedPopulation */ SelectionMethod deselectors[]; /** Do we allow duplicates? */ // public int numDuplicateRetries; public SteadyStateBreeder() { bp = null; deselectors = null; } public void setup(final EvolutionState state, final Parameter base) { super.setup(state,base); Parameter p = new Parameter(Initializer.P_POP).push(Population.P_SIZE); int size = state.parameters.getInt(p,null,1); // if size is wrong, we'll let Population complain about it -- for us, we'll just make 0-sized arrays and drop out. if (size > 0) deselectors = new SelectionMethod[size]; // load the deselectors for(int x=0;x= 0.\n", base.push(P_RETRIES),null); */ } /** Called to check to see if the breeding sources are correct -- if you use this method, you must call state.output.exitIfErrors() immediately afterwards. */ public void sourcesAreProperForm(final SteadyStateEvolutionState state, final BreedingPipeline[] breedingPipelines) { for(int x=0;x