Class MuCommaLambdaBreeder
- java.lang.Object
-
- ec.Breeder
-
- ec.es.MuCommaLambdaBreeder
-
- Direct Known Subclasses:
- MuPlusLambdaBreeder
public class MuCommaLambdaBreeder extends Breeder
MuCommaLambdaBreeder is a Breeder which, together with ESSelection, implements the (mu,lambda) breeding strategy and gathers the comparison data you can use to implement a 1/5-rule mutation mechanism.Evolution strategies breeders require a "mu" parameter and a "lambda" parameter for each subpopulation. "mu" refers to the number of parents from which the new population will be built. "lambda" refers to the number of children generated by the mu parents. Subpopulation sizes will change as necessary to accommodate this fact in later generations. The only rule for initial subpopulation sizes is that they must be greater than or equal to the mu parameter for that subpopulation.
You can now set your initial subpopulation size to whatever you like, totally independent of lambda and mu, as long as it is >= mu.
MuCommaLambdaBreeder stores mu and lambda values for each subpopulation in the population, as well as comparisons. A comparison tells you if >1/5, <1/5 or =1/5 of the new population was better than its parents (the so-called evolution strategies "one-fifth rule". Although the comparisons are gathered, no mutation objects are provided which actually use them -- you're free to use them in any mutation objects you care to devise which requires them.
To do evolution strategies evolution, the breeding pipelines should contain at least one ESSelection selection method. While a child is being generated by the pipeline, the ESSelection object will return a parent from the pool of mu parents. The particular parent is chosen round-robin, so all the parents will have an equal number of children. It's perfectly fine to have more than one ESSelection object in the tree, or to call the same one repeatedly during the course of generating a child; all such objects will consistently return the same parent. They only increment to the next parent in the pool of mu parents after the child has been created from the pipeline. You can also mix ESSelection operators with other operators (like Tournament Selection). But you ought to have at least one ESSelection operator in the pipeline -- else it wouldn't be Evolution Strategies, would it?
Parameters
es.lambda.subpop-num
int >= 0Specifies the 'lambda' parameter for the subpopulation. es.mu.subpop-num
int: a multiple of "lambda"Specifies the 'mu' parameter for the subpopulation. - See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static byteC_EXACTLY_ONE_FIFTH_BETTERstatic byteC_OVER_ONE_FIFTH_BETTERstatic byteC_UNDER_ONE_FIFTH_BETTERbyte[]comparisonint[]countModified by multiple threads, don't fool with thisint[]lambdaint[]mustatic java.lang.StringP_LAMBDAstatic java.lang.StringP_MUstatic java.lang.StringP_MU_FRACTIONPopulationparentPopulation
-
Constructor Summary
Constructors Constructor and Description MuCommaLambdaBreeder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description 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.PopulationbreedPopulation(EvolutionState state)Breeds state.population, returning a new population.intmaximumMuLambdaDivisor()lambda should be no SMALLER than mu times this value.PopulationpostProcess(Population newpop, Population oldpop, EvolutionState state)A hook for Mu+Lambda, not used in Mu,LambdaPopulationsetToLambda(Population pop, EvolutionState state)Sets all subpopulations in pop to the expected lambda size.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.
-
-
-
Field Detail
-
P_MU
public static final java.lang.String P_MU
- See Also:
- Constant Field Values
-
P_MU_FRACTION
public static final java.lang.String P_MU_FRACTION
- See Also:
- Constant Field Values
-
P_LAMBDA
public static final java.lang.String P_LAMBDA
- See Also:
- Constant Field Values
-
mu
public int[] mu
-
lambda
public int[] lambda
-
parentPopulation
public Population parentPopulation
-
comparison
public byte[] comparison
-
C_OVER_ONE_FIFTH_BETTER
public static final byte C_OVER_ONE_FIFTH_BETTER
- See Also:
- Constant Field Values
-
C_UNDER_ONE_FIFTH_BETTER
public static final byte C_UNDER_ONE_FIFTH_BETTER
- See Also:
- Constant Field Values
-
C_EXACTLY_ONE_FIFTH_BETTER
public static final byte C_EXACTLY_ONE_FIFTH_BETTER
- See Also:
- Constant Field Values
-
count
public int[] count
Modified by multiple threads, don't fool with this
-
-
Method Detail
-
maximumMuLambdaDivisor
public int maximumMuLambdaDivisor()
lambda should be no SMALLER than mu times this value. This varies between (mu,lambda) (where it's 2) and (mu + lambda) (where it's 1).
-
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.
-
setToLambda
public Population setToLambda(Population pop, EvolutionState state)
Sets all subpopulations in pop to the expected lambda size. Does not fill new slots with individuals.
-
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
-
postProcess
public Population postProcess(Population newpop, Population oldpop, EvolutionState state)
A hook for Mu+Lambda, not used in Mu,Lambda
-
breedPopChunk
public 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG