QctrlController

class qctrlmloop.QctrlController(interface: mloop.interfaces.Interface, qctrl: qctrl.qctrl.Qctrl, optimizer: Any, test_point_count: Optional[int] = None, learner: Optional[mloop.learners.Learner] = None, training_run_count: int = 0, interleaved_run_count: int = 0, **kwargs)

Controller for optimizations that uses BOULDER OPAL automated closed-loop optimizers.

You can use this controller to integrate an experiment managed by M-LOOP to a BOULDER OPAL automated closed-loop optimizer. Notice that you need to set up an M-LOOP Interface to your experiment, initiate a BOULDER OPAL session, and define your choice of BOULDER OPAL automated closed-loop optimizer prior to using this class.

Parameters
  • interface (mloop.interfaces.Interface) – The M-LOOP interface from where you obtain the cost value of the test points.

  • qctrl (qctrl.Qctrl) – The object representing the BOULDER OPAL session. You must initiate it before calling the controller.

  • optimizer (qctrl.types.closed_loop_optimization_step.Optimizer) – The BOULDER OPAL automated closed-loop optimizer that you want to use. It must be a valid optimizer object (containing either an initializer or a state from a previous optimization run), as described in the BOULDER OPAL reference documentation.

  • test_point_count (int, optional) – The requested number of test points that the BOULDER OPAL automated closed-loop optimizer generates at each step. If chosen, it must be greater than zero. This is a hint only. The BOULDER OPAL automated closed-loop optimizer might choose differently.

  • learner (mloop.learners.Learner, optional) – The M-LOOP Learner that this controller uses to obtain extra test points, before there are enough results to run a step of the BOULDER OPAL automated closed-loop optimizer. Defaults to None, in which case this controller uses a RandomLearner.

  • training_run_count (int, optional) – The minimum number of training points that the controller obtains before calling the BOULDER OPAL automated closed-loop optimizer. Defaults to 0, in which case the controller uses the minimum number of points that the BOULDER OPAL automated closed-loop optimizer requires.

  • interleaved_run_count (int, optional) – The minimum number of test points that the controller obtains from the learner between two calls of the BOULDER OPAL automated closed-loop optimizer, in addition to the points that BOULDER OPAL requested. Defaults to 0.

  • kwargs (dict) – All the extra arguments that the Controller class from M-LOOP accepts.

Methods

check_end_conditions

Check whether either of the three end contions have been met: number_of_runs, target_cost or max_num_runs_without_better_params.

optimize

Optimize the experiment.

print_results

Print results from optimization run to the logs

save_archive

Save the archive associated with the controller class.