plasma_route#
Module: iqm.qrisp_iqm.passes.routing
- iqm.qrisp_iqm.passes.routing.plasma_route(connectivity: list[tuple[int, int]], effort: int = 30, C: int | None = None, sections: int = 0, depth_weight: float = 0.0, tempering_range: int = 3, seed: int = 0) Callable[[QuantumCircuit], QuantumCircuit]#
Create a pass that performs routing (SWAP insertion) on the existing layout.
This pass assumes the circuit already has a valid layout and only performs SWAP insertion to make the circuit executable on the given connectivity.
- Parameters:
connectivity (list[tuple[int]]) – The list of edges representing the hardware topology.
effort (int, optional) – Single knob controlling classical compute investment. Higher values explore more routing variants, improving circuit quality at the cost of longer compilation time. Internally this derives the routing diversity multiplier C via
compute_parameters()using the circuit’s 2-qubit gate count. Ignored when C is given explicitly. Default 30.C (int or None, optional) – Override: routing diversity multiplier. Total routing threads =
C * cpu_count. When None (default), derived automatically from effort and the circuit’s 2-qubit gate count.sections (int, optional) –
Number of sections for sectionalized routing.
0(default): Automatic. Section boundaries are placed at structurally meaningful positions (TerminatorNodes in the PermeabilityGraph) with the count derived from circuit depth.1: No sectionalization — compile the circuit in one pass.N > 1: Exactly N sections with boundaries at TerminatorNode positions.
Default is 0.
depth_weight (float, optional) –
Tradeoff between gate count and circuit depth (-1.0 to 1.0).
-1: Optimize purely for gate count (selection_exponent=0, congestion_penalty=0).0(default): Balanced sweet-spot (selection_exponent=0.5, congestion_penalty=0.1).+1: Optimize purely for circuit depth (selection_exponent=1.0, congestion_penalty=0.2).
Internally derives two parameters via linear interpolation:
selection_exponent — geometric-mean exponent for trial selection:
score = swaps^(1-e) * depth^e.congestion_penalty — swap-scoring penalty for congested qubits.
tempering_range (int, optional) – Controls parallel tempering. When > 0, different parallel threads use different greediness values (exploration rates). Default is 3.
seed (int, optional) – Seed for the random number generation used during routing. Each parallel thread and section derives its own seed from this base value, ensuring reproducible results. Default is 0.
- Returns:
A pass function that transforms the circuit.
- Return type:
Callable[[QuantumCircuit], QuantumCircuit]
Example
>>> from qrisp import QuantumCircuit, PassManager >>> from iqm.qrisp_iqm import plasma_route >>> qc = QuantumCircuit(2); qc.cx(0, 1); qc.measure(qc.qubits) >>> pm = PassManager() >>> pm += plasma_route(connectivity=[(0,1), (1,2)]) >>> transpiled_qc = pm.run(qc)