jmetal.util.comparators
Class OverallConstraintViolationComparator

java.lang.Object
  extended by jmetal.util.comparators.OverallConstraintViolationComparator
All Implemented Interfaces:
java.util.Comparator, IConstraintViolationComparator

public class OverallConstraintViolationComparator
extends java.lang.Object
implements IConstraintViolationComparator

This class implements a Comparator (a method for comparing Solution objects) based on the overall constraint violation of the solucions, as in NSGA-II.


Constructor Summary
OverallConstraintViolationComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares two solutions.
 boolean needToCompare(Solution s1, Solution s2)
          Returns true if solutions s1 and/or s2 have an overall constraint violation < 0
 
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
equals
 

Constructor Detail

OverallConstraintViolationComparator

public OverallConstraintViolationComparator()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compares two solutions.

Specified by:
compare in interface java.util.Comparator
Specified by:
compare in interface IConstraintViolationComparator
Parameters:
o1 - Object representing the first Solution.
o2 - Object representing the second Solution.
Returns:
-1, or 0, or 1 if o1 is less than, equal, or greater than o2, respectively.

needToCompare

public boolean needToCompare(Solution s1,
                             Solution s2)
Returns true if solutions s1 and/or s2 have an overall constraint violation < 0

Specified by:
needToCompare in interface IConstraintViolationComparator