|
MOEA Framework 2.12 API Specification |
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.moeaframework.core.comparator.ChainedComparator
public class ChainedComparator
Applies any number of comparators in succession, returning the result from
the first comparator producing a non-zero return value. If no comparators
produce a non-zero return value, 0
is returned.
For example, the following:
Comparator comparator = new ChainedComparator(comparator1, comparator2); return comparator.compare(s1, s2);is equivalent to
int flag1 = comparator1.compare(s1, s2); if (flag1 == 0) { return comparator2.compare(s1, s2); } else { return flag1; }
Constructor Summary | |
---|---|
ChainedComparator(DominanceComparator... comparators)
Constructs a chained comparator for applying the specified comparators in order, returning the result from the first comparator producing a non-zero return 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 |
Constructor Detail |
---|
public ChainedComparator(DominanceComparator... comparators)
0
is returned.
comparators
- the comparators in the order they are to be appliedMethod Detail |
---|
public int compare(Solution solution1, Solution solution2)
DominanceComparator
-1
if solution1
dominates solution2
, 1
if
solution2
dominates solution1
, and 0
if the
solutions are non-dominated.
compare
in interface DominanceComparator
solution1
- the first solutionsolution2
- the second solution
-1
if solution1
dominates solution2
,
1
if solution2
dominates solution1
, and
0
if the solutions are non-dominated
|
MOEA Framework 2.12 API Specification |
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |