Class SimpleBreeder
- java.lang.Object
-
- ec.Breeder
-
- ec.simple.SimpleBreeder
-
- Direct Known Subclasses:
- NSGA2Breeder, SpatialBreeder, SPEA2Breeder, SteadyStateBreeder
public class SimpleBreeder extends Breeder
Breeds each subpopulation separately, with no inter-population exchange, and using a generational approach. A SimpleBreeder may have multiple threads; it divvys up a subpopulation into chunks and hands one chunk to each thread to populate. One array of BreedingPipelines is obtained from a population's Species for each operating breeding thread.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description PopulationbackupPopulationbooleanclonePipelineAndPopulationint[]eliteAn array[subpop] of the number of elites to keep for that subpopulationdouble[]eliteFracstatic intNOT_SETstatic java.lang.StringP_CLONE_PIPELINE_AND_POPULATIONstatic java.lang.StringP_ELITEstatic java.lang.StringP_ELITE_FRACstatic java.lang.StringP_REEVALUATE_ELITESstatic java.lang.StringP_SEQUENTIAL_BREEDINGThreadPoolpoolboolean[]reevaluateElitesbooleansequentialBreeding
-
Constructor Summary
Constructors Constructor and Description SimpleBreeder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PopulationbreedPopulation(EvolutionState state)A simple breeder that doesn't attempt to do any cross- population breeding.intcomputeSubpopulationLength(EvolutionState state, Population newpop, int subpopulation, int threadnum)Elites are often stored in the top part of the subpopulation; this function returns what part of the subpopulation contains individuals to replace with newly-bred ones (up to but not including the elites).intnumElites(EvolutionState state, int subpopulation)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).booleanusingElitism(int subpopulation)
-
-
-
Field Detail
-
P_ELITE
public static final java.lang.String P_ELITE
- See Also:
- Constant Field Values
-
P_ELITE_FRAC
public static final java.lang.String P_ELITE_FRAC
- See Also:
- Constant Field Values
-
P_REEVALUATE_ELITES
public static final java.lang.String P_REEVALUATE_ELITES
- See Also:
- Constant Field Values
-
P_SEQUENTIAL_BREEDING
public static final java.lang.String P_SEQUENTIAL_BREEDING
- See Also:
- Constant Field Values
-
P_CLONE_PIPELINE_AND_POPULATION
public static final java.lang.String P_CLONE_PIPELINE_AND_POPULATION
- See Also:
- Constant Field Values
-
elite
public int[] elite
An array[subpop] of the number of elites to keep for that subpopulation
-
eliteFrac
public double[] eliteFrac
-
reevaluateElites
public boolean[] reevaluateElites
-
sequentialBreeding
public boolean sequentialBreeding
-
clonePipelineAndPopulation
public boolean clonePipelineAndPopulation
-
backupPopulation
public Population backupPopulation
-
NOT_SET
public static final int NOT_SET
- See Also:
- Constant Field Values
-
pool
public ThreadPool pool
-
-
Method Detail
-
usingElitism
public boolean usingElitism(int subpopulation)
-
numElites
public int numElites(EvolutionState state, int subpopulation)
-
setup
public void setup(EvolutionState state, Parameter base)
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.
-
computeSubpopulationLength
public int computeSubpopulationLength(EvolutionState state, Population newpop, int subpopulation, int threadnum)
Elites are often stored in the top part of the subpopulation; this function returns what part of the subpopulation contains individuals to replace with newly-bred ones (up to but not including the elites).
-
breedPopulation
public Population breedPopulation(EvolutionState state)
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
-
shouldBreedSubpop
public boolean shouldBreedSubpop(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).
-
-
DMelt 3.0 © DataMelt by jWork.ORG