qiskit-documentation/docs/api/qiskit/scheduler.mdx

115 lines
6.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: scheduler (latest version)
description: API reference for qiskit.scheduler in the latest version of qiskit
in_page_toc_min_heading_level: 2
python_api_type: module
python_api_name: qiskit.scheduler
---
<span id="module-qiskit.scheduler" />
<span id="qiskit-scheduler" />
<span id="circuit-scheduler-qiskit-scheduler" />
# Circuit Scheduler
`qiskit.scheduler`
A circuit scheduler compiles a circuit program to a pulse program.
## Core API
### ScheduleConfig
<Class id="qiskit.scheduler.ScheduleConfig" github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/scheduler/config.py#L21-L35" signature="qiskit.scheduler.ScheduleConfig(inst_map, meas_map, dt)" modifiers="class">
Configuration for pulse scheduling.
Container for information needed to schedule a QuantumCircuit into a pulse Schedule.
**Parameters**
* **inst\_map** ([*InstructionScheduleMap*](qiskit.pulse.InstructionScheduleMap "qiskit.pulse.instruction_schedule_map.InstructionScheduleMap")) The schedule definition of all gates supported on a backend.
* **meas\_map** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.13)")*\[*[*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.13)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]]*) A list of groups of qubits which have to be measured together.
* **dt** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) Sample duration.
</Class>
### schedule\_circuit
<Function id="qiskit.scheduler.schedule_circuit.schedule_circuit" github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/scheduler/schedule_circuit.py#L25-L67" signature="qiskit.scheduler.schedule_circuit.schedule_circuit(circuit, schedule_config, method=None, backend=None)">
Basic scheduling pass from a circuit to a pulse Schedule, using the backend. If no method is specified, then a basic, as late as possible scheduling pass is performed, i.e. pulses are scheduled to occur as late as possible.
Supported methods:
> * `'as_soon_as_possible'`: Schedule pulses greedily, as early as possible on a qubit resource. (alias: `'asap'`)
> * `'as_late_as_possible'`: Schedule pulses late keep qubits in the ground state when possible. (alias: `'alap'`)
**Parameters**
* **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit")) The quantum circuit to translate.
* **schedule\_config** ([*ScheduleConfig*](#qiskit.scheduler.ScheduleConfig "qiskit.scheduler.config.ScheduleConfig")) Backend specific parameters used for building the Schedule.
* **method** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") *| None*) The scheduling pass method to use.
* **backend** ([*BackendV1*](qiskit.providers.BackendV1 "qiskit.providers.backend.BackendV1") *|*[*BackendV2*](qiskit.providers.BackendV2 "qiskit.providers.backend.BackendV2") *| None*) A backend used to build the Schedule, the backend could be BackendV1 or BackendV2.
**Returns**
Schedule corresponding to the input circuit.
**Raises**
[**QiskitError**](exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") If method isnt recognized.
**Return type**
[*Schedule*](qiskit.pulse.Schedule "qiskit.pulse.schedule.Schedule")
</Function>
## Pulse scheduling methods
### as\_soon\_as\_possible
<Function id="qiskit.scheduler.methods.as_soon_as_possible" github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/scheduler/methods/basic.py#L28-L78" signature="qiskit.scheduler.methods.as_soon_as_possible(circuit, schedule_config, backend=None)">
Return the pulse Schedule which implements the input circuit using an “as soon as possible” (asap) scheduling policy.
Circuit instructions are first each mapped to equivalent pulse Schedules according to the command definition given by the schedule\_config. Then, this circuit instruction-equivalent Schedule is appended at the earliest time at which all qubits involved in the instruction are available.
**Parameters**
* **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit")) The quantum circuit to translate.
* **schedule\_config** ([*ScheduleConfig*](#qiskit.scheduler.ScheduleConfig "qiskit.scheduler.config.ScheduleConfig")) Backend specific parameters used for building the Schedule.
* **backend** ([*BackendV1*](qiskit.providers.BackendV1 "qiskit.providers.backend.BackendV1") *|*[*BackendV2*](qiskit.providers.BackendV2 "qiskit.providers.backend.BackendV2") *| None*) A backend used to build the Schedule, the backend could be BackendV1 or BackendV2.
**Returns**
A schedule corresponding to the input `circuit` with pulses occurring as early as possible.
**Return type**
[*Schedule*](qiskit.pulse.Schedule "qiskit.pulse.schedule.Schedule")
</Function>
### as\_late\_as\_possible
<Function id="qiskit.scheduler.methods.as_late_as_possible" github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/scheduler/methods/basic.py#L81-L137" signature="qiskit.scheduler.methods.as_late_as_possible(circuit, schedule_config, backend=None)">
Return the pulse Schedule which implements the input circuit using an “as late as possible” (alap) scheduling policy.
Circuit instructions are first each mapped to equivalent pulse Schedules according to the command definition given by the schedule\_config. Then, this circuit instruction-equivalent Schedule is appended at the latest time that it can be without allowing unnecessary time between instructions or allowing instructions with common qubits to overlap.
This method should improves the outcome fidelity over ASAP scheduling, because we may maximize the time that the qubit remains in the ground state.
**Parameters**
* **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit")) The quantum circuit to translate.
* **schedule\_config** ([*ScheduleConfig*](#qiskit.scheduler.ScheduleConfig "qiskit.scheduler.config.ScheduleConfig")) Backend specific parameters used for building the Schedule.
* **backend** ([*BackendV1*](qiskit.providers.BackendV1 "qiskit.providers.backend.BackendV1") *|*[*BackendV2*](qiskit.providers.BackendV2 "qiskit.providers.backend.BackendV2") *| None*) A backend used to build the Schedule, the backend could be BackendV1 or BackendV2.
**Returns**
A schedule corresponding to the input `circuit` with pulses occurring as late as possible.
**Return type**
[*Schedule*](qiskit.pulse.Schedule "qiskit.pulse.schedule.Schedule")
</Function>