Runner extras

Simple executor

adaptive.runner.simple(learner, goal)[source]

Run the learner until the goal is reached.

Requests a single point from the learner, evaluates the function to be learned, and adds the point to the learner, until the goal is reached, blocking the current thread.

This function is useful for extracting error messages, as the learner’s function is evaluated in the same thread, meaning that exceptions can simple be caught an inspected.

Parameters
  • learner (BaseLearner` instance) –

  • goal (callable) – The end condition for the calculation. This function must take the learner as its sole argument, and return True if we should stop.

Sequential excecutor

class adaptive.runner.SequentialExecutor[source]

A trivial executor that runs functions synchronously.

This executor is mainly for testing.

Replay log

adaptive.runner.replay_log(learner, log)[source]

Apply a sequence of method calls to a learner.

This is useful for debugging runners.

Parameters
  • learner (BaseLearner instance) – New learner where the log will be applied.

  • log (list) – contains tuples: (method_name, *args).