QuantumAlgoProtocol¶
- class QuantumAlgoProtocol¶
ベースクラス:
ProtocolProtocol for quantum optimization algorithms.
Implement this protocol to define a custom algorithm compatible with any
QuantumBaseClientsubclass. A conforming class must declareacceptable_degrees, aParametersclass, and a staticrun()method.Methods
Attributes
Configuration class for the algorithm.
Polynomial degrees accepted by the algorithm's objective function.
- __init__(*args, **kwargs)¶
- static run(
- sampler: SamplerProtocol[SamplingMeta_co, Any],
- model: Model,
- parameters: Any,
- dry_run: Literal[False],
- static run(
- sampler: SamplerProtocol[SamplingMeta_co, Any],
- model: Model,
- parameters: Any,
- dry_run: Literal[True],
Run the algorithm on the given model.
- パラメータ:
sampler (SamplerProtocol[SamplingMeta_co, Any]) -- Backend sampler that executes quantum circuits.
model (Model) -- The optimization model to solve.
parameters (Any) -- Algorithm-specific configuration (e.g.,
QAOA.Parameters).dry_run (bool) -- If
True, validate inputs without executing circuits and returnNone.
- 戻り値:
The algorithm result, or
Noneif dry_run isTrue.- 戻り値の型:
CustomClientResultProtocol | None
- Parameters: Final[type]¶
Configuration class for the algorithm. Instances are passed to
run()and toacceptable_degreeswhen it is a callable.
- acceptable_degrees: Final[AcceptableDegrees | Callable[[Any], AcceptableDegrees]]¶
Polynomial degrees accepted by the algorithm's objective function. Either a static
AcceptableDegreesvalue, or a callable that takes aParametersinstance and returns one.