Interface AggregateObjectiveComparator
- All Superinterfaces:
Comparator<Solution>
,DominanceComparator
- All Known Implementing Classes:
AbstractAggregateObjectiveComparator
,LinearDominanceComparator
,LinearObjectiveComparator
,MinMaxDominanceComparator
,MinMaxObjectiveComparator
,VectorAngleDistanceScalingComparator
Implementation Note: This interface extends both the DominanceComparator
and Comparator<Solution>
interfaces. Since both of these interfaces provide identical int compare(Solution, Solution)
methods, you
may encounter a compilation error indicating the use of the compare
method is ambiguous. This is the result
of an important distinction between DominanceComparator
and Comparator<Solution>
.
DominanceComparator
induces a partial ordering while Comparator<Solution>
provides a
total ordering. In general, the two can not be interchanged except in cases where the
DominanceComparator
produces a total ordering, which is the case here. However, you will need to cast to
one of these two interfaces in order to invoke the compare
method and avoid the compilation error.
-
Method Summary
Modifier and TypeMethodDescriptiondouble
calculateFitness
(Solution solution) Calculates the aggregate (fitness) value of the solution using this aggregate function.static AggregateObjectiveComparator
fromConfiguration
(TypedProperties properties) Creates an aggregate objective comparator from the given configuration.double[]
Returns the weights used by this aggregate function.static TypedProperties
toConfiguration
(AggregateObjectiveComparator comparator) Returns the configuration for the given aggregate objective comparator.Methods inherited from interface java.util.Comparator
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.moeaframework.core.comparator.DominanceComparator
compare
-
Method Details
-
getWeights
double[] getWeights()Returns the weights used by this aggregate function.- Returns:
- the weights
-
calculateFitness
Calculates the aggregate (fitness) value of the solution using this aggregate function.- Parameters:
solution
- the solution- Returns:
- the aggregate value (smaller is better)
-
fromConfiguration
Creates an aggregate objective comparator from the given configuration.- Parameters:
properties
- the configuration- Returns:
- the comparator, or
null
if one is not explicitly configured
-
toConfiguration
Returns the configuration for the given aggregate objective comparator.- Parameters:
comparator
- the comparator- Returns:
- the configuration
-