public static final class Engine.Builder<G extends Gene<?,G>,C extends Comparable<? super C>> extends Object
Engine
instances.Engine
Modifier and Type | Method and Description |
---|---|
Engine.Builder<G,C> |
alterers(Alterer<G,C> first,
Alterer<G,C>... rest)
The alterers used for alter the offspring population.
|
Engine<G,C> |
build()
Builds an new
Engine instance from the set properties. |
Engine.Builder<G,C> |
clock(Clock clock)
The clock used for calculating the execution durations.
|
Engine.Builder<G,C> |
executor(Executor executor)
The executor used by the engine.
|
Engine.Builder<G,C> |
fitnessFunction(Function<? super Genotype<G>,? extends C> function)
Set the fitness function of the evolution
Engine . |
Engine.Builder<G,C> |
fitnessScaler(Function<? super C,? extends C> scaler)
Set the fitness scaler of the evolution
Engine . |
Engine.Builder<G,C> |
genotypeFactory(Factory<Genotype<G>> genotypeFactory)
The genotype factory used for creating new individuals.
|
Engine.Builder<G,C> |
maximalPhenotypeAge(long age)
The maximal allowed age of a phenotype.
|
Engine.Builder<G,C> |
offspringFraction(double fraction)
The offspring fraction.
|
Engine.Builder<G,C> |
offspringSelector(Selector<G,C> selector)
The selector used for selecting the offspring population.
|
Engine.Builder<G,C> |
optimize(Optimize optimize)
The optimization strategy used by the engine.
|
Engine.Builder<G,C> |
populationSize(int size)
The number of individuals which form the population.
|
Engine.Builder<G,C> |
selector(Selector<G,C> selector)
The selector used for selecting the survivors and offspring
population.
|
Engine.Builder<G,C> |
survivorsSelector(Selector<G,C> selector)
The selector used for selecting the survivors population.
|
public Engine.Builder<G,C> fitnessFunction(Function<? super Genotype<G>,? extends C> function)
Engine
.function
- the fitness function to use in the GA Engine
this
builder, for command chainingpublic Engine.Builder<G,C> fitnessScaler(Function<? super C,? extends C> scaler)
Engine
. Default
value is set to the identity function.scaler
- the fitness scale to use in the GA Engine
this
builder, for command chainingpublic Engine.Builder<G,C> genotypeFactory(Factory<Genotype<G>> genotypeFactory)
genotypeFactory
- the genotype factory for creating new
individuals.this
builder, for command chainingpublic Engine.Builder<G,C> offspringSelector(Selector<G,C> selector)
TournamentSelector<>(3)
.selector
- used for selecting the offspring populationthis
builder, for command chainingpublic Engine.Builder<G,C> survivorsSelector(Selector<G,C> selector)
TournamentSelector<>(3)
.selector
- used for selecting survivors populationthis
builder, for command chainingpublic Engine.Builder<G,C> selector(Selector<G,C> selector)
TournamentSelector<>(3)
.selector
- used for selecting survivors and offspring populationthis
builder, for command chaining@SafeVarargs public final Engine.Builder<G,C> alterers(Alterer<G,C> first, Alterer<G,C>... rest)
new SinglePointCrossover<>(0.2)
followed by
new Mutator<>(0.15)
.first
- the first alterer used for alter the offspring
populationrest
- the rest of the alterers used for alter the offspring
populationthis
builder, for command chainingNullPointerException
- if one of the alterers is
null
.public Engine.Builder<G,C> optimize(Optimize optimize)
Optimize.MAXIMUM
.optimize
- the optimization strategy used by the enginethis
builder, for command chainingpublic Engine.Builder<G,C> offspringFraction(double fraction)
0.6
.fraction
- the offspring fractionthis
builder, for command chainingIllegalArgumentException
- if the fraction is not
within the range [0, 1].public Engine.Builder<G,C> populationSize(int size)
50
.size
- the number of individuals of a populationthis
builder, for command chainingIllegalArgumentException
- if size < 1
public Engine.Builder<G,C> maximalPhenotypeAge(long age)
70
.age
- the maximal phenotype agethis
builder, for command chainingIllegalArgumentException
- if age < 1
public Engine.Builder<G,C> executor(Executor executor)
executor
- the executor used by the enginethis
builder, for command chainingpublic Engine.Builder<G,C> clock(Clock clock)
clock
- the clock used for calculating the execution durationsthis
builder, for command chaining© 2007-2014 Franz Wilhelmstötter (2014-12-28 10:45)