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
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <U extends Comparable<U>>
NSGA2Selection.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
Number of objectivesabstract Function
<Integer, Comparator<T>> Sort T based on the objective passed as a parameterstatic <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 Numberstatic <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
-
Constructor Details
-
NSGA2Selection
public NSGA2Selection()
-
-
Method Details
-
numberObjectives
@Parameter public abstract int numberObjectives()Number of objectives- Returns:
-
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
-
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 FitnessVectordeduplicate
- 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
-