Class TournamentNSGA2Selection<T extends Comparable<T>>

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

@Immutable public abstract class TournamentNSGA2Selection<T extends Comparable<T>> extends Object implements SelectionPolicy
Tournament based NSGA2 selection

This method of selection follows the method describe in the NSGA2 paper where the individuals are sorted according to NSGA2 and then selected through tournaments where they are compared based on their NSGA2 metric

  • Constructor Details

    • TournamentNSGA2Selection

      public TournamentNSGA2Selection()
  • Method Details

    • numberObjectives

      @Parameter public abstract int numberObjectives()
      Describe how many objectives are embedded in T
      Returns:
      Number of objectives embedded in T
    • 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
    • numCandidates

      @Parameter public abstract int numCandidates()
      Number of candidates in each tournament
      Returns:
      Number of candidates in each tournament
    • builder

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

      public static <U extends Number & Comparable<U>> TournamentNSGA2Selection<FitnessVector<U>> ofFitnessVector(int numberObjectives, int numberCandidates, Comparator<Genotype> deduplicate)
      Factory method to instantiate a Tournament based NSGA2 selection 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
      numberCandidates - Number of candidates in each tournament
      deduplicate - Deduplicator comparator. Null value with disable deduplication
      Returns:
      A new instance of TournamentNSGA2Selection
    • ofFitnessVector

      public static <U extends Number & Comparable<U>> TournamentNSGA2Selection<FitnessVector<U>> ofFitnessVector(int numberObjectives, int numberCandidates)
      Factory method to instantiate a Tournament based NSGA2 selection 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
      numberCandidates - Number of candidates in each tournament
      Returns:
      A new instance of TournamentNSGA2Selection