MOEA Framework 2.5
API Specification

org.moeaframework.core.comparator
Class FitnessComparator

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

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

Compares two solutions based on their FITNESS_ATTRIBUTE value.

See Also:
FitnessEvaluator, Serialized Form

Constructor Summary
FitnessComparator()
          Deprecated. Use FitnessComparator(boolean) instead; this method will be removed in a future version
FitnessComparator(boolean largerValuesPreferred)
          Constructs a dominance comparator for comparing solutions based on their FITNESS_ATTRIBUTE value.
 
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.
 
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

FitnessComparator

@Deprecated
public FitnessComparator()
Deprecated. Use FitnessComparator(boolean) instead; this method will be removed in a future version

Constructs a dominance comparator for comparing solutions based on their FITNESS_ATTRIBUTE value. By default, smaller fitness values are preferred.


FitnessComparator

public FitnessComparator(boolean largerValuesPreferred)
Constructs a dominance comparator for comparing solutions based on their FITNESS_ATTRIBUTE value.

Parameters:
largerValuesPreferred - true if larger fitness values are preferred; otherwise smaller fitness values are preferred
Method Detail

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.5
API Specification

Copyright 2009-2015 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Hosted by Get MOEA Framework at SourceForge.net. Fast, secure and Free Open Source software downloads