qrunch.quantum.circuits.synthesis.layout.qubit_dependent_synthesizer
A layout synthesizer that chooses between different layout synthesis strategies based on the number of qubits in the circuit.
Classes
A layout synthesizer that chooses between different layout synthesis strategies based on the number of qubits in the circuit. |
|
Creator class for creating a qubit-dependent layout synthesizer. |
- class QubitDependentLayoutSynthesizer
Bases:
LayoutSynthesizerA layout synthesizer that chooses between different layout synthesis strategies based on the number of qubits in the circuit.
This synthesizer uses a simple SAT-based layout synthesizer for circuits with a number of qubits less than or equal to a specified threshold. For circuits with a number of qubits exceeding this threshold, it employs the Sabre layout synthesizer. This approach allows for efficient layout synthesis by leveraging the strengths of both methods depending on the circuit size.
- __init__(*, max_sat_synthesizer_qubits: int = 10, sat_synthesizer_timeout: int = 60, max_number_of_sat_iterations: int = 20, allow_multiple_swaps_per_iteration: bool = False, number_of_sabre_tries: int = 10, sat_exclude_worst_qubits: bool = True, sabre_exclude_worst_qubits: bool = True, include_hardware_optimizations: bool = True) None
Initialize the layout synthesizer with a given qubit connection graph and sat solver.
- Parameters:
max_sat_synthesizer_qubits (int) – Maximum number of qubits for which to use the simple layout synthesizer.
sat_synthesizer_timeout (int) – Timeout for the SimpleLayoutSynthesizer in seconds. Will fall back to the Sabre synthesizer if timeout is reached.
max_number_of_sat_iterations (int) – Maximum number of iterations for the simple layout synthesizer.
allow_multiple_swaps_per_iteration (bool) – Whether to allow multiple swaps per iteration in the simple layout synthesizer.
number_of_sabre_tries (int) – Number of times to try the Sabre algorithm of which the best is picked.
sat_exclude_worst_qubits (bool) – Whether to exclude the worst qubits from the SAT layout synthesizer.
sabre_exclude_worst_qubits (bool) – Whether to exclude the worst qubits from the Sabre layout synthesizer.
include_hardware_optimizations (bool) – Whether to include hardware optimizations during synthesis for Sab.
- Raises:
ValueError – If the maximum allowed number of swap gates is negative.
- Return type:
None
- synthesize(circuit: UniversalGateCircuit, device_data: DeviceData) LayoutSynthesisResult
Synthesize the given circuit into a new circuit and an initial and final logical-physical qubit maps.
- Parameters:
circuit (UniversalGateCircuit) – Circuit to be synthesized.
device_data (DeviceData) – Device data containing qubit connectivity information.
- Return type:
- class QubitDependentLayoutSynthesizerCreator
Bases:
objectCreator class for creating a qubit-dependent layout synthesizer.
- __init__() None
Initialize the creator with default parameters.
- Return type:
None
- create() QubitDependentLayoutSynthesizer
Create an instance of
QubitDependentLayoutSynthesizer.- Return type:
- with_max_sat_synthesizer_qubits(max_sat_synthesizer_qubits: int) Self
Set the maximum number of qubits for which to use the simple layout synthesizer.
Will use the sabre layout synthesizer for circuits with a number of qubits exceeding this threshold.
- Parameters:
max_sat_synthesizer_qubits (int) – Maximum number of qubits for which to use the simple layout synthesizer.
- Return type:
Self
- with_sabre_synthesizer_settings(number_of_tries: int = 10, *, exclude_worst_qubits: bool = True, include_hardware_optimizations: bool = True) Self
Set the settings 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.
exclude_worst_qubits (bool) – Whether to exclude the worst qubits from the hardware before layout synthesis.
include_hardware_optimizations (bool) – Whether to include hardware optimizations during synthesis.
- Return type:
Self
- with_sat_synthesizer_timeout(sat_synthesizer_timeout: int) Self
Set the timeout for the SimpleLayoutSynthesizer.
Will fall back to the Sabre synthesizer if the timeout is reached.
- Parameters:
sat_synthesizer_timeout (int) – Timeout for the SimpleLayoutSynthesizer in seconds. Will fall back to the Sabre synthesizer if timeout is reached.
- Return type:
Self
- with_simple_synthesizer_settings(*, max_number_of_iterations: int = 20, allow_multiple_swaps_per_iteration: bool = False, exclude_worst_qubits: bool = True) 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. Defaults to 20.
allow_multiple_swaps_per_iteration (bool) – Whether to allow multiple swaps per iteration in the simple layout synthesizer. Defaults to False.
exclude_worst_qubits (bool) – Whether to exclude the worst qubits from the hardware before layout synthesis.
- Return type:
Self