Execution Plan¶
An ExecutionPlan is the declarative, JSON-safe
description of what to run, where and how. Plans are plain data
— they never execute anything.
Exactly one of these describes the work:
circuit— aQuantumCircuit,ir— anIRCircuit,compiled— aCompilationResultto reuse instead of recompiling.
Where & how:
target— aTargetthe work is compiled for.backend— aBackend, or the name of a registered backend (resolved through the runtime’sBackendRegistry).shots— number of measurement shots (default 1024).parameter_bindings— mapping of parameter name (orParameter) to value, bound before execution.initial_state— optional startingStateVector.seed— RNG seed for reproducible execution.optimization_level— compiler level (0-2).options/metadata— free-form runtime options and user metadata.
Building plans¶
from microquantum import ExecutionPlan, Parameter, QuantumCircuit, StatevectorBackend
theta = Parameter("theta")
qc = QuantumCircuit(1).ry(theta, 0)
plan = ExecutionPlan.from_circuit(
qc,
name="ry-diag",
backend=StatevectorBackend(),
shots=4096,
parameter_bindings={"theta": 0.5},
seed=7,
optimization_level=1,
)
print(plan.validate()) # [] (bound, valid)
data = plan.to_dict() # JSON-safe
restored = ExecutionPlan(**data)
Binding¶
The plan carries the bindings; the runtime binds before dispatch. A bound
plan’s work is concrete: plan.bound() returns the resolved circuit.