G
- the gene typeC
- the fitness result type@FunctionalInterface public static interface Engine.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 Evaluator<G, C> evaluator = population -> {
population.forEach(Phenotype::evaluate);
return population.asISeq();
};
Engine.GenotypeEvaluator
,
Engine.Builder.evaluator(Engine.Evaluator)
Engine
configuration
feature, which should be only used when there is a performance gain from
implementing a different evaluation strategy. Another use case is, when
the fitness value of an individual also depends on the current composition
of the population.Modifier and Type | Method and Description |
---|---|
ISeq<Phenotype<G,C>> |
evaluate(Seq<Phenotype<G,C>> population)
Evaluates the fitness values of the given
population . |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
of(Engine.GenotypeEvaluator<G,C> evaluator)
Create a new phenotype evaluator from a given genotype
evaluator . |
ISeq<Phenotype<G,C>> evaluate(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 evaluatestatic <G extends Gene<?,G>,C extends Comparable<? super C>> Engine.Evaluator<G,C> of(Engine.GenotypeEvaluator<G,C> evaluator)
evaluator
.G
- the gene typeC
- the fitness result typeevaluator
- the genotype evaluatorNullPointerException
- if the given evaluator
is
null
Engine.Evaluator
will only forward un-evaluated
individuals to the given genotype evaluator
. This means, that
already evaluated individuals are filtered from the population, which
is then forwarded to the underlying genotype evaluator
.© 2007-2018 Franz Wilhelmstötter (2018-05-31 12:39)