|
Watchmaker Framework for Evolutionary Computation API (Version 0.7.1) |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.uncommons.watchmaker.framework.islands.IslandEvolution<T>
T
- The type of entity that is to be evolved.public class IslandEvolution<T>
An implementation of island evolution in which multiple independent populations are evolved in parallel with periodic migration of individuals between islands.
Constructor Summary | |
---|---|
IslandEvolution(int islandCount,
Migration migration,
CandidateFactory<T> candidateFactory,
EvolutionaryOperator<T> evolutionScheme,
FitnessEvaluator<? super T> fitnessEvaluator,
SelectionStrategy<? super T> selectionStrategy,
Random rng)
Create an island system with the specified number of identically-configured islands. |
|
IslandEvolution(List<EvolutionEngine<T>> islands,
Migration migration,
boolean naturalFitness,
Random rng)
Create an island evolution system from a list of pre-configured islands. |
Method Summary | |
---|---|
void |
addEvolutionObserver(IslandEvolutionObserver<? super T> observer)
Adds an observer to the evolution. |
T |
evolve(int populationSize,
int eliteCount,
int epochLength,
int migrantCount,
TerminationCondition... conditions)
Start the evolutionary process on each island and return the fittest candidate so far at the point any of the termination conditions is satisfied. |
List<TerminationCondition> |
getSatisfiedTerminationConditions()
Returns a list of all TerminationCondition s that are satisfied by the current
state of the island evolution. |
void |
removeEvolutionObserver(IslandEvolutionObserver<? super T> observer)
Remove the specified observer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IslandEvolution(int islandCount, Migration migration, CandidateFactory<T> candidateFactory, EvolutionaryOperator<T> evolutionScheme, FitnessEvaluator<? super T> fitnessEvaluator, SelectionStrategy<? super T> selectionStrategy, Random rng)
IslandEvolution(List, Migration, boolean, Random)
constructor, which accepts
a list of pre-created islands (each is an instance of EvolutionEngine
).
islandCount
- The number of separate islands that will be part of the system.migration
- A migration strategy for moving individuals between islands at the
end of an epoch.candidateFactory
- Generates the initial population for each island.evolutionScheme
- The evolutionary operator, or combination of evolutionary operators,
used on each island.fitnessEvaluator
- The fitness function used on each island.selectionStrategy
- The selection strategy used on each island.rng
- A source of randomness, used by all islands.IslandEvolution(List, Migration, boolean, Random)
public IslandEvolution(List<EvolutionEngine<T>> islands, Migration migration, boolean naturalFitness, Random rng)
islands
- A list of pre-configured islands.migration
- A migration strategy for moving individuals between islands at the
end of an epoch.naturalFitness
- If true, indicates that higher fitness values mean fitter
individuals. If false, indicates that fitter individuals will have lower scores.rng
- A source of randomness, used by all islands.IslandEvolution(int, Migration, CandidateFactory, EvolutionaryOperator, FitnessEvaluator,
SelectionStrategy, Random)
Method Detail |
---|
public T evolve(int populationSize, int eliteCount, int epochLength, int migrantCount, TerminationCondition... conditions)
Start the evolutionary process on each island and return the fittest candidate so far at the point any of the termination conditions is satisfied.
If you interrupt the request thread before this method returns, the
method will return prematurely (with the best individual found so far).
After returning in this way, the current thread's interrupted flag
will be set. It is preferable to use an appropritate
TerminationCondition
rather than interrupting the evolution in
this way.
populationSize
- The population size for each island. Therefore, if you have 5 islands,
setting this parameter to 200 will result in 1000 individuals overall, 200 on each island.eliteCount
- The number of candidates preserved via elitism on each island. In elitism,
a sub-set of the population with the best fitness scores are preserved unchanged in
the subsequent generation. Candidate solutions that are preserved unchanged through
elitism remain eligible for selection for breeding the remainder of the next generation.
This value must be non-negative and less than the population size. A value of zero
means that no elitism will be applied.epochLength
- The number of generations that make up an epoch. Islands evolve independently for
this number of generations and then migration occurs at the end of the epoch and the next epoch starts.migrantCount
- The number of individuals that will be migrated from each island at the end of each
epoch.conditions
- One or more conditions that may cause the evolution to terminate.
public List<TerminationCondition> getSatisfiedTerminationConditions()
Returns a list of all TerminationCondition
s that are satisfied by the current
state of the island evolution. Usually this list will contain only one item, but it
is possible that mutliple termination conditions will become satisfied at the same
time. In this case the condition objects in the list will be in the same order that
they were specified when passed to the engine.
If the evolution has not yet terminated (either because it is still in progress or because it hasn't even been started) then an IllegalStateException will be thrown.
If the evolution terminated because the request thread was interrupted before any termination conditions were satisfied then this method will return an empty list.
IllegalStateException
- If this method is invoked on an island system before
evolution is started or while it is still in progress.public void addEvolutionObserver(IslandEvolutionObserver<? super T> observer)
Adds an observer to the evolution. Observers will receives two types of updates: updates from each individual island at the end of each generation, and updates for the combined global population at the end of each epoch.
Updates are dispatched synchronously on the request thread. Observers should complete their processing and return in a timely manner to avoid holding up the evolution.
observer
- The callback that will be notified at the end of each generation and epoch.removeEvolutionObserver(IslandEvolutionObserver)
public void removeEvolutionObserver(IslandEvolutionObserver<? super T> observer)
observer
- The observer to remove (if it is registered).addEvolutionObserver(IslandEvolutionObserver)
|
Watchmaker Framework for Evolutionary Computation API (Version 0.7.1) |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |