Class NSGA2Selection<T extends Comparable<T>>

java.lang.Object
net.bmahe.genetics4j.moo.nsga2.spec.NSGA2Selection<T>
Type Parameters:
T - Type of the fitness measurement
All Implemented Interfaces:
SelectionPolicy
Direct Known Subclasses:
ImmutableNSGA2Selection

@Immutable public abstract class NSGA2Selection<T extends Comparable<T>> extends Object implements SelectionPolicy
NSGA2 Selection specification

Select individuals based on their NSGA2 score, going from the most dominating ones to the lesser ones

  • Constructor Details

    • NSGA2Selection

      public NSGA2Selection()
  • Method Details

    • numberObjectives

      @Parameter public abstract int numberObjectives()
      Number of objectives
      Returns:
    • dominance

      @Default public Comparator<T> dominance()
      Override the dominance operator.

      If not specified, it assumes the default comparator conforms to the Pareto dominance relation

      Returns:
    • deduplicate

      @Default public Optional<Comparator<Genotype>> deduplicate()
      Comparator used for deduplication of solution prior to processing

      If not specified, it defaults to not do any deduplication

      Returns:
    • objectiveComparator

      @Parameter public abstract Function<Integer,Comparator<T>> objectiveComparator()
      Sort T based on the objective passed as a parameter
      Returns:
    • distance

      @Parameter public abstract ObjectiveDistance<T> distance()
      Define how to compute distances between fitness scores along their objectives
      Returns:
      Distance computation method
    • builder

      public static <U extends Comparable<U>> NSGA2Selection.Builder<U> builder()
    • ofFitnessVector

      public static <U extends Number & Comparable<U>> NSGA2Selection<FitnessVector<U>> ofFitnessVector(int numberObjectives, Comparator<Genotype> deduplicate)
      Factory method to instantiate a NSGA2Selection when fitness is defined as a FitnessVector of a Number
      Type Parameters:
      U - Type of the fitness measurement
      Parameters:
      numberObjectives - Number of objectives and dimensions of the FitnessVector
      deduplicate - Deduplicator comparator. Null value with disable deduplication
      Returns:
      A new instance of NSGA2Selection
    • ofFitnessVector

      public static <U extends Number & Comparable<U>> NSGA2Selection<FitnessVector<U>> ofFitnessVector(int numberObjectives)
      Factory method to instantiate a NSGA2Selection when fitness is defined as a FitnessVector of a Number
      Type Parameters:
      U - Type of the fitness measurement
      Parameters:
      numberObjectives - Number of objectives and dimensions of the FitnessVector
      Returns:
      A new instance of NSGA2Selection