comparatorAt

fun comparatorAt(evaluationNumber: Int): Comparator<Solution>(source)

A comparator that judges every solution at ONE evaluation number, and is therefore safe to sort with.

compare deliberately judges each PAIR at the later of that pair's two clocks, which is right for a single comparison and is what stops an incumbent being defended by a smaller penalty multiplier than its challengers carry. It is not a total order: three solutions can be compared at three different multipliers, and the ordering they imply can contain a cycle. A Comparator with a cycle breaks the contract sorting requires, and the result is undefined -- it may throw, or it may silently return an order the comparator itself disagrees with.

So ordering a collection is a different operation from comparing a pair, and needs a fixed clock. Use this to sort; use compare to decide between two.

Parameters

evaluationNumber

the clock every solution is judged at