Class LinearObjectiveComparator
java.lang.Object
org.moeaframework.core.comparator.AbstractAggregateObjectiveComparator
org.moeaframework.core.comparator.LinearObjectiveComparator
- All Implemented Interfaces:
Comparator<Solution>,AggregateObjectiveComparator,DominanceComparator
The weighted linear aggregate function. By default, this method assumes equal weights for all objectives.
-
Field Summary
Fields inherited from class org.moeaframework.core.comparator.AbstractAggregateObjectiveComparator
weights -
Constructor Summary
ConstructorsConstructorDescriptionLinearObjectiveComparator(double... weights) Constructs a new comparator using a weighted linear aggregate function. -
Method Summary
Methods inherited from class org.moeaframework.core.comparator.AbstractAggregateObjectiveComparator
compare, getWeightsMethods 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
-
LinearObjectiveComparator
public LinearObjectiveComparator(double... weights) Constructs a new comparator using a weighted linear aggregate function.- Parameters:
weights- the weight vector
-
-
Method Details
-
calculate
Description copied from interface:AggregateObjectiveComparatorCalculates the aggregate value of the solution using this aggregate function.- Parameters:
solution- the solution- Returns:
- the aggregate value (smaller is better)
-
calculate
Computes the weighted linear aggregate vaalue 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
-