public class DEBreeder extends Breeder
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.0 |
The "F" mutation scaling factor |
base.cr 0.0 <= double <= 1.0 |
The "Cr" probability of crossing over genes |
Modifier and Type | Field and Description |
---|---|
int[] |
bestSoFarIndex
the best individuals in each population (required by some DE breeders).
|
double |
Cr
Probability of crossover per gene
|
static double |
CR_UNSPECIFIED |
double |
F
Scaling factor for mutation
|
static java.lang.String |
P_Cr |
static java.lang.String |
P_F |
static java.lang.String |
P_OUT_OF_BOUNDS_RETRIES |
Population |
previousPopulation
the previous population is stored in order to have parents compete directly with their children
|
int |
retries |
Constructor and Description |
---|
DEBreeder() |
Modifier and Type | Method and Description |
---|---|
Population |
breedPopulation(EvolutionState state)
Breeds state.population, returning a new population.
|
DoubleVectorIndividual |
createIndividual(EvolutionState state,
int subpop,
int index,
int thread) |
DoubleVectorIndividual |
crossover(EvolutionState state,
DoubleVectorIndividual target,
DoubleVectorIndividual child,
int thread)
Crosses over child with target, storing the result in child and returning it.
|
void |
prepareDEBreeder(EvolutionState state) |
void |
setup(EvolutionState state,
Parameter base)
Sets up the object by reading it from the parameters stored
in state, built off of the parameter base base.
|
boolean |
valid(DoubleVectorIndividual ind)
Tests the Individual to see if its values are in range.
|
public static final double CR_UNSPECIFIED
public double F
public double Cr
public int retries
public static final java.lang.String P_F
public static final java.lang.String P_Cr
public static final java.lang.String P_OUT_OF_BOUNDS_RETRIES
public Population previousPopulation
public int[] bestSoFarIndex
public void setup(EvolutionState state, Parameter base)
Setup
public void prepareDEBreeder(EvolutionState state)
public Population breedPopulation(EvolutionState state)
Breeder
breedPopulation
in class Breeder
public boolean valid(DoubleVectorIndividual ind)
public DoubleVectorIndividual createIndividual(EvolutionState state, int subpop, int index, int thread)
public DoubleVectorIndividual crossover(EvolutionState state, DoubleVectorIndividual target, DoubleVectorIndividual child, int thread)