qrunch.quantum.circuits.synthesis.layout.sabre_layout_synthesizer

Module containing the class for performing layout synthesis using Qiskit’s Sabre synthesizer.

Classes

SabreLayoutSynthesizer

Class for synthesizing circuits to only contain gates which obey a given qubit connection graph.

SabreLayoutSynthesizerCreator

Creator class for creating a sabre layout synthesizer.

class SabreLayoutSynthesizer

Bases: LayoutSynthesizer

Class for synthesizing circuits to only contain gates which obey a given qubit connection graph.

This synthesizer uses Qiskit’s Sabre layout synthesizer to perform the layout synthesis.

__init__(*, number_of_tries: int = 10, include_hardware_optimizations: bool = True, exclude_worst_qubits: bool = True) None

Initialize the layout synthesizer with a given qubit connection graph and sat solver.

If hardware optimization is included, the circuits will be post-processed to reduce the number of gates and error using Qiskit’s optimization routines. If hardware optimization is not included, the synthesizer will only use the Sabre layout and swap algorithms. Therefore, the resulting circuit will contain the same gates as the original circuit, but with additional SWAP gates to make the circuit obey the qubit connectivity.

Parameters:
  • number_of_tries (int) – Number of times to try the Sabre algorithm of which the best is picked.

  • include_hardware_optimizations (bool) – Whether to include hardware optimizations during synthesis.

  • exclude_worst_qubits (bool) – Whether to exclude the worst qubits from the device data before synthesis.

Raises:

ValueError – If the maximum allowed number of swap gates is negative.

Return type:

None

synthesize(circuit: UniversalGateCircuit, device_data: DeviceData) LayoutSynthesisResult

Synthesize the circuit to conform to the physical qubit coupling graph of the layout synthesizer.

Parameters:
Raises:

LayoutSynthesizerError – If no solution is found using the maximum allowed number of swap gates.

Return type:

LayoutSynthesisResult

class SabreLayoutSynthesizerCreator

Bases: object

Creator class for creating a sabre layout synthesizer.

__init__() None

Initialize the creator with default parameters.

Return type:

None

create() SabreLayoutSynthesizer

Create an instance of SabreLayoutSynthesizer.

Return type:

SabreLayoutSynthesizer

with_exclude_worst_qubits(exclude: bool) Self

Set whether to exclude the worst qubits from the hardware before layout synthesis.

Parameters:

exclude (bool) – Whether to exclude the worst qubits from the hardware before layout synthesis.

Return type:

Self

with_hardware_optimizations(include: bool) Self

Set whether to include hardware optimizations during synthesis.

Hardware aware optimizations are performed after layout synthesis to reduce gate count and overall error.

Parameters:

include (bool) – Whether to include hardware optimizations during synthesis.

Return type:

Self

with_number_of_tries(number_of_tries: int) Self

Set the number of tries for the Sabre layout synthesizer.

Parameters:

number_of_tries (int) – Number of times to try the Sabre algorithm of which the best is picked. Defaults to 10.

Return type:

Self