|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ec.EvolutionState
An EvolutionState object is a singleton object which holds the entire state of an evolutionary run. By serializing EvolutionState, the entire run can be checkpointed out to a file.
The EvolutionState instance is passed around in a lot of methods, so objects can read from the parameter database, pick random numbers, and write to the output facility.
EvolutionState is a unique object in that it calls its own setup(...) method, from run(...).
An EvolutionState object contains quite a few objects, including:
Parameters
generations int >= 1 |
(maximal number of generations to run.) |
checkpoint-modulo int >= 1 |
(how many generations should pass before we do a checkpoint? The definition of "generations" depends on the particular EvolutionState implementation you're using) |
checkpoint bool = true or false (default) |
(should we checkpoint?) |
prefix String |
(the prefix to prepend to checkpoint files -- see ec.util.Checkpoint) |
gc bool = true or false (default) |
(should we force GC?) |
gc-modulo int >= 1 |
(how many generations should pass before we do garbage collection? The definition of "generations" depends on the particular EvolutionState implementation you're using) |
aggressive bool = true or false (default) |
(if we force GC (see gc), should it be aggressive?) |
quit-on-run-complete bool = true or false (default) |
(do we prematurely quit the run when we find a perfect individual?) |
init classname, inherits and != ec.Initializer |
(the class for initializer) |
finish classname, inherits and != ec.Finisher |
(the class for finisher) |
breed classname, inherits and != ec.Breeder |
(the class for breeder) |
eval classname, inherits and != ec.Evaluator |
(the class for evaluator) |
stat classname, inherits and != ec.Statistics |
(the class for statistics) |
exch classname, inherits and != ec.Exchanger |
(the class for exchanger) |
Parameter bases
init | initializer |
finish | finisher |
breed | breeder |
eval | evaluator |
stat | statistics |
exch | exchanger |
Field Summary | |
boolean |
aggressivegc
Whether or not the system should be doing aggressive forced garbage collection after each generation. |
Breeder |
breeder
The population breeder, a singleton object. |
int |
breedthreads
The requested number of threads to be used in breeding, excepting perhaps a "parent" thread which gathers the other threads. |
static int |
C_STARTED_FRESH
"The population has started fresh (not from a checkpoint)." |
static int |
C_STARTED_FROM_CHECKPOINT
"The population started from a checkpoint." |
boolean |
checkpoint
Should we checkpoint at all? |
int |
checkpointModulo
The requested number of generations that should pass before we write out a checkpoint file. |
java.lang.String |
checkpointPrefix
The requested prefix start filenames, not including a following period. |
int |
evalthreads
The requested number of threads to be used in evaluation, excepting perhaps a "parent" thread which gathers the other threads. |
Evaluator |
evaluator
The population evaluator, a singleton object. |
Exchanger |
exchanger
The population exchanger, a singleton object. |
Finisher |
finisher
The population finisher, a singleton object. |
boolean |
gc
Whether or not the system should be doing forced garbage collection after each generation. |
int |
gcModulo
The requested number of generations that should pass before we force a garbage collection. |
int |
generation
The current generation of the population in the run. |
Initializer |
initializer
The population initializer, a singleton object. |
int |
numGenerations
The number of generations the evolutionary computation system will run until it ends. |
Output |
output
The output and logging facility (threadsafe). |
static java.lang.String |
P_AGGRESSIVEGC
|
static java.lang.String |
P_BREEDER
|
static java.lang.String |
P_CHECKPOINT
|
static java.lang.String |
P_CHECKPOINTMODULO
|
static java.lang.String |
P_CHECKPOINTPREFIX
|
static java.lang.String |
P_EVALUATOR
|
static java.lang.String |
P_EXCHANGER
|
static java.lang.String |
P_FINISHER
|
static java.lang.String |
P_GC
|
static java.lang.String |
P_GCMODULO
|
static java.lang.String |
P_GENERATIONS
|
static java.lang.String |
P_INITIALIZER
|
static java.lang.String |
P_QUITONRUNCOMPLETE
|
static java.lang.String |
P_STATISTICS
|
ParameterDatabase |
parameters
The parameter database (threadsafe). |
Population |
population
The current population. |
boolean |
quitOnRunComplete
Whether or not the system should prematurely quit when Evaluator returns true for runComplete(...) (that is, when the system found an ideal individual. |
static int |
R_FAILURE
"The evolution run has quit, failing to find a perfect individual." |
static int |
R_SUCCESS
"The evolution run has quit, finding a perfect individual." |
MersenneTwisterFast[] |
random
An array of random number generators, indexed by the thread number you were given (or, if you're not in a multithreaded area, use 0). |
java.util.Vector |
statics
A place for you to stash pointers to static objects so that they'll get serialized. |
Statistics |
statistics
The population statistics, a singleton object. |
Constructor Summary | |
EvolutionState()
This will be called to create your evolution state; immediately after the constructor is called, the parameters, random, and output fields will be set for you. |
Method Summary | |
void |
aggressiveGC()
Performs aggressive garbage collection. |
void |
gc()
Performs nonagressive garbage collection. |
void |
go()
Steps through a run for debugging purposes. |
void |
go(int n)
Steps through a run n times for debugging purposes. |
void |
resetFromCheckpoint()
This method is called after a checkpoint is restored from but before the run starts up again. |
abstract 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 |
Field Detail |
public java.util.Vector statics
public ParameterDatabase parameters
public MersenneTwisterFast[] random
public Output output
public int breedthreads
public int evalthreads
public boolean checkpoint
public java.lang.String checkpointPrefix
public int checkpointModulo
public boolean gc
public int gcModulo
public boolean aggressivegc
public boolean quitOnRunComplete
public int generation
public int numGenerations
public Population population
public Initializer initializer
public Finisher finisher
public Breeder breeder
public Evaluator evaluator
public Statistics statistics
public Exchanger exchanger
public static final int C_STARTED_FRESH
public static final int C_STARTED_FROM_CHECKPOINT
public static final int R_SUCCESS
public static final int R_FAILURE
public static final java.lang.String P_INITIALIZER
public static final java.lang.String P_FINISHER
public static final java.lang.String P_BREEDER
public static final java.lang.String P_EVALUATOR
public static final java.lang.String P_STATISTICS
public static final java.lang.String P_EXCHANGER
public static final java.lang.String P_GENERATIONS
public static final java.lang.String P_GC
public static final java.lang.String P_AGGRESSIVEGC
public static final java.lang.String P_QUITONRUNCOMPLETE
public static final java.lang.String P_CHECKPOINTPREFIX
public static final java.lang.String P_CHECKPOINTMODULO
public static final java.lang.String P_GCMODULO
public static final java.lang.String P_CHECKPOINT
Constructor Detail |
public EvolutionState()
Method Detail |
public void setup(EvolutionState state, Parameter base)
setup
in interface Setup
Prototype.setup(EvolutionState,Parameter)
public abstract void run(int condition) throws java.io.IOException
public void go(int n)
public void go()
public final void gc()
public final void aggressiveGC()
public void resetFromCheckpoint() throws java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |