dwave-system enables easy incorporation of the D-Wave system as a sampler—the component used to find variable values that minimize the binary quadratic model (BQM) representing a problem—in the typical Ocean problem-solving procedure:
- Formulate the problem as a BQM.
- Solve the BQM with a sampler.
This example solves a small example of a known graph problem, minimum
vertex cover. It uses the NetworkX
graphic package to create the problem, Ocean’s dwave_networkx
to formulate the graph problem as a BQM, and dwave-system’s
DWaveSampler() to use a D-Wave system as the sampler.
(Access to a D-Wave system has been set up in
a configuration file that is used implicitly.) dwave-system’s
EmbeddingComposite() handles mapping between the problem graph
to the D-Wave system’s numerically indexed qubits, a mapping known as minor-embedding.
>>> import networkx as nx >>> import dwave_networkx as dnx >>> from dwave.system.samplers import DWaveSampler >>> from dwave.system.composites import EmbeddingComposite ... >>> s5 = nx.star_graph(4) # a star graph where node 0 is hub to four other nodes >>> sampler = EmbeddingComposite(DWaveSampler()) >>> print(dnx.min_vertex_cover(s5, sampler)) 
Samplers are processes that sample from low energy states of a problem’s objective function. A BQM sampler samples from low energy states in models such as those defined by an Ising equation or a Quadratic Unconstrained Binary Optimization (QUBO) problem and returns an iterable of samples, in order of increasing energy.
Ocean software provides a variety of dimod samplers, which
all support ‘sample_qubo’ and ‘sample_ising’ methods as well as the generic BQM sampler method.
In addition to
DWaveSampler(), classical solvers, which run on CPU or GPU, are available and
useful for developing code or on a small versions of a problem to verify code.
Samplers can be composed. The composite pattern allows layers of pre- and post-processing to be applied to binary quadratic programs without needing to change the underlying sampler implementation. We refer to these layers as composites. A composed sampler includes at least one sampler and possibly many composites.
Using the D-Wave System as a Sampler¶
The dimod API makes it possible to easily interchange samplers in your code. For example, you might develop code using dwave_neal, Ocean’s classical simulated annealing sampler, and then swap in a D-Wave system composed sampler.
Using a D-Wave System explains how you set up access to a D-Wave system.
D-Wave System Documentation describes the D-Wave system, its features, parameters, and properties. The documentation provides guidance on programming the D-Wave system, including how to formulate problems and configure parameters.
Below one example attribute of the D-Wave system is described. For others and further information, see the D-Wave System Documentation.
The D-Wave system is Chimera-structured. The Chimera architecture comprises sets of connected unit cells, each with four horizontal qubits connected to four vertical qubits via couplers (bipartite connectivity). Unit cells are tiled vertically and horizontally with adjacent qubits connected, creating a lattice of sparsely connected qubits. A unit cell is typically rendered as either a cross or a column.
To solve an arbitrarily posed binary quadratic problem on a D-Wave system requires mapping,
called minor embedding, to a Chimera graph that represents the system’s quantum processing unit.
This preprocessing can be done by a composed sampler consisting of the
DWaveSampler() and a composite that performs minor-embedding.
In addition to composites that handle minor-embedding, dwave-system provides the related functionality described in Embedding.