D-Wave

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/8ecdbe101986f0f36b23fb83b247b2148a9c86dd51f27b77ec425e6795957c1a.png

D-wave algorithms#

QLauncher features algorithms dedicated to work on D-wave computers such as SimulatedAnnealing, based on the simulated annealing heuristic algorithm and Tabu, based on the Tabu search algorithm. Let’s try the simulated annealing algorithms:

from qlauncher.routines.dwave import SimulatedAnnealing

alg = SimulatedAnnealing()

To run D-wave algorithms you will also need the corresponding 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/cf58fe06e45b83d50f5e14f581508ecdf113740f8ec34e5e29674e177bf10957.png