qctrl_controller

qctrlmloop.qctrl_controller(interface: mloop.interfaces.Interface, initializer_name: str, api_root: Optional[str] = None, test_point_count: Optional[int] = None, learner_name: Optional[str] = None, training_run_count: int = 0, interleaved_run_count: int = 0, **kwargs)

Creates a QctrlController using serializable parameters.

You can use this to create a QctrlController when calling BOULDER OPAL from an M-LOOP configuration file. To do this, add the line controller_type="qctrlmloop:qctrl_controller" to the configuration file, and follow it with all the parameters that you want to pass to this function. Notice that you must prefix all the parameters for the optimizer with the prefix initializer_. For example, to pass the parameter elite_fraction=0.1 to the CrossEntropyInitializer, write initializer_name="CrossEntropyInitializer" and initializer_elite_fraction=0.1 in the configuration file.

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

  • initializer_name (str) – A string representing the name of the initializer that you want to use. You must write the name in PascalCase. For example, write "CrossEntropyInitializer" to use the cross entropy method. You must prefix all the parameters that you want to pass to the initializer with initializer_ and include them in the keyword arguments of this function.

  • api_root (str, optional) – The URL of the BOULDER OPAL API that you want to use. Defaults to None, in which case the default API server is used.

  • 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_name (str, optional) – The name of 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.

Returns

The controller that integrates BOULDER OPAL with M-LOOP.

Return type

QctrlController

Raises

QctrlArgumentsValueError – Raised if the names provided for initializer_name and learner_name don’t match valid object classes.