Class SimpleBreeder
- All Implemented Interfaces:
Setup,Singleton,Serializable
- Direct Known Subclasses:
NSGA2Breeder,SpatialBreeder,SPEA2Breeder,SteadyStateBreeder
Prior to breeding a subpopulation, a SimpleBreeder may first fill part of the new subpopulation up with the best n individuals from the old subpopulation. By default, n is 0 for each subpopulation (that is, this "elitism" is not done). The elitist step is performed by a single thread.
If the sequential parameter below is true, then breeding is done specially: instead of breeding all Subpopulations each generation, we only breed one each generation. The subpopulation index to breed is determined by taking the generation number, modulo the total number of subpopulations. Use of this parameter outside of a coevolutionary context (see ec.coevolve.MultiPopCoevolutionaryEvaluator) is very rare indeed.
SimpleBreeder adheres to the default-subpop parameter in Population: if either an 'elite' or 'reevaluate-elites' parameter is missing, it will use the default subpopulation's value and signal a warning.
Parameters
| base.elite.i int >= 0 (default=0) |
(the number of elitist individuals for subpopulation i) |
| base.reevaluate-elites.i boolean (default = false) |
(should we reevaluate the elites of subpopulation i each generation?) |
| base.sequential boolean (default = false) |
(should we breed just one subpopulation each generation (as opposed to all of them)?) |
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanint[]An array[subpop] of the number of elites to keep for that subpopulationdouble[]An array[subpop] of the *fraction* of elites to keep for that subpopulationArrayList<Individual>[][]static final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringboolean[]Fields inherited from class ec.Breeder
sequentialBreeding -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbreedPopChunk(Population newpop, EvolutionState state, int[] numinds, int[] from, int threadnum) A private helper function for breedPopulation which breeds a chunk of individuals in a subpopulation for a given thread.protected voidbreedPopChunkProduce(int position) breedPopulation(EvolutionState state) A simple breeder that doesn't attempt to do any cross- population breeding.protected voidloadElites(EvolutionState state, Population newpop) A protected helper function for breedPopulation which loads elites into a subpopulation.protected intnextSubpopulationSize(EvolutionState state, int subpop) Returns the next subpopulation size.intnumElites(EvolutionState state, int subpopulation) voidpostProcess(EvolutionState state) A hook to do final modifications as necessary to the population after breeding has concluded.voidsetup(EvolutionState state, Parameter base) Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.booleanshouldBreedSubpop(EvolutionState state, int subpop, int threadnum) Returns true if we're doing sequential breeding and it's the subpopulation's turn (round robin, one subpopulation per generation).protected voidunmarkElitesEvaluated(EvolutionState state, Population newpop) booleanusingElitism(int subpopulation)
-
Field Details
-
P_ELITE
- See Also:
-
P_ELITE_FRAC
- See Also:
-
P_REEVALUATE_ELITES
- See Also:
-
P_SEQUENTIAL_BREEDING
- See Also:
-
P_CLONE_PIPELINE_AND_POPULATION
- See Also:
-
elite
public int[] eliteAn array[subpop] of the number of elites to keep for that subpopulation -
eliteFrac
public double[] eliteFracAn array[subpop] of the *fraction* of elites to keep for that subpopulation -
reevaluateElites
public boolean[] reevaluateElites -
clonePipelineAndPopulation
public boolean clonePipelineAndPopulation -
backupPopulation
-
newIndividuals
-
NOT_SET
public static final int NOT_SET- See Also:
-
pool
-
-
Constructor Details
-
SimpleBreeder
public SimpleBreeder()
-
-
Method Details
-
usingElitism
public boolean usingElitism(int subpopulation) -
numElites
-
setup
Description copied from interface:SetupSets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else. -
nextSubpopulationSize
Returns the next subpopulation size. By default this is the CURRENT subpopulation size, but it could be overridden if you have modified the current subpopulation size (as in NSGA-II) but don't want the next subpopulation size to be affected. -
breedPopulation
A simple breeder that doesn't attempt to do any cross- population breeding. Basically it applies pipelines, one per thread, to various subchunks of a new population.- Specified by:
breedPopulationin classBreeder
-
postProcess
A hook to do final modifications as necessary to the population after breeding has concluded. By default this does nothing, but multiobjective breeders, which temporarily replace the old population while it's being breeded, may use this to put the popuplation back again just in case statistics needs it. -
shouldBreedSubpop
Returns true if we're doing sequential breeding and it's the subpopulation's turn (round robin, one subpopulation per generation).- Overrides:
shouldBreedSubpopin classBreeder
-
breedPopChunk
protected void breedPopChunk(Population newpop, EvolutionState state, int[] numinds, int[] from, int threadnum) A private helper function for breedPopulation which breeds a chunk of individuals in a subpopulation for a given thread. Although this method is declared public (for the benefit of a private helper class in this file), you should not call it. -
breedPopChunkProduce
protected void breedPopChunkProduce(int position) -
unmarkElitesEvaluated
-
loadElites
A protected helper function for breedPopulation which loads elites into a subpopulation.
-