116 lines
5.2 KiB
Plaintext
116 lines
5.2 KiB
Plaintext
---
|
||
title: AIRouting (latest version)
|
||
description: API reference for qiskit_ibm_transpiler.ai.AIRouting in the latest version of qiskit-ibm-transpiler
|
||
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.10/qiskit_ibm_transpiler/ai/routing.py#L101-L304" 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.3)")
|
||
|
||
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.
|
||
|
||
## Attributes
|
||
|
||
### is\_analysis\_pass
|
||
|
||
<Attribute id="qiskit_ibm_transpiler.ai.AIRouting.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.
|
||
</Attribute>
|
||
|
||
### is\_transformation\_pass
|
||
|
||
<Attribute id="qiskit_ibm_transpiler.ai.AIRouting.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).
|
||
</Attribute>
|
||
|
||
## 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.3)")) – 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.3)")]
|
||
</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.10/qiskit_ibm_transpiler/ai/routing.py#L227-L304" 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.3)")) – 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.3)")
|
||
</Function>
|
||
</Class>
|
||
|