98 lines
4.5 KiB
Plaintext
98 lines
4.5 KiB
Plaintext
---
|
||
title: AIRouting (v0.8)
|
||
description: API reference for qiskit_ibm_transpiler.ai.AIRouting in qiskit-ibm-transpiler v0.8
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit_ibm_transpiler.ai.AIRouting
|
||
---
|
||
|
||
# AIRouting
|
||
|
||
<Class id="qiskit_ibm_transpiler.ai.AIRouting" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.8/qiskit_ibm_transpiler/ai/routing.py#L33-L169" signature="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')" modifiers="class">
|
||
Bases: [`TransformationPass`](/api/qiskit/qiskit.transpiler.TransformationPass "(in Qiskit v1.2)")
|
||
|
||
The AIRouting pass acts both as a layout stage and a routing stage.
|
||
|
||
**Parameters**
|
||
|
||
* **backend\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*, optional*) – Name of the backend used for doing the transpilation.
|
||
* **coupling\_map** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")*\[*[*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]], optional*) – A list of pairs that represents physical links between qubits.
|
||
* **optimization\_level** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – 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*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – 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
|
||
|
||
<Function id="qiskit_ibm_transpiler.ai.AIRouting.execute" signature="execute(passmanager_ir, state, callback=None)">
|
||
Execute optimization task for input Qiskit IR.
|
||
|
||
**Parameters**
|
||
|
||
* **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)")) – Qiskit IR to optimize.
|
||
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.2)")) – State associated with workflow execution by the pass manager itself.
|
||
* **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.13)")) – A callback function which is caller per execution of optimization task.
|
||
|
||
**Returns**
|
||
|
||
Optimized Qiskit IR and state of the workflow.
|
||
|
||
**Return type**
|
||
|
||
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)"), [*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.2)")]
|
||
</Function>
|
||
|
||
### name
|
||
|
||
<Function id="qiskit_ibm_transpiler.ai.AIRouting.name" signature="name()">
|
||
Name of the pass.
|
||
|
||
**Return type**
|
||
|
||
[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")
|
||
</Function>
|
||
|
||
### run
|
||
|
||
<Function id="qiskit_ibm_transpiler.ai.AIRouting.run" github="https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.8/qiskit_ibm_transpiler/ai/routing.py#L92-L169" signature="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** –
|
||
</Function>
|
||
|
||
### update\_status
|
||
|
||
<Function id="qiskit_ibm_transpiler.ai.AIRouting.update_status" signature="update_status(state, run_state)">
|
||
Update workflow status.
|
||
|
||
**Parameters**
|
||
|
||
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.2)")) – Pass manager state to update.
|
||
* **run\_state** (*RunState*) – Completion status of current task.
|
||
|
||
**Returns**
|
||
|
||
Updated pass manager state.
|
||
|
||
**Return type**
|
||
|
||
[*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.2)")
|
||
</Function>
|
||
</Class>
|
||
|