ScipyMinimize

class ScipyMinimize

Classical optimizer for QAOA circuit parameters using scipy.optimize.minimize().

Wraps SciPy's minimization routines to tune the variational parameters of the QAOA ansatz circuit. Assign an instance of this class to minimize to use it (it is also the default).

Methods

__init__

Initialize a ScipyMinimize optimizer.

Attributes

method

Optimization method passed to scipy.optimize.minimize().

tol

Tolerance for termination, passed as the tol argument to scipy.optimize.minimize().

x0

Initial parameter values.

options

Additional options forwarded as the options argument to scipy.optimize.minimize() (e.g., {"maxiter": 500}).

__call__(
func: Callable[[list[float]], float],
num_parameters: int,
*,
dry_run: bool = False,
) ScipyMinimizeResult | None

Run the SciPy minimization.

パラメータ:
  • func (Callable[[list[float]], float]) -- Objective function that maps a list of circuit parameters to a scalar cost.

  • num_parameters (int) -- Number of variational parameters to optimize.

  • dry_run (bool) -- If True, validate inputs without running the optimizer and return None.

戻り値:

The optimization result, or None if dry_run is True.

戻り値の型:

ScipyMinimizeResult | None

__init__(
method: str = 'COBYLA',
tol: float | None = None,
x0: list[float] | None = None,
options: ScipyMinimizeOptions | None = None,
) None

Initialize a ScipyMinimize optimizer.

パラメータ:
  • method (str) -- Optimization method. Defaults to "COBYLA".

  • tol (float | None) -- Tolerance for termination. If None, the optimizer's default is used.

  • x0 (list[float] | None) -- Initial parameter values. Must have at least as many elements as the number of circuit parameters. If None, values are drawn uniformly at random from [0, 1).

  • options (ScipyMinimizeOptions | None) -- Additional options forwarded as the options argument to scipy.optimize.minimize() (e.g., {"maxiter": 500}).

method: str

Optimization method passed to scipy.optimize.minimize(). Defaults to "COBYLA", which is derivative-free and well-suited for noisy quantum circuits. See the SciPy documentation for available methods.

options: ScipyMinimizeOptions | None

Additional options forwarded as the options argument to scipy.optimize.minimize() (e.g., {"maxiter": 500}).

tol: float | None

Tolerance for termination, passed as the tol argument to scipy.optimize.minimize(). If None, the optimizer's default is used.

x0: list[float] | None

Initial parameter values. Must have at least as many elements as the number of circuit parameters. If None, values are drawn uniformly at random from [0, 1).