Class MinMaxObjectiveComparator
java.lang.Object
org.moeaframework.algorithm.single.AbstractAggregateObjectiveComparator
org.moeaframework.algorithm.single.MinMaxObjectiveComparator
- All Implemented Interfaces:
Comparator<Solution>
,AggregateObjectiveComparator
,DominanceComparator
Weighted min-max aggregate function. By default, all weights are assumed to be equal.
- See Also:
-
Field Summary
Fields inherited from class org.moeaframework.algorithm.single.AbstractAggregateObjectiveComparator
weights
-
Constructor Summary
ConstructorDescriptionMinMaxObjectiveComparator
(double... weights) Constructs a new comparator using a weighted min-max aggregate function. -
Method Summary
Modifier and TypeMethodDescriptiondouble
calculateFitness
(Solution solution) Calculates the aggregate (fitness) value of the solution using this aggregate function.static final double
calculateFitness
(Solution solution, double[] weights) Computes the weighted min-max aggregate fitness of the solution.Methods inherited from class org.moeaframework.algorithm.single.AbstractAggregateObjectiveComparator
compare, getWeights
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
MinMaxObjectiveComparator
public MinMaxObjectiveComparator(double... weights) Constructs a new comparator using a weighted min-max aggregate function.- Parameters:
weights
- the weight vector
-
-
Method Details
-
calculateFitness
Description copied from interface:AggregateObjectiveComparator
Calculates the aggregate (fitness) value of the solution using this aggregate function.- Parameters:
solution
- the solution- Returns:
- the aggregate value (smaller is better)
-
calculateFitness
Computes the weighted min-max aggregate fitness of the solution. One weight should be given for each objective; if fewer weights are provided, the last weight is repeated for the remaining objectives.- Parameters:
solution
- the solutionweights
- the weight vector- Returns:
- the fitness, where smaller values are preferred
-