# Closed-loop optimization

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop

The closed-loop optimization module provides optimization tools that communicate
directly with a given experimental apparatus.
This is useful for optimization problems where a
complete understanding of the quantum system is not available.
Instead of building a detailed model of the system, the optimizer
uses feedback from the system to converge to low values of a
specified cost function.

To run a closed-loop optimization, begin by creating an optimizer using
one of the boulderopal.closed_loop.ClosedLoopOptimizer classes.
Then if the interface with your experimental apparatus can
straightforwardly be defined through a function, you can use
boulderopal.closed_loop.optimize to easily set up and run the whole
optimization.
If you need more flexibility, you can create the iteration loop yourself and
use boulderopal.closed_loop.step to take an optimization step at each iteration.

For a quick introduction, see the [Find optimal pulses with automated optimization](https://docs.q-ctrl.com/boulder-opal/tutorials/find-optimal-pulses-with-automated-optimization)
tutorial and the [How to automate closed-loop hardware optimization](https://docs.q-ctrl.com/boulder-opal/user-guides/how-to-automate-closed-loop-hardware-optimization) user guide.

## Classes

|||
|---------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| [BoundType](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/BoundType.md#boulderopal.closed_loop.BoundType)                               | Boundary type for parameter bounds.                                                                                                   |
| [Bounds](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/Bounds.md#boulderopal.closed_loop.Bounds)                                        | A box constraint with which you can define the (inclusive) bounds and their type for each optimizable parameter in your optimization. |
| [ClosedLoopOptimizer](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/ClosedLoopOptimizer.md#boulderopal.closed_loop.ClosedLoopOptimizer) | Abstract class for optimizers used in closed-loop optimization.                                                                       |
| [Cmaes](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/Cmaes.md#boulderopal.closed_loop.Cmaes)                                           | The covariance matrix adaptation evolution strategy (CMA-ES) optimizer.                                                               |
| [GaussianProcess](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/GaussianProcess.md#boulderopal.closed_loop.GaussianProcess)             | The Gaussian process optimizer.                                                                                                       |
| [NeuralNetwork](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/NeuralNetwork.md#boulderopal.closed_loop.NeuralNetwork)                   | The neural network optimizer.                                                                                                         |
| [Results](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/Results.md#boulderopal.closed_loop.Results)                                     | Results from evaluating the closed-loop optimization cost function.                                                                   |
| [SimulatedAnnealing](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/SimulatedAnnealing.md#boulderopal.closed_loop.SimulatedAnnealing)    | The simulated annealing optimizer.                                                                                                    |

## Functions

|||
|--------------------------------------------------------------------------|--------------------------------------------------------------------------------|
| [optimize](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/optimize.md#boulderopal.closed_loop.optimize)   | Run a closed-loop optimization to find a minimum of the given cost function.   |
| [step](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/step.md#boulderopal.closed_loop.step)               | Perform a single step in a closed-loop optimization.                           |
