Class 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 Detail

      • toParetoSet

        public static <G extends Gene<?,​G>,​T,​V extends Vec<T>> Collector<EvolutionResult<G,​V>,​?,​ISeq<Phenotype<G,​V>>> toParetoSet​(IntRange size)
        Collector of Phenotype objects, who's (multi-objective) fitness value is part of the pareto front.
        Type Parameters:
        G - the gene type
        T - 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 than size.getMax(), during the collection, it is reduced to size.getMin(). Pareto set elements which are close to each other are removed firsts.
        Returns:
        the pareto set collector
        Throws:
        NullPointerException - if one the size is null
        IllegalArgumentException - if the minimal pareto set size 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 of Phenotype objects, who's (multi-objective) fitness value is part of the pareto front.
        Type Parameters:
        G - the gene type
        C - 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 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 C
        comparator - the comparator of the elements of the vector type C
        distance - the distance function of two elements of the vector type C
        dimension - the dimensionality of the result vector C. Usually Vec::length.
        Returns:
        the pareto set collector
        Throws:
        NullPointerException - if one the arguments is null
        IllegalArgumentException - if the minimal pareto set size is smaller than one
        See Also:
        toParetoSet(IntRange)