mqt.ionshuttler.linear¶
Compile circuits for a linear ion-shuttling architecture.
Submodules¶
- mqt.ionshuttler.linear.actions
- mqt.ionshuttler.linear.architecture
- mqt.ionshuttler.linear.compiler
- mqt.ionshuttler.linear.config
- mqt.ionshuttler.linear.cost
- mqt.ionshuttler.linear.dd
- mqt.ionshuttler.linear.expand
- mqt.ionshuttler.linear.field_profile
- mqt.ionshuttler.linear.parser
- mqt.ionshuttler.linear.partition_bias
- mqt.ionshuttler.linear.result
- mqt.ionshuttler.linear.schedule
- mqt.ionshuttler.linear.search
- mqt.ionshuttler.linear.state
- mqt.ionshuttler.linear.validation
Package Contents¶
- class Architecture[source]¶
Describe the available sites, processing zones, and control capabilities.
- field_profile: FieldProfile | None = None¶
- __post_init__() None[source]¶
Check the hardware description and store zone sites in order.
- Raises:
ValueError – If the site count, zones, or field profile are invalid.
- get_processing_zone(site: int) str | None[source]¶
Return the processing zone containing a site, if any.
- has_nontrivial_field_profile() bool[source]¶
Return whether any site differs from the unit field profile.
- supports(action_type: type[Action]) bool[source]¶
Return whether the hardware exposes an action type.
Return whether all supplied sites belong to one processing zone.
- initial_pzs_busy_until() tuple[tuple[str, int], ...][source]¶
Return every processing zone as available at the start of a schedule.
- to_json() str[source]¶
Serialize architecture metadata as JSON.
- Returns:
The serialized architecture object.
- classmethod from_dict(data: object, *, action_types: Sequence[type[Action]] | None = None) Architecture[source]¶
Construct an architecture from a JSON-style mapping.
- Parameters:
data – Architecture mapping.
action_types – Additional action classes available when resolving the serialized supported-action catalog.
- Returns:
A validated architecture.
- Raises:
TypeError – If the architecture or site count has the wrong type.
ValueError – If the mapping has an invalid shape or values.
- class GateTiming[source]¶
Configure gate durations and virtual single-ion rotations.
Rx and Ry use physical controls by default. Rz defaults to a zero-duration virtual frame update, as is common on trapped-ion hardware.
- __post_init__() None[source]¶
Ensure the configured timings describe usable gate implementations.
- Raises:
ValueError – If a gate name or duration is invalid.
- duration_for(gate_name: str) int[source]¶
Return how many timesteps a gate takes.
- Raises:
TypeError – If the stored duration is not an integer.
ValueError – If the hardware does not offer
gate_name.
- is_virtual(gate_name: str) bool[source]¶
Return whether a single-ion rotation is implemented virtually.
- Raises:
ValueError – If
gate_nameis not a supported single-ion rotation.
- class HardwareTiming[source]¶
Describe the timing and gate implementations offered by the hardware.
- transport: TransportTiming¶
- gates: GateTiming¶
- class LinearCompilerConfig[source]¶
Group the hardware timing and schedule-search settings.
- hardware_timing: HardwareTiming¶
- search: SearchConfig¶
- class SearchConfig[source]¶
Configure how the compiler searches for a schedule.
A finite
horizonplans a few gates at a time and commitscommitted_gatesbefore planning again. SethorizontoNoneto search the complete circuit at once.heuristicselects the remaining-cost estimate that guides the search: the defaultNoneuses a quality-oriented estimate that finds useful schedules faster but may overestimate the remaining time, whilezero_heuristic()is admissible and supports exact search when all other limits and shortcuts are also disabled. Any other callable matchingHeuristicFnmay be supplied instead.- heuristic: HeuristicFn | None = None¶
- pre_partition_config: FineGrainedTabuConfig | None = None¶
- __post_init__() None[source]¶
Ensure all search limits are meaningful and mutually consistent.
- Raises:
TypeError – If a Boolean option is not Boolean.
ValueError – If a numeric bound or horizon relationship is invalid.
- class HeuristicFn[source]¶
Bases:
ProtocolEstimate the remaining schedule work for one search state.
A custom heuristic supplied through
heuristicmust accept these arguments. The search always passes them positionally, so an implementation may name its parameters freely. The built-inheuristic()additionally accepts optional caching arguments, which the search passes only to that default.- __call__(state: State, architecture: Architecture, gate_order: Sequence[int], gates: Mapping[int, GateAction], predecessors: Mapping[int, frozenset[int]] | None = None, /) int[source]¶
Estimate the work still needed to finish the requested gates.
- Parameters:
state – Search state to score.
architecture – Hardware layout the schedule targets.
gate_order – Gates to schedule, including completed and running ones; filter with
state.completed_gatesandstate.in_progress_gates.gates – Gate actions indexed by identifier.
predecessors – Optional map of which gates must precede others.
- Returns:
A nonnegative estimate of the remaining schedule time.
- zero_heuristic(state: State, architecture: Architecture, gate_order: Sequence[int], gates: Mapping[int, GateAction], predecessors: Mapping[int, frozenset[int]] | None = None, /) int[source]¶
Estimate nothing about the work left to finish the requested gates.
This admissible estimate turns the search into a uniform-cost search, so the first complete schedule has the minimum makespan among the schedules the configured hardware and action model can express. It usually explores many more states than the default
heuristic().- Parameters:
state – Search state to score.
architecture – Hardware layout the schedule targets.
gate_order – Gates to schedule, including completed and running ones.
gates – Gate actions indexed by identifier.
predecessors – Optional map of which gates must precede others.
- Returns:
Always
0.
- class CompilationResult[source]¶
Contain an executable schedule and compiler diagnostics.
The architecture and action schedule are parallel compilation artifacts. This result also owns search completion, cost, runtime, explored-node count, and the compiler state reached at termination.
- status: CompilationStatus¶
- schedule: ActionSchedule¶
- architecture: Architecture¶
- __post_init__() None[source]¶
Validate compiler diagnostics and the schedule boundary.
- Raises:
TypeError – If a result field has the wrong type.
ValueError – If a numeric diagnostic is outside its valid range.
- property initial_state: MachineState¶
The schedule’s machine-only initial state.
- classmethod from_dict(data: object, *, action_types: Sequence[type[Action]] | None = None, action_decoders: ActionDecoders | None = None) CompilationResult[source]¶
Restore a result from its JSON-compatible representation.
- Returns:
The restored compilation result.
- Raises:
ValueError – If the document is malformed.
- classmethod from_json(raw: str, *, action_types: Sequence[type[Action]] | None = None, action_decoders: ActionDecoders | None = None) CompilationResult[source]¶
Restore a result from JSON text.
- Returns:
The restored compilation result.
- class CompilationStatus[source]¶
Bases:
enum.StrEnumDescribe how compilation ended.
- SUCCESS = 'SUCCESS'¶
- TIMEOUT = 'TIMEOUT'¶
- FAILED = 'FAILED'¶
- INTERRUPTED = 'INTERRUPTED'¶
- class ActionSchedule[source]¶
Contain the immutable executable boundary shared by downstream stages.
Action IDs are unique within a schedule and remain attached to preserved actions when a transformation inserts or replaces operations. Compiler search status and dynamical-decoupling reports are intentionally absent.
- scheduled_actions: tuple[ScheduledAction, ...]¶
- initial_state: MachineState¶
- __post_init__() None[source]¶
Freeze and validate the executable schedule.
- Raises:
TypeError – If a schedule field has the wrong type.
ValueError – If identifiers or timing are inconsistent.
- classmethod from_actions(actions: Sequence[Action], initial_state: State | MachineState) ActionSchedule[source]¶
Create a schedule and assign deterministic action identifiers.
- Parameters:
actions – Ordered executable operations.
initial_state – Initial hardware or compiler state. Compiler progress fields are deliberately discarded.
- Returns:
The immutable action schedule.
- classmethod from_dict(data: object, *, action_types: Sequence[type[Action]] | None = None, action_decoders: ActionDecoders | None = None) ActionSchedule[source]¶
Restore a schedule from its JSON-compatible representation.
- Returns:
The restored action schedule.
- Raises:
ValueError – If the action stream or metadata is malformed.
- classmethod from_json(raw: str, *, action_types: Sequence[type[Action]] | None = None, action_decoders: ActionDecoders | None = None) ActionSchedule[source]¶
Restore a schedule from JSON text.
- Returns:
The restored action schedule.
- class MachineState[source]¶
Describe hardware state without compiler circuit-progress fields.
- __post_init__() None[source]¶
Normalize and validate machine-state values.
- Raises:
TypeError – If the machine clock has the wrong type.
ValueError – If state mappings, occupancy, or timestamps are inconsistent.
- classmethod from_compiler_state(state: State) MachineState[source]¶
Copy only hardware fields from a compiler state.
Availability timestamps in a compiler state may refer to resources that became free before its current clock. The machine-only view canonicalizes those timestamps to the current clock.
- Parameters:
state – Compiler state whose circuit progress is discarded.
- Returns:
The canonical machine-only state.
- to_replay_state() State[source]¶
Return a state suitable for schedule replay.
- Returns:
A compiler-state value with empty circuit-progress fields.
- classmethod from_dict(data: object) MachineState[source]¶
Restore a machine state from JSON-compatible values.
- Returns:
The restored machine-only state.