AIRouting
class qiskit_transpiler_service.ai.AIRouting(backend_name: str | None = None, coupling_map: list[list[int]] | None = None, optimization_level: int = 2, layout_mode: str = 'OPTIMIZE')
Bases: TransformationPass
The AIRouting pass acts both as a layout stage and a routing stage.
Parameters
- backend_name (str(opens in a new tab), optional) – Name of the backend used for doing the transpilation.
- coupling_map (list(opens in a new tab)[list(opens in a new tab)[int(opens in a new tab)]], optional) – A list of pairs that represents physical links between qubits.
- optimization_level (int(opens in a new tab)) – With a range from 1 to 3, determines the computational effort to spend in the process (higher usually gives better results but takes longer), defaults to 2.
- layout_mode (str(opens in a new tab)) – Specifies how to handle the layout selection. There are 3 layout modes: keep (respects the layout set by the previous transpiler passes), improve (uses the layout set by the previous transpiler passes as a starting point) and optimize (ignores previous layout selections), defaults to OPTIMIZE.
Methods
execute
execute(passmanager_ir, state, callback=None)
Execute optimization task for input Qiskit IR.
Parameters
- passmanager_ir (Any(opens in a new tab)) – Qiskit IR to optimize.
- state (PassManagerState) – State associated with workflow execution by the pass manager itself.
- callback (Callable(opens in a new tab) | None) – A callback function which is caller per execution of optimization task.
Returns
Optimized Qiskit IR and state of the workflow.
Return type
tuple(opens in a new tab)[Any(opens in a new tab), PassManagerState]
name
run
run(dag)
Run the AIRouting pass on dag.
Parameters
dag (DAGCircuit) – the directed acyclic graph to be mapped.
Returns
A dag mapped to be compatible with the coupling_map.
Return type
DAGCircuit
Raises
- TranspilerError – if the coupling map or the layout are not
- compatible with the DAG**, or **if the coupling_map=None –
update_status
update_status(state, run_state)
Update workflow status.
Parameters
- state (PassManagerState) – Pass manager state to update.
- run_state (RunState) – Completion status of current task.
Returns
Updated pass manager state.
Return type