MOEA Framework 2.12
API Specification

org.moeaframework.core.comparator
Class AggregateConstraintComparator

java.lang.Object
  extended by org.moeaframework.core.comparator.AggregateConstraintComparator
All Implemented Interfaces:
Serializable, Comparator<Solution>, DominanceComparator

public class AggregateConstraintComparator
extends Object
implements DominanceComparator, Comparator<Solution>, Serializable

Compares solutions based on their magnitude of constraint violations. Absolute values of constraints are used, so only the magnitude of the constraint violation is important.

See Also:
Serialized Form

Constructor Summary
AggregateConstraintComparator()
          Constructs an aggregate constraint comparator.
 
Method Summary
 int compare(Solution solution1, Solution solution2)
          Compares the two solutions using a dominance relation, returning -1 if solution1 dominates solution2, 1 if solution2 dominates solution1, and 0 if the solutions are non-dominated.
static double getConstraints(Solution solution)
          Returns the sum of the absolute value of the constraints for the specified solution.
 
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

AggregateConstraintComparator

public AggregateConstraintComparator()
Constructs an aggregate constraint comparator.

Method Detail

getConstraints

public static double getConstraints(Solution solution)
Returns the sum of the absolute value of the constraints for the specified solution. This allows supporting constraints expressed as both positive and negative magnitudes. Larger magnitudes correspond to larger constraint violations.

Parameters:
solution - the solution
Returns:
the sum of the absolute value of the constraints for the specified solution

compare

public int compare(Solution solution1,
                   Solution solution2)
Description copied from interface: DominanceComparator
Compares the two solutions using a dominance relation, returning -1 if solution1 dominates solution2, 1 if solution2 dominates solution1, and 0 if the solutions are non-dominated.

Specified by:
compare in interface Comparator<Solution>
Specified by:
compare in interface DominanceComparator
Parameters:
solution1 - the first solution
solution2 - the second solution
Returns:
-1 if solution1 dominates solution2, 1 if solution2 dominates solution1, and 0 if the solutions are non-dominated

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!