Samplers and Composites¶
Samplers¶
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.
Hybrid QuantumClassical Samplers¶
Quantumclassical hybrid is the use of both classical and quantum resources to solve problems, exploiting the complementary strengths that each provides.
DWave’s Leap Quantum Application Environment provides stateoftheart hybrid solvers you can submit arbitrary BQMs to. dwavehybrid provides you with a Python framework for building a variety of flexible hybrid workflows that use quantum and classical resources together to find good solutions to your problem.
Solvers¶
Ocean software provides quantum, classical, and quantumclassical hybrid samplers that run either remotely (for example, in DWave’s Leap environment) or locally on your CPU. These compute resources are known as solvers.
Note
Some classical samplers actually bruteforce solve small problems rather than sample, and these are also referred to as “solvers”.
Composites¶
Samplers can be composed. The composite pattern allows layers of pre and postprocessing 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.
Examples of composites are EmbeddingComposite()
,
which handle the mapping known as minorembedding,
and RoofDualityComposite()
, which
uses roof duality to assign
some variables as a preprocessing step before submitting the problem for sampling.
The use of samplers in solving problems is described in the following documentation:

Describes the available types of samplers in Ocean and their use in solving BQMs.