sn_router#
- iqm.qaoa.transpiler.sn.sn.sn_router(problem_bqm, qpu)[source]#
The function that implements the ‘swap network’ swapping strategies.
Implements approach from [4] adapted for rectangular QPUs, not only square. If the input BQM is not all-to-all connected, dummy interactions (of strength 0) are added to make it all-to-all connected. Tries to find a sufficient rectangle in the provided Crystal QPU (square lattice topology required).
- Parameters:
problem_bqm (BinaryQuadraticModel) – The
BinaryQuadraticModeldescription of the problem, necessary to create an instance ofRouting.qpu (QPU) – The QPU, necessary to create an instance of
Routingand to get the topology of the qubits. Theqpualso needs to contain the layout of the qubits with integer coordinates as an attribute.
- Returns:
A
Routingobject containing the routing created by using swap networks.- Raises:
TypeError – If the QPU’s layout doesn’t have integer coordinates. It is necessary to correctly identify where the swap and interaction gates need to be applied in the swap network approach.
RuntimeError – If the algorithm doesn’t find a sufficiently large rectangle of qubits in the QPU.
- Return type: