This project is archived. Its data is read-only.

Ensure a minimum resolution

Just putting this code snippet here, we should have a "cookbook" of useful functions maybe.

def add_minimum_resolution(learner, minimum_resolution):
    from itertools import product
    from collections import OrderedDict
    xs = np.linspace(-1, 1, minimum_resolution)
    learner._stack = OrderedDict({(x, y): np.inf for x, y in product(xs, xs)})
            
learner = adaptive.Learner2D(ring, bounds=[(-1, 1), (-1, 1)])
add_minimum_resolution(learner, 40)
runner = adaptive.Runner(learner, adaptive.runner.SequentialExecutor(), goal=lambda l: l.loss() < 0.01)
Assignee Loading
Time tracking Loading