mqt.ionshuttler.linear.expand¶
Generate and apply the next actions of a Linear schedule.
Module Contents¶
- class GenerationMode[source]¶
Bases:
enum.StrEnumChoose how broadly the compiler looks for its next action.
- FULL = 'full'¶
- INFORMED = 'informed'¶
- UNINFORMED = 'uninformed'¶
- class ExpansionOptions[source]¶
Configure candidate generation for one expansion.
- mode: GenerationMode¶
- transport_timing: TransportTiming¶
- ready_gate_ids(gate_order: Sequence[int], predecessors: PredecessorMap, completed_gates: frozenset[int], in_progress_gates: tuple[tuple[int, int], ...]) list[int][source]¶
Return gates whose dependencies have finished and that have not started.
- generate_actions(state: State, architecture: Architecture, gate_order: Sequence[int], gates: GateMap, *, predecessors: PredecessorMap | None = None, transport_timing: TransportTiming | None = None, action_types: Sequence[type[Action]] | None = None) list[Action][source]¶
Return every action that can start in the current state.
- generate_actions_by_mode(state: State, architecture: Architecture, gate_order: Sequence[int], gates: GateMap, *, predecessors: PredecessorMap | None = None, options: ExpansionOptions | None = None) list[Action][source]¶
Return valid actions from the selected candidate group.
- apply(state: State, architecture: Architecture, action: Action, *, gate_id: int | None = None) State[source]¶
Apply one action and record the selected circuit gate, if any.
- Parameters:
state – State before the action starts.
architecture – Hardware on which the action runs.
action – Action to start.
gate_id – Circuit gate represented by a gate action.
- Returns:
The updated hardware state and circuit progress.
- Raises:
ValueError – If a gate action has no gate identifier.
- expand(state: State, architecture: Architecture, gate_order: Sequence[int], gates: GateMap, *, predecessors: PredecessorMap | None = None, options: ExpansionOptions | None = None) list[ExpandedState][source]¶
Return each valid next action with the state it produces.
- replay_path(initial_state: State, architecture: Architecture, path: Sequence[Action], gate_order: Sequence[int], gates: GateMap, *, predecessors: PredecessorMap | None = None) State[source]¶
Replay a schedule while checking every action before it starts.
- Returns:
The state reached after the final action.
- Raises:
ValueError – If an action is unavailable or cannot be matched to a ready gate.