MinimizeProtocol

class MinimizeProtocol

Bases: Protocol

Protocol for classical optimizers used to tune QAOA circuit parameters.

Implement this protocol to provide a custom classical optimizer. Assign an instance to minimize to replace the default ScipyMinimize.

Methods

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

Run the classical optimization.

Parameters:
  • 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.

Returns:

The optimization result, or None if dry_run is True.

Return type:

MinimizeResult | None

__init__(*args, **kwargs)