calculate_closed_loop_optimization_step(*, optimizer, results=, test_point_count=None, **kwargs)¶
Perform a single-step computation for closed-loop optimization.
Use this function to initialize an optimizer, update it with costs from the cost function you define, and generate more test points for your system to perform a closed-loop optimization. You can use this approach when your system is too complicated to model, or the computation of gradient is expensive or impossible.
optimizer (qctrl.dynamic.types.closed_loop_optimization_step.Optimizer) – Option to initialize the optimizer or update the optimization state.
results (List[qctrl.dynamic.types.closed_loop_optimization_step.CostFunctionResult], optional) – Results from evaluating the cost function. You can pass an empty list (or omit this parameter) if you want to generate more test points but have not yet evaluated the cost function. Defaults to an empty list. Note that some optimizers might have extra requirements of results needed for the first optimization step. You can check the documentation of the individual optimizers for details.
test_point_count (int, optional) – Requested number of test points to be generated from the optimizer at this step. This value is a hint to the optimizer, meaning the number of returned test points might be different to this value. You should set this value based on the number of test points you can efficiently calculate as a batch or in parallel. Typically, optimizers will return at least this many points, but they might return more (for example if a certain number of points is required in order to move the algorithm to the next state) or, occasionally, fewer (for example if moving the algorithm to the next state requires the evaluation of a specific point and nothing more).
Result from the optimizer.
- Return type