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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
TournamentNSGA2Selection.Builder<T extends Comparable<T>>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <U extends Comparable<U>>
TournamentNSGA2Selection.Builder<U> builder()
Comparator used for deduplication of solution prior to processingabstract ObjectiveDistance
<T> distance()
Define how to compute distances between fitness scores along their objectivesOverride the dominance operator.abstract int
Describe how many objectives are embedded in Tabstract int
Number of candidates in each tournamentabstract Function
<Integer, Comparator<T>> Sort T based on the objective passed as a parameterstatic <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 Numberstatic <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
-
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
Override the dominance operator.If not specified, it assumes the default comparator conforms to the Pareto dominance relation
- Returns:
-
deduplicate
Comparator used for deduplication of solution prior to processingIf not specified, it defaults to not do any deduplication
- Returns:
-
objectiveComparator
Sort T based on the objective passed as a parameter- Returns:
-
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
-
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 FitnessVectornumberCandidates
- Number of candidates in each tournamentdeduplicate
- 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 FitnessVectornumberCandidates
- Number of candidates in each tournament- Returns:
- A new instance of TournamentNSGA2Selection
-