Class LinearDominanceComparator
java.lang.Object
org.moeaframework.core.comparator.ChainedComparator
org.moeaframework.algorithm.single.LinearDominanceComparator
- All Implemented Interfaces:
Comparator<Solution>
,AggregateObjectiveComparator
,DominanceComparator
public class LinearDominanceComparator
extends ChainedComparator
implements AggregateObjectiveComparator
Version of the weighted linear aggregate function that supports constraints.
-
Field Summary
Fields inherited from class org.moeaframework.core.comparator.ChainedComparator
comparators
-
Constructor Summary
ConstructorDescriptionLinearDominanceComparator
(double... weights) Constructs a new dominance comparator using a weighted linear aggregate function and constraints. -
Method Summary
Modifier and TypeMethodDescriptiondouble
calculateFitness
(Solution solution) Calculates the aggregate (fitness) value of the solution using this aggregate function.double[]
Returns the weights used by this aggregate function.Methods inherited from class org.moeaframework.core.comparator.ChainedComparator
compare
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
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.moeaframework.core.comparator.DominanceComparator
compare
-
Constructor Details
-
LinearDominanceComparator
public LinearDominanceComparator(double... weights) Constructs a new dominance comparator using a weighted linear aggregate function and constraints. One weight should be given for each objective; if fewer weights are provided, the last weight is repeated for the remaining objectives. Defaults to weights of1.0
if none are provided.- Parameters:
weights
- the weight vector
-
-
Method Details
-
getWeights
public double[] getWeights()Description copied from interface:AggregateObjectiveComparator
Returns the weights used by this aggregate function.- Specified by:
getWeights
in interfaceAggregateObjectiveComparator
- Returns:
- the weights
-
calculateFitness
Description copied from interface:AggregateObjectiveComparator
Calculates the aggregate (fitness) value of the solution using this aggregate function.- Specified by:
calculateFitness
in interfaceAggregateObjectiveComparator
- Parameters:
solution
- the solution- Returns:
- the aggregate value (smaller is better)
-