D-Wave

Contents

D-Wave#

QLauncher is compatible with D-wave backends and many d-wave based algorithms.

Let’s start by defining a problem to be solved, we will use Exact Cover in this tutorial.

from qlauncher.problems import EC

pr = EC.from_preset("default")
pr.visualize()
../_images/6f8ebb8c8ec0870e9c60b02409009f8eba3f8b85416eaab5857e032951e511a3.png

D-wave Solver#

D-wave solver is an algorithm dedicated to work on d-wave computers, let’s initialize it:

from qlauncher.routines.dwave import DwaveSolver

alg = DwaveSolver()

QLauncher features local backends such as SimulatedAnnealingBackend, based on the simulated annealing heuristic algorithm and TabuBackend, based on the Tabu search algorithm. There is also DwaveBackend that connects to a real D-wave computer. Let’s try the simulated annealing backend:

from qlauncher.routines.dwave import SimulatedAnnealingBackend

backend = SimulatedAnnealingBackend()

Now we can use QLauncher to launch D-wave solver on the selected backend:

from qlauncher.launcher import QLauncher

launcher = QLauncher(pr, alg, backend)
result = launcher.run()
result
Result(bitstring=100101, energy=-9.5)

The results correspond to the following matching, since the solver is non-deterministic the result might be suboptimal:

pr.visualize(result.best_bitstring)
../_images/b204339f021f5e854280f2c70b6c3128b63d6ad7e3ef57e5763dd8ea16b97587.png