stefan_ml at behnel.de
Mon Dec 24 09:45:54 EST 2018
Avi Gross schrieb am 17.12.18 um 01:00:
> SHORT VERSION: a way to automatically run multiple algorithms in parallel
> and kill the rest when one returns an answer.
One (somewhat seasonal) comment on this: it doesn't always have to be about
killing (processes or threads). You might also consider a cooperative
implementation, where each of the algorithms is allowed to advance by one
"step" in each "round", and is simply discarded when a solution is found
elsewhere, or when it becomes unlikely that this specific algorithm will
contribute a future solution. This could be implemented via a sequence of
generators or coroutines in Python. Such an approach is often used in
simulations (e.g. SimPy and other "discrete event" simulators), where exact
control over the concurrency pattern is desirable.
More information about the Python-list