# Optimization

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

Boulder Opal uses computational graphs to represent quantum systems for efficient optimization.
It provides both gradient-based and gradient-free optimizers for designing optimal controls
for your quantum system using a model-based approach.

See the [Understanding graphs in Boulder Opal](https://docs.q-ctrl.com/boulder-opal/topics/understanding-graphs-in-boulder-opal)
topic and [How to represent quantum systems using graphs](https://docs.q-ctrl.com/boulder-opal/user-guides/how-to-represent-quantum-systems-using-graphs)
user guide to learn more about computational graphs.
The [Choosing a control-design (optimization) strategy in Boulder Opal](https://docs.q-ctrl.com/boulder-opal/topics/choosing-a-control-design-optimization-strategy-in-boulder-opal)
topic provides some general suggestions on different optimization routines.
You can also refer to our [user guides](https://docs.q-ctrl.com/boulder-opal/user-guides)
for demonstrations of using the optimizer in various different physical systems.

The [Improving calculation performance in graphs](https://docs.q-ctrl.com/boulder-opal/topics/improving-calculation-performance-in-graphs)
topic can teach you how to best perform graph calculations.
If your optimization involves quantum dynamics, you might also be interested in the
[Choosing the approach to simulate a quantum system](https://docs.q-ctrl.com/boulder-opal/topics/choosing-the-approach-to-simulate-a-quantum-system)
topic, providing an overview of the different graph-based simulation options in Boulder Opal.

To optimize quantum systems with a model-free approach, use
the [Closed-loop optimization](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop.md#closed-loop-optimization) module.

## Classes

|||
|---------------------------------------------------------------------------|-----------------------------------------------------------------------------|
| [HistoryScope](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/HistoryScope.md#boulderopal.optimization.HistoryScope)   | Configuration for the history data returned from a graph-based optimizer.   |
| [Adam](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Adam.md#boulderopal.stochastic.Adam)                             | Adaptive moment estimation (Adam) optimizer for stochastic optimization.    |

## Functions

|||
|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| [run_gradient_free_optimization](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/run_gradient_free_optimization.md#boulderopal.run_gradient_free_optimization)   | Perform model-based optimization without using gradient values.                     |
| [run_optimization](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/run_optimization.md#boulderopal.run_optimization)                                             | Perform gradient-based deterministic optimization of generic real-valued functions. |
| [run_stochastic_optimization](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/run_stochastic_optimization.md#boulderopal.run_stochastic_optimization)            | Perform gradient-based stochastic optimization of generic real-valued functions.    |
