Class FitnessComparator
java.lang.Object
org.moeaframework.core.comparator.FitnessComparator
- All Implemented Interfaces:
Comparator<Solution>,DominanceComparator
Compares two solutions based on their fitness value.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFitnessComparator(boolean largerValuesPreferred) Constructs a dominance comparator for comparing solutions based on their fitness value. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
FitnessComparator
public FitnessComparator(boolean largerValuesPreferred) Constructs a dominance comparator for comparing solutions based on their fitness value.- Parameters:
largerValuesPreferred-trueif larger fitness values are preferred; otherwise smaller fitness values are preferred
-
-
Method Details
-
compare
Description copied from interface:DominanceComparatorCompares the two solutions using a dominance relation, returning-1ifsolution1dominatessolution2,1ifsolution2dominatessolution1, and0if the solutions are non-dominated.- Specified by:
comparein interfaceComparator<Solution>- Specified by:
comparein interfaceDominanceComparator- Parameters:
solution1- the first solutionsolution2- the second solution- Returns:
-1ifsolution1dominatessolution2,1ifsolution2dominatessolution1, and0if the solutions are non-dominated
-