NoOpMinimize

class NoOpMinimize

Classical optimizer that evaluates the objective at a fixed set of parameters.

This optimizer does not search for better parameters. It evaluates the objective function exactly once at the parameter values provided via parameters. Useful for benchmarking or reproducing results with known parameters.

Assign an instance to minimize to use it.

Methods

__init__

Initialize a NoOpMinimize optimizer.

Attributes

parameters

The fixed circuit parameter values to evaluate.

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

Evaluate the objective at the fixed parameters.

Parameters:
  • func (Callable[[list[float]], float]) – Objective function that maps a list of circuit parameters to a scalar cost.

  • num_parameters (int) – Expected number of variational parameters.

  • dry_run (bool) – If True, skip evaluation and return None.

Returns:

The evaluation result, or None if dry_run is True.

Return type:

NoOpMinimizeResult | None

Raises:

ValueError – If parameters is None or has wrong length.

__init__(parameters: Sequence[float] | None = None) None

Initialize a NoOpMinimize optimizer.

Parameters:

parameters (Sequence[float] | None) – Fixed circuit parameter values to evaluate. Must be provided before calling the optimizer; passing None defers the error to call time.

parameters

The fixed circuit parameter values to evaluate. Must be provided before calling the optimizer; passing None defers the error to call time.