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
-
Constructor Summary
Constructors -
Method Summary
Methods 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
-
OverallConstraintViolationDegreeComparator
public OverallConstraintViolationDegreeComparator()
-
-
Method Details
-
compare
Compares two solutions. If the solutions has no constraints the method return 0- Specified by:
comparein interfaceComparator<S extends Solution<?>>- Parameters:
solution1- Object representing the firstSolution.solution2- Object representing the secondSolution.- 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.
-