Skip to content

Pause algorithm execution #30

@bdelespierre

Description

@bdelespierre

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.";
}

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions