step

boulderopal.closed_loop.step(optimizer, results=None, test_point_count=None)

Perform a single step in a closed-loop optimization.

Parameters:
  • optimizer (ClosedLoopOptimizer or str) – The optimizer to be used in the minimization of the cost function, or an optimizer state. If this is the first optimization step pass an instance of a closed-loop optimizer class. In subsequent steps, pass the optimizer state as returned by the previous step.

  • results (Results or None, optional) – Results from evaluating the cost function. You can omit this parameter if you want to generate more test points but have not yet evaluated the cost function. Defaults to None. 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 or None, optional) – Requested number of test points to be generated from the optimizer at this step. This is a hint to the optimizer, the number of returned test points might be different. 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).

Returns:

A dictionary containing the optimization step result, with the following keys:

test_points

New test points at which the cost function should be evaluated for the next optimization step.

state

The optimizer state, to be provided in the next step.

metadata

Metadata associated with the calculation. No guarantees are made about the contents of this metadata dictionary; the contained information is intended purely to help interpret the results of the calculation on a one-off basis.

Return type:

dict

See also

boulderopal.closed_loop.optimize

Run a closed-loop optimization to find a minimum of the given cost function.

boulderopal.execute_graph

Evaluate generic functions.

boulderopal.run_gradient_free_optimization

Perform model-based optimization without using gradient values.

boulderopal.run_optimization

Perform gradient-based deterministic optimization of generic real-valued functions.

boulderopal.run_stochastic_optimization

Perform gradient-based stochastic optimization of generic real-valued functions.