Since resuming the algorithm is possible (see #28), why not give the user the ability to pause it as well?
Here's an implementation target:
$algo = new Kmeans\Algorithm(new Kmeans\RandomInitialization());
$aglo->registerIterationCallback(function ($algo) {
if ($algo->getStatus()->startedAt() > new \DateTime('1 hour ago')) {
return $algo->pause();
}
});
$result = $algo->clusterize($points, $nbClusters);
if ($result->getStatus()->isPaused()) {
echo "Clusterization ran for more than 1h and had to be paused.";
}
Since resuming the algorithm is possible (see #28), why not give the user the ability to pause it as well?
Here's an implementation target:
What do you think?