TerminationCondition stagnation = new Stagnation(2, false);
PopulationData<Object> data = new PopulationData<Object>(new Object(), 2, 1.5, 0.1, true, 10, 0, 0, 1);
assert !stagnation.shouldTerminate(data) : "Stagnation should not be triggered for at least 2 more generations.";
// Best doesn't improve even though mean does.
data = new PopulationData<Object>(new Object(), 2.2, 1.2, 0.1, true, 10, 0, 1, 2);
assert !stagnation.shouldTerminate(data) : "Stagnation should not be triggered for at least 1 more generation.";
// Best doesn't improve even though mean does.
data = new PopulationData<Object>(new Object(), 2, 1, 0.1, true, 10, 0, 2, 3);
assert stagnation.shouldTerminate(data) : "Stagnation should be triggered after 2 generations without improvement.";
}