Class MinMaxObjectiveComparator

java.lang.Object
org.moeaframework.algorithm.single.AbstractAggregateObjectiveComparator
org.moeaframework.algorithm.single.MinMaxObjectiveComparator
All Implemented Interfaces:
Comparator<Solution>, AggregateObjectiveComparator, DominanceComparator

public class MinMaxObjectiveComparator extends AbstractAggregateObjectiveComparator
Weighted min-max aggregate function. By default, all weights are assumed to be equal.
See Also:
  • 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

      public double calculateFitness(Solution solution)
      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

      public static final double calculateFitness(Solution solution, double[] weights)
      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 solution
      weights - the weight vector
      Returns:
      the fitness, where smaller values are preferred