runUntilDone method
Implementation
Future<void> runUntilDone() async {
await Future.wait(evaluators.map((e) => e.init()));
while (true) {
await _evaluateNextGeneration();
if (currentExperiment >= maxExperiments) {
printf('All experiments done ($currentExperiment)');
break;
}
if (thresholdResult != null &&
generations.last.members
.any((P ph) => ph.result!.compareTo(thresholdResult!) < 0)) {
printf('One of the phenotypes got over the threshold.');
break;
}
_onGenerationEvaluatedController.add(generations.last);
_createNewGeneration();
currentGeneration++;
}
for (final evaluator in evaluators) {
evaluator.destroy();
}
}