Skip to content

Solver Customization

The optimizer_preferences input to the GroundStateSolver class details the parameters of the VQE optimization scheme.

The GroundStateOptimizer class consists of the following parameters:

  1. type - (OptimizerType) Classical optimization algorithms: COBYLA, SPSA, ADAM, L-BFGS-B, NELDER MEAD.
  2. num_shots – (positive int) Number of measurements of the ansatz for each assignment of variational parameters.
  3. max_iteration – (positive int) Maximal number of optimizer iterations.
  4. tolerance – (positive float) Final accuracy of the optimization.
  5. step_size - (positive float) Step size for numerically calculating the gradient in L_BFGS_B and ADAM optimizers.
  6. initial_point - (List of floats) Initial values for the ansatz parameters.

Example

{
    "optimizer_preferences" : {
        "type": "COBYLA",
        "num_shots": 1000,
        "max_iteration": 30
    }
}
from classiq.interface.executor.optimizer_preferences import GroundStateOptimizer

optimizer_preferences = GroundStateOptimizer(
    max_iteration=30,
    num_shots=1000,
)