qrunch.quantum.circuits.synthesis.layout.simple_sat_layout_synthesizer

Module containing the class for performing layout synthesis using a simple encoding.

Classes

SimpleSatLayoutSynthesizer

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

SimpleSatLayoutSynthesizerCreator

Creator class for creating a simple boolean satisfiability (SAT) layout synthesizer.

SimpleSatLayoutSynthesizerOptions

Options for the simple boolean satisfiability problem-based layout synthesizer.

class SimpleSatLayoutSynthesizer

Bases: LayoutSynthesizer

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

The synthesizer uses a boolean satisfiability problem (SAT) approach with a one way encoding where the order of cnot gates is encoded between the current and previous iteration. Additionally, the encoding is close to minimal and mostly only contains clauses necessary to find the correct solution.

__init__(sat_solver: PySATSolver | None = None, options: SimpleSatLayoutSynthesizerOptions | None = None) None

Initialize the layout synthesizer.

Parameters:
  • sat_solver (PySATSolver | None) – SAT solver for performing the synthesis.

  • options (SimpleSatLayoutSynthesizerOptions | None) – Options for the layout synthesizer. If not provided, default options are used.

Return type:

None

synthesize(circuit: UniversalGateCircuit, device_data: DeviceData) SynthesizedCircuit

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

Parameters:
  • circuit (UniversalGateCircuit) – Circuit to be synthesized.

  • device_data (DeviceData) – Hardware device data including qubit connectivity for the circuit to be mapped to.

Raises:

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

Return type:

SynthesizedCircuit

class SimpleSatLayoutSynthesizerCreator

Bases: object

Creator class for creating a simple boolean satisfiability (SAT) layout synthesizer.

__init__() None

Initialize the creator with default parameters.

Return type:

None

create() SimpleSatLayoutSynthesizer

Create an instance of SimpleSatLayoutSynthesizer.

Return type:

SimpleSatLayoutSynthesizer

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_max_number_of_iterations(max_number_of_iterations: int) Self

Set the settings for the SAT-based simple layout synthesizer.

Parameters:

max_number_of_iterations (int) – Maximum number of iterations for the simple layout synthesizer.

Return type:

Self

with_multiple_swaps_per_iteration(allow: bool) Self

Set whether to allow multiple swaps per iteration in the simple layout synthesizer.

Parameters:

allow (bool) – Whether to allow multiple swaps per iteration in the simple layout synthesizer.

Return type:

Self

class SimpleSatLayoutSynthesizerOptions

Bases: object

Options for the simple boolean satisfiability problem-based layout synthesizer.

Parameters:
  • max_number_of_iterations – Maximum number of iterations allowed in the solution (must be positive).

  • allow_multiple_swaps_per_iteration – Whether multiple swaps can be added per iteration.

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

__init__(*, max_number_of_iterations: int = 20, allow_multiple_swaps_per_iteration: bool = False, exclude_worst_qubits: bool = True) None
Parameters:
  • max_number_of_iterations (int)

  • allow_multiple_swaps_per_iteration (bool)

  • exclude_worst_qubits (bool)

Return type:

None

allow_multiple_swaps_per_iteration: bool = False
exclude_worst_qubits: bool = True
max_number_of_iterations: int = 20