hardwired_router#
- iqm.qaoa.transpiler.hardwired.hardwired.hardwired_router(problem_bqm, qpu)[source]#
The function that creates an optimal routing for all-to-all connected problems, designed by hand.
The original code was written for hand-picked qubits from the Apollo QPU. When this was expanded to be used on any QPU, the algorithm had to be adjusted. Here is how it works now:
First, the
BinaryQuadraticModel
representation of the problem is padded with extra interactions (of strength 0), to make it trully all-to-all connected.Then, based on the number of variables of the problem, we construct a dummy graph
underlying_graph
which represents the part of the QPU on which the circuit acts.We find a suitable mapping between
underlying_graph
and the QPU graphhardware_graph
. This mappinginverse_iso
is used in theapply_int()
andapply_swap()
method calls.Using the
apply_int()
andapply_swap()
methods, the hardwired routing is constructed.
- Parameters:
problem_bqm (BinaryQuadraticModel) – The
BinaryQuadraticModel
representation of the problem, needed only to instantiate theRouting
.qpu (CrystalQPUFromBackend) – The
CrystalQPUFromBackend
object.
- Returns:
A
Routing
object containing the entire routing schedule.- Raises:
ValueError – If the number of variables of the problem is not between 4 and 15 (inclusive).
- Return type: