Skip to content

Benchmark Executor

Executors that run quantum circuits and collect results.

Three executor types are available: - BenchmarkExecutor: base class for custom executors. - DefaultBenchmarkExecutor: runs circuits sequentially via the adapter. - HybridBenchmarkExecutor: iterative optimization loop (variational algorithms).

BenchmarkExecutor

Bases: ABC

Base class for benchmark executors.

Executors receive circuits or generators and produce execution results. Each executor encapsulates a specific execution strategy. The context is available during execution for accessing the adapter, parameters, and other run metadata.

run abstractmethod

run(
    circuits: List[CircuitSpec], context: RunContext
) -> List[ExecutionResult]

Execute the provided circuits.

DefaultBenchmarkExecutor

Bases: BenchmarkExecutor

Sequential circuit executor.

Takes a list of CircuitSpec objects and runs them sequentially using the adapter from the context. Preserves circuit metadata in each result. Suitable for non-adaptive benchmarks.

run

run(
    circuits: List[CircuitSpec], context: RunContext
) -> List[ExecutionResult]

Execute circuits using the adapter from context.

HybridBenchmarkExecutor

Bases: BenchmarkExecutor

Hybrid benchmark executor for circuits that require both quantum and classical processing.

run

run(
    generator: CircuitGenerator, context: RunContext
) -> List[ExecutionResult]

Execute hybrid circuits using the adapter from context.

maxcut_expectation

maxcut_expectation(
    counts: dict, edges: list[tuple[int, int]]
) -> float

Calculate the MaxCut expectation value for a given bitstring and edge list. Each edge contributes +1 if the bits are different, 0 otherwise.