Package io.jenetics.ext.moea
Class MOEA
- java.lang.Object
-
- io.jenetics.ext.moea.MOEA
-
public final class MOEA extends Object
Collectors for collecting final pareto-set for multi-objective optimization.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.ofVec()) .build(); final ISeq<Phenotype<DoubleGene, Vec<double[]>>> result = engine.stream() .limit(Limits.byFixedGeneration(50)) .collect(MOEA.toParetoSet());
- Since:
- 4.1
- Version:
- 5.1
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <G extends Gene<?,G>,T,V extends Vec<T>>
Collector<EvolutionResult<G,V>,?,ISeq<Phenotype<G,V>>>toParetoSet()
Collector ofPhenotype
objects, who's (multi-objective) fitness value is part of the pareto front.static <G extends Gene<?,G>,T,V extends Vec<T>>
Collector<EvolutionResult<G,V>,?,ISeq<Phenotype<G,V>>>toParetoSet(IntRange size)
Collector ofPhenotype
objects, who's (multi-objective) fitness value is part of the pareto front.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)
Collector ofPhenotype
objects, who's (multi-objective) fitness value is part of the pareto front.
-
-
-
Method Detail
-
toParetoSet
public static <G extends Gene<?,G>,T,V extends Vec<T>> Collector<EvolutionResult<G,V>,?,ISeq<Phenotype<G,V>>> toParetoSet()
Collector ofPhenotype
objects, who's (multi-objective) fitness value is part of the pareto front.- Type Parameters:
G
- the gene typeT
- the array type, e.g.double[]
V
- the multi object result type vector- Returns:
- the pareto set collector
- Throws:
IllegalArgumentException
- if the minimal pareto setsize
is smaller than one
-
toParetoSet
public static <G extends Gene<?,G>,T,V extends Vec<T>> Collector<EvolutionResult<G,V>,?,ISeq<Phenotype<G,V>>> toParetoSet(IntRange size)
Collector ofPhenotype
objects, who's (multi-objective) fitness value is part of the pareto front.- Type Parameters:
G
- the gene typeT
- the array type, e.g.double[]
V
- the multi object result type vector- Parameters:
size
- the allowed size range of the returned pareto set. If the size of the pareto set is bigger thansize.getMax()
, during the collection, it is reduced tosize.getMin()
. Pareto set elements which are close to each other are removed firsts.- Returns:
- the pareto set collector
- Throws:
NullPointerException
- if one thesize
isnull
IllegalArgumentException
- if the minimal pareto setsize
is smaller than one
-
toParetoSet
public 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)
Collector ofPhenotype
objects, who's (multi-objective) fitness value is part of the pareto front.- Type Parameters:
G
- the gene typeC
- the multi object result vector. E.g.Vec<double[]>
- Parameters:
size
- the allowed size range of the returned pareto set. If the size of the pareto set is bigger thansize.getMax()
, during the collection, it is reduced tosize.getMin()
. Pareto set elements which are close to each other are removed firsts.dominance
- the pareto dominance measure of the fitness result typeC
comparator
- the comparator of the elements of the vector typeC
distance
- the distance function of two elements of the vector typeC
dimension
- the dimensionality of the result vectorC
. UsuallyVec::length
.- Returns:
- the pareto set collector
- Throws:
NullPointerException
- if one the arguments isnull
IllegalArgumentException
- if the minimal pareto setsize
is smaller than one- See Also:
toParetoSet(IntRange)
-
-