AIRouting
class qiskit_ibm_transpiler.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, optional) – Name of the backend used for doing the transpilation.
- coupling_map (list[list[int]], optional) – A list of pairs that represents physical links between qubits.
- optimization_level (int) – 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) – 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.
Attributes
is_analysis_pass
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
is_transformation_pass
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).
Methods
execute
execute(passmanager_ir, state, callback=None)
Execute optimization task for input Qiskit IR.
Parameters
- passmanager_ir (Any) – Qiskit IR to optimize.
- state (PassManagerState) – State associated with workflow execution by the pass manager itself.
- callback (Callable) – A callback function which is caller per execution of optimization task.
Returns
Optimized Qiskit IR and state of the workflow.
Return type
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