G
- the gene typeC
- the fitness result type@FunctionalInterface public interface Evaluator<G extends Gene<?,G>,C extends Comparable<? super C>>
The implementer is free to do the evaluation in place, or create
new Phenotype
instance and return the newly created one. A simple
serial evaluator can easily implemented:
final Function<? super Genotype<G>, ? extends C> fitness = ...;
final Evaluator<G, C> evaluator = population -> population
.map(pt -> pt.eval(fitness))
.asISeq();
final Engine<G, C> engine = new Engine.Builder(evaluator, genotypeFactory)
.build();
Evaluators
,
Engine
assert population.forAll(Phenotype::isEvaluated);
).
It is allowed to return the input sequence, after evaluation, as well a newly
created one.ISeq<Phenotype<G,C>> eval(Seq<Phenotype<G,C>> population)
population
. The
given population
might contain already evaluated individuals.
It is the responsibility of the implementer to filter out already
evaluated individuals, if desired.population
- the population to evaluate© 2007-2020 Franz Wilhelmstötter (2020-02-18 20:01)