public final class MOEA extends Object
final Problem<double[], DoubleGene, Vec<double[]>> problem = Problem.of(
v -> Vec.of(v[0]*cos(v[1]), v[0]*sin(v[1])),
Codecs.ofVector(
DoubleRange.of(0, 1),
DoubleRange.of(0, 2*PI)
)
);
final Engine<DoubleGene, Vec<double[]>> engine = Engine.builder(problem)
.alterers(
new Mutator<>(0.1),
new MeanAlterer<>())
.offspringSelector(new TournamentSelector<>(2))
.survivorsSelector(UFTournamentSelector.vec())
.build();
final ISeq<Phenotype<DoubleGene, Vec<double[]>>> result = engine.stream()
.limit(Limits.byFixedGeneration(50))
.collect(MOEA.toParetoSet());| Modifier and Type | Method and Description |
|---|---|
static <G extends Gene<?,G>,T,V extends Vec<T>> |
toParetoSet()
Collector of
Phenotype objects, who's (multi-objective) fitness
value is part of the
pareto front. |
static <G extends Gene<?,G>,T,V extends Vec<T>> |
toParetoSet(IntRange size)
Collector of
Phenotype objects, who's (multi-objective) fitness
value is part of the
pareto front. |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
toParetoSet(IntRange size,
Comparator<? super C> dominance,
ElementComparator<? super C> comparator,
ElementDistance<? super C> distance,
ToIntFunction<? super C> dimension)
Collector of
Phenotype objects, who's (multi-objective) fitness
value is part of the
pareto front. |
public static <G extends Gene<?,G>,T,V extends Vec<T>> Collector<EvolutionResult<G,V>,?,ISeq<Phenotype<G,V>>> toParetoSet()
Phenotype objects, who's (multi-objective) fitness
value is part of the
pareto front.G - the gene typeT - the array type, e.g. double[]V - the multi object result type vectorIllegalArgumentException - if the minimal pareto set size
is smaller than onepublic static <G extends Gene<?,G>,T,V extends Vec<T>> Collector<EvolutionResult<G,V>,?,ISeq<Phenotype<G,V>>> toParetoSet(IntRange size)
Phenotype objects, who's (multi-objective) fitness
value is part of the
pareto front.G - the gene typeT - the array type, e.g. double[]V - the multi object result type vectorsize - the allowed size range of the returned pareto set. If the
size of the pareto set is bigger than size.getMax(),
during the collection, it is reduced to size.getMin().
Pareto set elements which are close to each other are removed firsts.NullPointerException - if one the size is nullIllegalArgumentException - if the minimal pareto set size
is smaller than onepublic static <G extends Gene<?,G>,C extends Comparable<? super C>> Collector<EvolutionResult<G,C>,?,ISeq<Phenotype<G,C>>> toParetoSet(IntRange size, Comparator<? super C> dominance, ElementComparator<? super C> comparator, ElementDistance<? super C> distance, ToIntFunction<? super C> dimension)
Phenotype objects, who's (multi-objective) fitness
value is part of the
pareto front.G - the gene typeC - the multi object result vector. E.g. Vec<double[]>size - the allowed size range of the returned pareto set. If the
size of the pareto set is bigger than size.getMax(),
during the collection, it is reduced to size.getMin().
Pareto set elements which are close to each other are removed firsts.dominance - the pareto dominance measure of the fitness result type
Ccomparator - the comparator of the elements of the vector type
Cdistance - the distance function of two elements of the vector
type Cdimension - the dimensionality of the result vector C.
Usually Vec::length.NullPointerException - if one the arguments is nullIllegalArgumentException - if the minimal pareto set size
is smaller than onetoParetoSet(IntRange)© 2007-2018 Franz Wilhelmstötter (2018-10-28 17:23)