ec.es
Class ESEvolutionState
java.lang.Object
|
+--ec.EvolutionState
|
+--ec.simple.SimpleEvolutionState
|
+--ec.es.ESEvolutionState
- All Implemented Interfaces:
- java.io.Serializable, Setup, Singleton
- public class ESEvolutionState
- extends SimpleEvolutionState
ESEvolutionState is an EvolutionState which accepts the (mu,lambda)
and (mu+lambda) breeding strategies found in the ec.es.MuPlusLambdaBreeder
and ec.es.MuCommaLambdaBreeder breeders, to do evolution-strategies style
evolution.
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.
Earlier versions of ECJ specified that the initial subpopulation size
would be lambda. This is no longer the case, as it does not jibe with
the traditional (and IMHO, odd) ES approach of having the initial
subpopulation size be *mu*, of all things. You can now set your initial subpopulation
size to whatever you like, totally independent of lambda and mu, as long as it is
>= mu.
ESEvolutionState 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, you need to use an ESEvolutionState
object, either MuCommaLambdaBreeder or MuPlusLambdaBreeder, and the
breeding pipelines must contain exactly one ESSelection object called
each time an individual is generated. For example, if you're just
generating children by mutating a single selected individual into a child,
then you use the ESSelection object to pick that individual. If you're
generating two children at a time by selecting two parents and crossing
them over, then each parent should be selected with ESSelection (and
in this case, you had better have a population size that's an even number!)
If you're generating one child at a time by selecting two parents and
crossing them over, then throwing away one of the children and mutating
the other, then you should have only one parent chosen through
ESSelection; the other might be chosen with Tournament Selection, say.
Parameters
breed.lambda.subpop-num
int >= 0 | Specifies the 'lambda' parameter for the subpopulation. |
breed.mu.subpop-num
int: a multiple of "lambda" | Specifies the 'mu' parameter for the subpopulation. |
- See Also:
- Serialized Form
Fields inherited from class ec.EvolutionState |
aggressivegc, breeder, breedthreads, C_STARTED_FRESH, C_STARTED_FROM_CHECKPOINT, checkpoint, checkpointModulo, checkpointPrefix, evalthreads, evaluator, exchanger, finisher, gc, gcModulo, generation, initializer, numGenerations, output, P_AGGRESSIVEGC, P_BREEDER, P_CHECKPOINT, P_CHECKPOINTMODULO, P_CHECKPOINTPREFIX, P_EVALUATOR, P_EXCHANGER, P_FINISHER, P_GC, P_GCMODULO, P_GENERATIONS, P_INITIALIZER, P_QUITONRUNCOMPLETE, P_STATISTICS, parameters, population, quitOnRunComplete, R_FAILURE, R_SUCCESS, random, statics, statistics |
Method Summary |
void |
go()
Steps through a run for debugging purposes. |
void |
run(int condition)
Starts the run. |
void |
setup(EvolutionState state,
Parameter base)
Unlike for other setup() methods, ignore the base; it will always be null. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
P_MU
public static final java.lang.String P_MU
P_LAMBDA
public static final java.lang.String P_LAMBDA
mu
public int[] mu
lambda
public int[] lambda
comparison
public byte[] comparison
C_OVER_ONE_FIFTH_BETTER
public static final byte C_OVER_ONE_FIFTH_BETTER
C_UNDER_ONE_FIFTH_BETTER
public static final byte C_UNDER_ONE_FIFTH_BETTER
C_EXACTLY_ONE_FIFTH_BETTER
public static final byte C_EXACTLY_ONE_FIFTH_BETTER
count
public int[] count
- Modified by multiple threads, don't fool with this
ESEvolutionState
public ESEvolutionState()
setup
public void setup(EvolutionState state,
Parameter base)
- Description copied from class:
EvolutionState
- Unlike for other setup() methods, ignore the base; it will always be null.
- Overrides:
setup
in class EvolutionState
- Following copied from class:
ec.EvolutionState
- See Also:
Prototype.setup(EvolutionState,Parameter)
run
public void run(int condition)
throws java.io.IOException
- Description copied from class:
EvolutionState
- Starts the run. condition indicates whether or not the
run was restarted from a checkpoint (C_STARTED_FRESH vs
C_STARTED_FROM_CHECKPOINT). At the point that run(...) has been
called, the parameter database has already been set up, as have
the random number generators, the number of threads, and the
Output facility. This method should call this.setup(...) to
set up the EvolutionState object if condition equals C_STARTED_FRESH.
- Overrides:
run
in class SimpleEvolutionState
go
public void go()
- Description copied from class:
EvolutionState
- Steps through a run for debugging purposes.
A debug-run is done by repeatedly pulsing the go() method. The
default form prints a message saying that nothing happens.
- Overrides:
go
in class SimpleEvolutionState