qrunch.quantum.circuits.synthesis.layout.simple_sat_layout_synthesizer
Module containing the class for performing layout synthesis using a simple encoding.
Classes
Class for synthesizing circuits to only contain gates which obey a given qubit connection graph. |
|
Creator class for creating a simple boolean satisfiability (SAT) layout synthesizer. |
- class SimpleSatLayoutSynthesizer
Bases:
LayoutSynthesizerClass for synthesizing circuits to only contain gates which obey a given qubit connection graph.
This synthesizer uses 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, *, max_number_of_iterations: int = 10, allow_multiple_swaps_per_iteration: bool = False, exclude_worst_qubits: bool = True) None
Initialize the layout synthesizer with a given qubit connection graph and sat solver.
- Parameters:
sat_solver (PySATSolver | None) – SAT solver for performing the synthesis.
max_number_of_iterations (int) – Maximum number of iterations allowed in the solution. Defaults to 10.
allow_multiple_swaps_per_iteration (bool) – Whether multiple swaps can be added per iteration.
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:
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:
- class SimpleSatLayoutSynthesizerCreator
Bases:
objectCreator 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:
- 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