Stefan-Endres / shgo

Simplicial Homology Global Optimization
https://stefan-endres.github.io/shgo
MIT License
44 stars 12 forks source link

Stopping a routine in finite processing time using the standard library #4

Open Stefan-Endres opened 6 years ago

Stefan-Endres commented 6 years ago

Currently in the go_bench_f_min.py file uses the interruptingcow module (interruptingcow.timeout) to stop the entire while loop in finite time. We cannot asses the time pass at the start of every loop since building on the simplicial complex (by either using delaunay triangulation or the hypercube sampling) can take extremely long on a single iteration.

We want to minimise dependencies for shgo since we want to include it in many other modules.

Therefore we need a way to stop the entire loop in a similar way that interruptingcow by wrapping the entire loop in a with statement and raising a RuntimeError when the processing time limit expires.

Stefan-Endres commented 6 years ago

The module is available under a MIT license so it might be worth adapting into shgo https://github.com/erikvanzijst/interruptingcow