G- the gene type
C- 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
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();
assert population.forAll(Phenotype::isEvaluated);). It is allowed to return the input sequence, after evaluation, as well a newly created one.
population. The given
populationmight 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-2019 Franz Wilhelmstötter (2019-11-18 20:30)