Class DEBreeder
- java.lang.Object
-
- ec.Breeder
-
- ec.de.DEBreeder
-
- Direct Known Subclasses:
- Best1BinDEBreeder, Rand1EitherOrDEBreeder
public class DEBreeder extends Breeder
DEBreeder provides a straightforward Differential Evolution (DE) breeder for the ECJ system. The code is derived from the "classic" DE algorithm, known as DE/rand/1/bin, found on page 140 of "Differential Evolution: A Practical Approach to Global Optimization" by Kenneth Price, Rainer Storn, and Jouni Lampinen.DEBreeder requires that all individuals be DoubleVectorIndividuals.
In short, the algorithm is as follows. For each individual in the population, we produce a child by selecting three (different) individuals, none the original individual, called r0, r1, and r2. We then create an individal c, defined as c = r0 + F * (r1 - r2). Last, we cross over c with the original individual and produce a single child, using uniform crossover with gene-independent crossover probability "Cr".
This class should be used in conjunction with DEEvaluator, which allows the children to enter the population only if they're superior to their parents (the original individuals). If so, they replace their parents.
Parameters
base.f
0.0 <= double <= 1.0The "F" mutation scaling factor base.cr
0.0 <= double <= 1.0The "Cr" probability of crossing over genes - See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description int[]bestSoFarIndexthe best individuals in each population (required by some DE breeders).doubleCrProbability of crossover per genestatic doubleCR_UNSPECIFIEDdoubleFScaling factor for mutationstatic java.lang.StringP_Crstatic java.lang.StringP_Fstatic java.lang.StringP_OUT_OF_BOUNDS_RETRIESPopulationpreviousPopulationthe previous population is stored in order to have parents compete directly with their childrenintretries
-
Constructor Summary
Constructors Constructor and Description DEBreeder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PopulationbreedPopulation(EvolutionState state)Breeds state.population, returning a new population.DoubleVectorIndividualcreateIndividual(EvolutionState state, int subpop, int index, int thread)DoubleVectorIndividualcrossover(EvolutionState state, DoubleVectorIndividual target, DoubleVectorIndividual child, int thread)Crosses over child with target, storing the result in child and returning it.voidprepareDEBreeder(EvolutionState state)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.booleanvalid(DoubleVectorIndividual ind)Tests the Individual to see if its values are in range.
-
-
-
Field Detail
-
CR_UNSPECIFIED
public static final double CR_UNSPECIFIED
- See Also:
- Constant Field Values
-
F
public double F
Scaling factor for mutation
-
Cr
public double Cr
Probability of crossover per gene
-
retries
public int retries
-
P_F
public static final java.lang.String P_F
- See Also:
- Constant Field Values
-
P_Cr
public static final java.lang.String P_Cr
- See Also:
- Constant Field Values
-
P_OUT_OF_BOUNDS_RETRIES
public static final java.lang.String P_OUT_OF_BOUNDS_RETRIES
- See Also:
- Constant Field Values
-
previousPopulation
public Population previousPopulation
the previous population is stored in order to have parents compete directly with their children
-
bestSoFarIndex
public int[] bestSoFarIndex
the best individuals in each population (required by some DE breeders). It's not required by DEBreeder's algorithm
-
-
Method Detail
-
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.
-
prepareDEBreeder
public void prepareDEBreeder(EvolutionState state)
-
breedPopulation
public Population breedPopulation(EvolutionState state)
Description copied from class:BreederBreeds state.population, returning a new population. In general, state.population should not be modified.- Specified by:
breedPopulationin classBreeder
-
valid
public boolean valid(DoubleVectorIndividual ind)
Tests the Individual to see if its values are in range.
-
createIndividual
public DoubleVectorIndividual createIndividual(EvolutionState state, int subpop, int index, int thread)
-
crossover
public DoubleVectorIndividual crossover(EvolutionState state, DoubleVectorIndividual target, DoubleVectorIndividual child, int thread)
Crosses over child with target, storing the result in child and returning it. The default procedure copies each value from the target, with independent probability CROSSOVER, into the child. The crossover guarantees that at least one child value, chosen at random, will not be overwritten. Override this method to perform some other kind of crossover.
-
-
DMelt 3.0 © DataMelt by jWork.ORG