G - the gene typeC - the fitness function result type@FunctionalInterface public interface Alterer<G extends Gene<?,G>,C extends Comparable<? super C>>
Engine.Builder.alterers(Alterer, Alterer[]) method.
final Engine<DoubleGene, Double> engine = Engine
.builder(gtf, ff)
.alterers(
new Crossover<>(0.1),
new Mutator<>(0.05),
new MeanAlterer<>(0.2))
.build();
final EvolutionStream<DoubleGene, Double> stream = engine.stream();| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_ALTER_PROBABILITY
The default alter probability: 0.2
|
| Modifier and Type | Method and Description |
|---|---|
int |
alter(Population<G,C> population,
long generation)
Alters (recombine) a given population.
|
default Alterer<G,C> |
andThen(Alterer<G,C> after)
Returns a composed alterer that applies the
this alterer
to its input, and then applies the after alterer to the result. |
default Alterer<G,C> |
compose(Alterer<G,C> before)
Returns a composed alterer that first applies the
before alterer
to its input, and then applies this alterer to the result. |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
of(Alterer<G,C>... alterers)
Combine the given alterers.
|
static final double DEFAULT_ALTER_PROBABILITY
int alter(Population<G,C> population, long generation)
population is empty,
nothing is altered. The altering of the population is done in place; the
given population is altered.population - The Population to be altered. If the
population is null or empty, nothing is altered.generation - the date of birth (generation) of the altered phenotypes.NullPointerException - if the given population is
null.default Alterer<G,C> compose(Alterer<G,C> before)
before alterer
to its input, and then applies this alterer to the result.before - the alterer to apply firstdefault Alterer<G,C> andThen(Alterer<G,C> after)
this alterer
to its input, and then applies the after alterer to the result.after - the alterer to apply first@SafeVarargs static <G extends Gene<?,G>,C extends Comparable<? super C>> Alterer<G,C> of(Alterer<G,C>... alterers)
G - the gene typeC - the fitness function result typealterers - the alterers to combine.NullPointerException - if one of the alterers is null.© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)