qctrl_controller
- qctrlmloop.qctrl_controller(interface, initializer_name, api_root=None, test_point_count=None, learner_name=None, training_run_count=0, interleaved_run_count=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 prefixinitializer_
. For example, to pass the parameterelite_fraction=0.1
to the CrossEntropyInitializer, writeinitializer_name="CrossEntropyInitializer"
andinitializer_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 withinitializer_
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:
- Raises:
QctrlArgumentsValueError – Raised if the names provided for initializer_name and learner_name don’t match valid object classes.