compareTo method

  1. @override
int compareTo(
  1. FitnessResult other
)
override

Fitness results compare according to their paretoRank first and then according to the result of evaluate.

Subclasses are free to override this when they need a more involved approach (but in general, they should keep the precedence of paretoRank to all else.

Implementation

@override
int compareTo(FitnessResult other) {
  if (paretoRank != other.paretoRank) {
    return paretoRank.compareTo(other.paretoRank);
  }
  return evaluate().compareTo(other.evaluate());
}