mqt.ionshuttler.linear.dd.sadd

Public types for the shuttling-aware dynamical decoupling (SADD) pass.

Module Contents

class SADDMethod[source]

Bases: enum.StrEnum

Select a shuttling-aware dynamical decoupling (SADD) method.

PULSE_ONLY = 'pulse_only_sadd'
FULL = 'full_sadd'
property allow_transport: bool

Whether this method permits transport synthesis.

class SADDConfig[source]

Configure the shared pulse-only and transport-enabled SADD backend.

SADD denotes shuttling-aware dynamical decoupling.

timeout_s bounds each control window’s solve. The unchanged schedule is always an admissible solution and is supplied to the solver as a hint, so a window that runs out of time yields a weaker improvement or none at all rather than an invalid or missing result. Raise it for long windows or many participating ions, where proving optimality takes longer.

Synthesized shuttles, swaps, and local pulses take the durations defined by the architecture.

min_window_length: int = 2
max_window_length: int = 16
max_participating_ions: int = 5
timeout_s: float = 1.0
ion_preselection: Literal['phase', 'distance'] = 'phase'
opportunity_order: Literal['chronological', 'reverse_chronological'] = 'chronological'
max_accepted_windows: int | None = None
improvement_tolerance: float = 1e-12
allow_pulses: bool = True
scale: int = 1000
num_search_workers: int = 8
__post_init__() → None[source]

Validate optimization and problem parameters.

Raises:
  • TypeError – If a parameter has the wrong type.

  • ValueError – If a parameter is outside its supported range.

class SADDOpportunityRecord[source]

Describe one ordered SADD optimization opportunity and its outcome.

transport_delta records the signed change in scheduled transport actions by concrete action type between the opportunity input and proposed result. Equality ignores runtime_s, so two runs with the same outcome compare equal.

target_pz: str
window: tuple[int, int]
participating_ions: tuple[int, ...]
status: str
validation_status: str
phase_cost_before: float
phase_cost_after: float | None
accepted: bool
pulse_count: int
transport_delta: Mapping[str, int]
runtime_s: float
message: str | None = None
eligible_ions: tuple[int, ...] = ()
busy_ions: tuple[int, ...] = ()
rejected_no_active_segment_ions: tuple[int, ...] = ()
rejected_unreachable_ions: tuple[int, ...] = ()
selection_scores: tuple[tuple[int, float, int], ...] = ()
phase_before_by_ion: IonFloatMapping | None = None
phase_after_by_ion: IonFloatMapping | None = None
pulse_timesteps: IonTimestepsMapping | None = None
pulse_action_ids: IonTimestepsMapping | None = None
transport_actions: tuple[str, ...] = ()
trajectories: IonTimestepsMapping | None = None
model_num_variables: int = 0
model_num_constraints: int = 0
__post_init__() → None[source]

Validate and freeze nested opportunity diagnostics.

Raises:
  • TypeError – If a field has the wrong type.

  • ValueError – If a field contains an invalid value.

class SADDReport[source]

Collect ordered opportunity records produced by one SADD pass.

report_type: ClassVar[str] = 'sadd'
method: SADDMethod
opportunities: tuple[SADDOpportunityRecord, ...] = ()
__post_init__() → None[source]

Normalize opportunity records to an immutable tuple.

Raises:

TypeError – If the method or an opportunity has the wrong type.

property sequences: tuple[LocalDDSequence, ...]

Accepted ion-local pulse sequences in opportunity order.

to_dict() → dict[str, object][source]

Return this report using JSON-compatible values.

classmethod from_dict(data: object) → SADDReport[source]

Restore a SADD report from JSON-compatible values.

Returns:

The restored SADD report.

Raises:

ValueError – If the serialized report is malformed.

class SADDResult[source]

Contain a SADD-augmented compilation result and its pass report.

result: CompilationResult
report: SADDReport
unavailable_reason: str | None = None
__post_init__() → None[source]

Validate the transformed result, report, and optional explanation.

Raises:
  • TypeError – If a field has the wrong type.

  • ValueError – If an unavailable reason is empty.

to_dict() → dict[str, object][source]

Return this SADD result using JSON-compatible values.

classmethod from_dict(data: object) → SADDResult[source]

Restore a serialized SADD result.

Returns:

The restored SADD result.

Raises:

ValueError – If the serialized value is malformed.

to_json() → str[source]

Serialize this SADD result as JSON text.

Returns:

The JSON document.

classmethod from_json(raw: str) → SADDResult[source]

Restore a SADD result from JSON text.

Returns:

The restored SADD result.

save(filename: str | Path) → Path[source]

Write this SADD result to an explicit UTF-8 JSON file.

Returns:

The path written.

run_sadd(result: CompilationResult, method: SADDMethod, config: SADDConfig | None = None, *, architecture: LinearArchitecture | None = None) → SADDResult[source]

Apply shuttling-aware dynamical decoupling to a compiled schedule.

Pulse-only and transport-enabled SADD use the same optimization backend; method controls whether the solver may synthesize transport.

Parameters:
  • result – Compilation result to augment.

  • method – SADD method to apply.

  • config – Optional optimization settings.

  • architecture – Optional compatible architecture with added DD capabilities.

Returns:

The transformed compilation result and an ordered SADD report.

Raises:
  • TypeError – If method is not a SADDMethod.

  • ValueError – If the result and architecture are incompatible or the architecture lacks actions required by the selected method.