qiskit.transpiler.passes.SabrePreLayout(*args, **kwargs)GitHub(opens in a new tab)
Choose a starting layout to use for additional Sabre layout trials.
An optional list of
Layout objects to use for additional Sabre layout trials.
The pass works by augmenting the coupling map with more and more “extra” edges until VF2 succeeds to find a perfect graph isomorphism. More precisely, the augmented coupling map contains edges between nodes that are within a given distance
d in the original coupling map, and the value of
d is increased until an isomorphism is found.
Intuitively, a better layout involves fewer extra edges. The pass also optionally minimizes the number of extra edges involved in the layout until a local minimum is found. This involves removing extra edges and running VF2 to see if an isomorphism still exists.
directed graph representing the original coupling map or a target modelling the backend (including its connectivity).
the maximum distance to consider for augmented coupling maps.
the error rate to assign to the “extra” edges. A non-zero error rate prioritizes VF2 to choose original edges over extra edges.
specifies the maximum number of VF2 trials. A larger number allows VF2 to explore more layouts, eventually choosing the one with the smallest error rate.
limits each call to VF2 by bounding the number of VF2 state visits.
whether to improve the layout by minimizing the number of extra edges involved. This might be time-consuming as this requires additional VF2 calls.
At runtime, if neither
target are provided.
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.
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).
execute(passmanager_ir, state, callback=None)
Execute optimization task for input Qiskit IR.
- 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.
Optimized Qiskit IR and state of the workflow.
Name of the pass.
Run the SabrePreLayout pass on dag.
The discovered starting layout is written to the property set value
dag (DAGCircuit) – DAG to create starting layout for.
Update workflow status.
- state (PassManagerState) – Pass manager state to update.
- run_state (RunState) – Completion status of current task.
Updated pass manager state.