Class OverallConstraintViolationDegreeComparator<S extends Solution<?>>

java.lang.Object
org.uma.jmetal.util.comparator.constraintcomparator.impl.OverallConstraintViolationDegreeComparator<S>
All Implemented Interfaces:
Comparator<S>, ConstraintComparator<S>

public class OverallConstraintViolationDegreeComparator<S extends Solution<?>> extends Object implements ConstraintComparator<S>
This class implements a Comparator (a method for comparing Solution objects) based on the overall constraint violation of the solutions, as done in NSGA-II.
Author:
Antonio J. Nebro invalid input: '<'antonio@lcc.uma.es>
  • Constructor Details

    • OverallConstraintViolationDegreeComparator

      public OverallConstraintViolationDegreeComparator()
  • Method Details

    • compare

      public int compare(S solution1, S solution2)
      Compares two solutions. If the solutions has no constraints the method return 0
      Specified by:
      compare in interface Comparator<S extends Solution<?>>
      Parameters:
      solution1 - Object representing the first Solution.
      solution2 - Object representing the second Solution.
      Returns:
      -1 if the overall constraint violation degree of solution1 is higher than the one of solution2, 1 in the opposite case, and 0 if they have the same value (this case applies when the two compared solutions have no constraints). Note that the violation degree is a negative number, so when comparing to two solutions, the higher the value the better.