Composites#
dimod composites that provide layers of pre- and post-processing (e.g., minor-embedding) when using D-Wave quantum computers.
Other Ocean packages provide additional composites; for example:
dimod provides composites that operate on the problem (e.g., scaling values), track inputs and outputs for debugging, and other useful functionality relevant to generic samplers.
dwave-preprocessing provides composites that clip, fix, and scale variables and apply spin-reversal transforms.
CutOffs#
Prunes a binary quadratic model (BQM) or binary polynomial submitted to the child sampler by retaining only interactions with values commensurate with the sampler’s precision (i.e., removing any interactions below a cutoff value). Isolated variables are then also removed.
CutOffComposite#
- class CutOffComposite(child_sampler, cutoff, cutoff_vartype=Vartype.SPIN, comparison=<built-in function lt>)[source]#
Bases:
ComposedSamplerRemoves interactions below a specified cutoff value.
Prunes the binary quadratic model (BQM) submitted to the child sampler by retaining only interactions with values commensurate with the sampler’s precision, as specified by the
cutoffargument. Also removes variables isolated post- or pre-removal of these interactions from the BQM passed on to the child sampler, setting these variables to values that minimize the original BQM’s energy for the returned samples.- Parameters:
sampler (
dimod.Sampler) – A dimod sampler.cutoff (number) – Lower bound for absolute value of interactions. Interactions with absolute values lower than
cutoffare removed. Isolated variables are also not passed on to the child sampler.cutoff_vartype (
dimod.Vartype/str/set, default=’SPIN’) –Variable space to execute the removal in. Accepted input values:
comparison (function, optional) – A comparison operator for comparing interaction values to the cutoff value. Defaults to
operator.lt().
Added in version 1.30.0: Support for context manager protocol with
dimod.Scopedimplemented.Examples
This example removes one interaction,
('a', 'c'): -0.7, before minor-embedding on a D-Wave quantum computer. Note that the lowest-energy sample for the embedded problem remains{'a': 1, 'b': -1, 'c': -1}, and this solution is found. The sample is attributed the energy appropriate to the BQM without thresholding.>>> import dimod ... >>> bqm = dimod.BinaryQuadraticModel( ... {'a': -1, 'b': 1, 'c': 1}, ... {('a', 'b'): 0.8, ('a', 'c'): 0.7, ('b', 'c'): -1}, ... 0, ... dimod.SPIN) >>> with DWaveSampler() as sampler: ... sampleset = CutOffComposite(AutoEmbeddingComposite( ... sampler), 0.75).sample(bqm, num_reads=1000) >>> print(sampleset.first.energy) -5.5
Properties#
Child samplers that are used by this composite. |
|
Supported parameters. |
|
Properties of the child sampler. |
See also inherited properties of the
cutoffcomposite class.
Methods#
|
Cut off interactions and sample from the provided binary quadratic model. |
See also inherited methods of the
cutoffcomposite class.
PolyCutOffComposite#
- class PolyCutOffComposite(child_sampler, cutoff, cutoff_vartype=Vartype.SPIN, comparison=<built-in function lt>)[source]#
Bases:
ComposedPolySamplerRemoves polynomial interactions below a specified cutoff value.
Prunes the binary polynomial submitted to the child sampler by retaining only interactions with values commensurate with the sampler’s precision, as specified by the
cutoffargument. Also removes variables isolated post- or pre-removal of these interactions from the polynomial passed on to the child sampler, setting these variables to values that minimize the original polynomial’s energy for the returned samples.- Parameters:
sampler (
dimod.PolySampler) – A dimod binary polynomial sampler.cutoff (number) – Lower bound for absolute value of interactions. Interactions with absolute values lower than
cutoffare removed. Isolated variables are also not passed on to the child sampler.cutoff_vartype (
dimod.Vartype/str/set, default=’SPIN’) –Variable space to do the cutoff in. Accepted input values:
comparison (function, optional) – A comparison operator for comparing the interaction value to the cutoff value. Defaults to
operator.lt().
Added in version 1.30.0: Support for context manager protocol with
dimod.Scopedimplemented.Examples
This example removes one interaction,
('a', 'c'): 0.2, before submitting the polynomial to the child samplerExactSolver.>>> import dimod ... >>> poly = dimod.BinaryPolynomial( ... {'a': 3, ('a', 'b', 'c'):-4, ('a', 'c'): 0.2}, dimod.SPIN) >>> with dimod.HigherOrderComposite(dimod.ExactSolver()) as sampler: ... sampleset = PolyCutOffComposite(sampler, 1).sample_poly(poly) >>> print(sampleset.first.sample['a']) -1
Properties#
Child samplers that are used by this composite. |
|
Supported parameters. |
|
Properties of the child sampler. |
See also inherited properties of the
PolyCutOffComposite class.
Methods#
|
Cutoff and sample from the provided binary polynomial. |
See also inherited methods of the
PolyCutOffComposite class.
Embedding#
Minor-embed a problem BQM into a D-Wave system.
Composites for minor-embedding a problem BQM into a D-Wave quantum computer. For example:
EmbeddingCompositefor a problem with arbitrary structure that likely requires heuristic embedding.AutoEmbeddingCompositecan save unnecessary embedding for problems that might have a structure similar to the child sampler.LazyFixedEmbeddingCompositecan benefit applications that resubmit a BQM with changes in some values.
AutoEmbeddingComposite#
- class AutoEmbeddingComposite(child_sampler, **kwargs)[source]#
Bases:
EmbeddingCompositeMaps problems to a structured sampler, embedding if needed.
This composite first tries to submit the binary quadratic model directly to the child sampler and only embeds if a
BinaryQuadraticModelStructureErrorexception is raised.- Parameters:
child_sampler (
dimod.Sampler) – A dimod structured sampler, such as aDWaveSampler().find_embedding (function, optional) – A function
find_embedding(S, T, **kwargs)whereSandTare edgelists. The function can accept additional keyword arguments. Defaults tominorminer.find_embedding().kwargs – See the
EmbeddingCompositeclass for additional keyword arguments.
Added in version 1.30.0: Support for context manager protocol with
dimod.Scoped()implemented.
Methods#
|
Sample from the provided binary quadratic model. |
See also inherited properties and methods of the
AutoEmbeddingComposite class.
EmbeddingComposite#
- class EmbeddingComposite(child_sampler, find_embedding=<function find_embedding>, embedding_parameters=None, scale_aware=False, child_structure_search=<function child_structure_dfs>)[source]#
Bases:
ComposedSamplerMaps problems to a structured sampler.
Automatically minor embeds a problem into a structured sampler such as a D-Wave quantum computer. A new minor-embedding is calculated each time one of its sampling methods is called.
If a native embedding is found (one to one mapping between source and target variables), embedding and unembedding steps are simplified as they are reduced to variable relabeling.
- Parameters:
child_sampler (
dimod.Sampler) – A dimod sampler, such as aDWaveSampler, that accepts only a binary quadratic model of a particular structure.find_embedding (function, optional) – A function
find_embedding(S, T, **kwargs)whereSandTare edge lists. The function can accept additional keyword arguments. Defaults tominorminer.find_embedding().embedding_parameters (dict, optional) – If provided, parameters are passed to the embedding method as keyword arguments. Overridden by any parameters passed to the sampling method.
scale_aware (bool, optional, default=False) – Pass chain interactions to child samplers that accept an
ignored_interactionsparameter.child_structure_search (function, optional) – A function that accepts a sampler and returns the
structureattribute. Defaults tochild_structure_dfs().
Added in version 1.30.0: Support for context manager protocol with
dimod.Scopedimplemented.Changed in version 1.33.0: For native embeddings, chain strength is not calculated anymore, and chain break resolution method is ignored (both
chain_strengthandchain_break_methodare set toNonein the returnedembedding_context).Examples
>>> from dwave.system import DWaveSampler, EmbeddingComposite ... >>> with EmbeddingComposite(DWaveSampler()) as sampler: ... h = {'a': -1., 'b': 2} ... J = {('a', 'b'): 1.5} ... sampleset = sampler.sample_ising(h, J, num_reads=100) ... print(sampleset.first.energy) -4.5
Properties#
List containing the structured sampler. |
|
Supported parameters. |
|
Properties of the child sampler. |
|
Defines the default behavior for returning embeddings. |
|
Defines the default behavior for warnings. |
See also inherited properties of the
EmbeddingComposite class.
Methods#
|
Sample from the provided binary quadratic model. |
See also inherited methods of the
EmbeddingComposite class.
FixedEmbeddingComposite#
- class FixedEmbeddingComposite(child_sampler, embedding=None, source_adjacency=None, **kwargs)[source]#
Bases:
LazyFixedEmbeddingCompositeMaps problems to a structured sampler with the specified minor-embedding.
- Parameters:
child_sampler (dimod.Sampler) – A dimod structured sampler such as a D-Wave quantum computer.
embedding (dict[hashable, iterable], optional) – Mapping from a source graph to the specified sampler’s graph (the target graph).
source_adjacency (dict[hashable, iterable]) – Deprecated. Dictionary to describe source graph as
{node: {node neighbours}}.kwargs – See the
EmbeddingCompositeclass for additional keyword arguments. Note thatfind_embeddingandembedding_parameterskeyword arguments are ignored.
Added in version 1.30.0: Support for context manager protocol with
dimod.Scopedimplemented.Examples
To embed a triangular problem (a problem with a three-node complete graph, or clique) in the Chimera topology, you need to chain two qubits. This example maps triangular problems to a composed sampler (based on the unstructured
ExactSolver) with a Chimera unit-cell structure.>>> import dimod >>> import dwave.graphs >>> from dwave.system import FixedEmbeddingComposite ... >>> c1 = dwave.graphs.chimera_graph(1) >>> embedding = {'a': [0, 4], 'b': [1], 'c': [5]} >>> structured_sampler = dimod.StructureComposite(dimod.ExactSolver(), ... c1.nodes, c1.edges) >>> with FixedEmbeddingComposite(structured_sampler, embedding) as sampler: ... print(sampler.edgelist) [('a', 'b'), ('a', 'c'), ('b', 'c')]
See also inherited properties and methods of the
FixedEmbeddingComposite class.
LazyFixedEmbeddingComposite#
- class LazyFixedEmbeddingComposite(child_sampler, find_embedding=<function find_embedding>, embedding_parameters=None, scale_aware=False, child_structure_search=<function child_structure_dfs>)[source]#
Bases:
EmbeddingComposite,StructuredMaps problems to the structure of its first given problem.
This composite reuses the minor-embedding found for its first given problem without recalculating a new minor-embedding for subsequent calls of its sampling methods.
- Parameters:
child_sampler (dimod.Sampler) – A dimod structured sampler such as a D-Wave quantum computer.
find_embedding (function, default=
minorminer.find_embedding()) – A functionfind_embedding(S, T, **kwargs), whereSandTare edge lists, used to find the embedding for the first problem solved. It can accept additional keyword arguments.embedding_parameters (dict, optional) – If provided, parameters are passed to the embedding method as keyword arguments. Overridden by any parameters passed to the sampling method.
Added in version 1.30.0: Support for context manager protocol with
dimod.Scopedimplemented.Examples
>>> from dwave.system import LazyFixedEmbeddingComposite, DWaveSampler ... >>> with LazyFixedEmbeddingComposite(DWaveSampler()) as sampler: ... print(sampler.nodelist is None) # no structure prior to first sampling ... __ = sampler.sample_ising({}, {('a', 'b'): -1}) ... print(sampler.nodelist) # has structure based on given problem True ['a', 'b']
Properties#
Adjacency structure for the composed sampler. |
|
Edges available to the composed sampler. |
|
Embedding used to map binary quadratic models to the child sampler. |
|
Nodes available to the composed sampler. |
See also inherited properties of the
LazyFixedEmbeddingComposite class.
Methods#
|
Sample the binary quadratic model. |
See also inherited methods of the
LazyFixedEmbeddingComposite class.
ParallelEmbeddingComposite#
- class ParallelEmbeddingComposite(child_sampler, *, embeddings=None, source=None, embedder=None, embedder_kwargs=None, one_to_iterable=False, child_structure_search=<function child_structure_dfs>, child_property_search=<function _child_property_dfs>)[source]#
Bases:
Composite,Structured,SamplerParallelizes sampling of a small problem on a structured sampler.
Enables parallel sampling on a (target) sampler, such as a quantum computer, by use of multiple disjoint embeddings.
If you do not provide a list of embeddings, the function
find_multiple_embeddings(), called by default, attempts a maximum number of embeddings. If the target and source graphs match QPU architecture (e.g., Zephyr topology), the tiling of a known embedding in a regular pattern, such as implemented by thefind_sublattice_embeddings(), may be a useful embedding strategy. For example, if an embedding can be found for a Chimera tile, you can try an embedding of multiple displacements on a target QPU graph (“tiling”), and if all nodes on the Chimera tile are used, and the target graph is defect free, this achieves optimal parallelization. See the examples below and minorminer for information and example use cases.Embeddings, particularly for large subgraphs of large target graphs, can be difficult to find; the defaults of this composite may be slow. However, for QPU samplers, parallelization of job submissions may compensate for programming and readout times and network latency.
- Parameters:
child_sampler (
Sampler) – dimod structured sampler such as aDWaveSampler.embeddings (list, optional) – A list of embeddings. Each embedding is assumed to be a dictionary with source-graph nodes as keys and iterables of target-graph nodes as values. The embeddings can include keys not required by the source graph. Note that
one_to_iterableis ignored (assumed True).source (
NetworkX Graph, optional) – A source graph must be provided ifembeddingsis not specified. This source graph’s nodes should be supported by every embedding.embedder (Callable, optional) – A function that returns embeddings when not provided. Its first two arguments are assumed to be the source and target graphs.
embedder_kwargs (dict, optional) – keyword arguments for the
embedderfunction. The default is an empty dictionary.one_to_iterable (bool, default=False) –
Defines the value type returned by the
embedderfunction:False: The values in every dictionary are target nodes (defining a subgraph embedding). The composite transforms these to tuples for compatibility with the
embed_bqm()andunembed_sampleset()functions.True: The values are iterables over target nodes and no transformation is required.
child_structure_search (function, optional) – A function that accepts a sampler and returns the
structureattribute. Defaults to thechild_structure_dfs()function.
- Raises:
ValueError – for any of the following conditions:
child_sampleris not structured, and the structure cannot be inferred fromchild_structure_search; neitherembeddingsnorsourceare provided;embeddingsprovided is an empty list, or no embeddings are found;embeddingsandsourcenodes are inconsistent;embeddingsand target graph nodes are inconsistent.
Examples
This example submits a simple Ising problem of just two variables to a quantum computer. The default subgraph embedder, the
find_multiple_embeddings()function, is used to find a maximum number of embeddings. Note that searching for O(1000) of embeddings takes several seconds.>>> from dwave.system import DWaveSampler >>> from dwave.system import ParallelEmbeddingComposite >>> from networkx import from_edgelist ... >>> embedder_kwargs = {'max_num_emb': None} # Without this, only 1 embedding is sought >>> source = from_edgelist([('a', 'b')]) >>> with DWaveSampler() as qpu: ... sampler = ParallelEmbeddingComposite(qpu, source=source, embedder_kwargs=embedder_kwargs) ... sampleset = sampler.sample_ising({},{('a', 'b'): 1}, num_reads=1) >>> len(sampleset) > 1 # Equal to the number of parallel embeddings True
Where source and target graphs have a special QPU lattice relationship it’s possible to find an optimal parallelization through displacement. Note that finding a large set of disjoint chimera cells within a typical QPU graph can take several seconds.
>>> from dwave.system import DWaveSampler >>> from dwave.system import ParallelEmbeddingComposite >>> from dwave.graphs import chimera_graph >>> from minorminer.utils.parallel_embeddings import find_sublattice_embeddings ... >>> source = tile = chimera_graph(1, 1, 4) # A 1:1 mapping assumed >>> J = {e: -1 for e in tile.edges} # A ferromagnet on the Chimera tile. >>> with DWaveSampler() as qpu: ... embedder = find_sublattice_embeddings ... embedder_kwargs = {'max_num_emb': None, 'tile': tile} ... sampler = ParallelEmbeddingComposite( ... qpu, ... source=source, ... embedder=embedder, ... embedder_kwargs=embedder_kwargs) ... sampleset = sampler.sample_ising({}, J, num_reads=1) >>> len(sampleset) > 1 # Equal to the number of parallel embeddings True
See also
The
draw_parallel_embeddings()function to visualize found embeddings.
Properties#
List containing the structured sampler |
|
Edges of the structured sampler available to the composed sampler. |
|
Embeddings into each available tile on the structured solver. |
|
Nodes of the structured sampler available to the composed sampler. |
|
Number of embeddings available for replicating the problem. |
|
Supported parameters. |
|
Supported properties. |
See also inherited properties of the
ParallelEmbeddingComposite class.
Methods#
|
Sample from the specified binary quadratic model. |
Sample from the specified binary quadratic models. |
See also inherited methods of the
ParallelEmbeddingComposite class.
TilingComposite#
- class TilingComposite(sampler, sub_m, sub_n, t=4)[source]#
Bases:
Composite,Structured,SamplerComposite to tile a small problem across a structured sampler.
Enables parallel sampling on Chimera or Pegasus structured samplers of small problems. The small problem should be defined on a Chimera graph of dimensions
sub_m,sub_n,t, or minor-embeddable to such a graph.Deprecated since version 1.32.0: Tiling is generalized in
ParallelEmbeddingCompositeto handle bigger and non-Chimera source graphs on any structured graph supported byDWaveSampler(including Zephyr).TilingCompositewill be removed in dwave-system 2.0.Notation PN referes to a Pegasus graph consisting of a 3x(N-1)x(N-1) grid of cells, where each unit cell is a bipartite graph with shore of size t, supplemented with odd couplers (see
nice_coordinatedefinition in thepegasus_graph()function). The Advantage QPU supports a P16 Pegasus graph: its qubits may be mapped to a 3x15x15 matrix of unit cells, each of 8 qubits. This code supports tiling of Chimera-structured problems, with an option of additional odd-couplers, onto Pegasus. See also thepegasus_graph()function.Notation CN refers to a Chimera graph consisting of an NxN grid of unit cells, where each unit cell is a bipartite graph with shores of size t. (An earlier quantum computer, the D-Wave 2000Q, supported a C16 Chimera graph: its 2048 qubits were logically mapped into a 16x16 matrix of unit cells of 8 qubits (t=4). See also the
chimera_graph()function.)A problem that can be minor-embedded in a single chimera unit cell, for example, can therefore be tiled as 3x15x15 duplicates across an Advantage QPU (or, previously, over the unit cells of a D-Wave 2000Q as 16x16 duplicates), subject to solver yield. This enables over 600 (256 for the D-Wave 2000Q) parallel samples per read.
- Parameters:
sampler (
Sampler) – Structured dimod sampler such as aDWaveSampler.sub_m (int) – Minimum number of Chimera unit cell rows required for minor-embedding a single instance of the problem.
sub_n (int) – Minimum number of Chimera unit cell columns required for minor-embedding a single instance of the problem.
t (int, optional, default=4) – Size of the shore within each Chimera unit cell.
Added in version 1.30.0: Support for context manager protocol with
dimod.Scoped()implemented.Examples
This example submits a two-variable QUBO problem representing a logical NOT gate to a D-Wave system. The QUBO—two nodes with biases of -1 that are coupled with strength 2—needs only any two coupled qubits and so is easily minor-embedded in a single unit cell. Composite
TilingCompositetiles it multiple times for parallel solution: the two nodes should typically have opposite values.>>> from dwave.system import DWaveSampler, EmbeddingComposite >>> from dwave.system import TilingComposite ... >>> sampler = EmbeddingComposite(TilingComposite(DWaveSampler(), 1, 1, 4)) >>> Q = {(1, 1): -1, (1, 2): 2, (2, 1): 0, (2, 2): -1} >>> sampleset = sampler.sample_qubo(Q) >>> len(sampleset)> 1 True
See the Concepts section for explanations of technical terms in descriptions of Ocean tools.
Properties#
The single wrapped structured sampler. |
|
List of active couplers for the structured solver. |
|
Embeddings into each available tile on the structured solver. |
|
List of active qubits for the structured solver. |
|
Number of tiles available for replicating the problem. |
|
Parameters in the form of a dict. |
|
Properties in the form of a dict. |
Methods#
|
Sample from the specified binary quadratic model. |
VirtualGraphComposite#
- class VirtualGraphComposite(sampler, embedding, chain_strength=None, **kwargs)[source]#
Bases:
FixedEmbeddingCompositeRemoved. Used to provide access to the D-Wave virtual graph feature for minor-embedding, but now is just a thin wrapper around the
FixedEmbeddingComposite.Deprecated since version 1.25.0: This class is deprecated due to improved calibration of newer QPUs and will be removed in 1.27.0; to calibrate chains for residual biases, follow the instructions in the shimming tutorial.
Removed in version 1.28.0: This class is now only a pass-through wrapper around the
FixedEmbeddingComposite.It will be completely removed in dwave-system 2.0.
For removal reasons and alternatives, see the deprecation note above.
Methods#
|
Sample the binary quadratic model. |
Linear Bias#
Composite for implementing linear coefficients with auxiliary qubits biased with flux-bias offsets.
Using flux-bias offsets to implement linear biases might be used, for example, in the fast-anneal protocol, as described in the Emulate Linear Biases with Flux-Bias Offsets section.
LinearAncillaComposite#
- class LinearAncillaComposite(child_sampler: Sampler)[source]#
Bases:
ComposedSampler,StructuredImplements linear biases as ancilla qubits polarized with strong flux biases.
Linear bias \(h_i\) of qubit \(i\) is implemented through a coupling \(J_{ij}\) between the qubit and a neighboring qubit \(j\) that has a large flux-bias offset.
- Parameters:
child_sampler (
dimod.Sampler) – A dimod sampler, such as aDWaveSampler(), that has flux-bias controls.
Added in version 1.30.0: Support for context manager protocol with
dimod.Scopedimplemented.Examples
This example submits a two-qubit problem consisting of linear biases with opposed signs and anti-ferromagnetic coupling. A D-Wave quantum computer solves it with the fast-anneal protocol using ancilla qubits to represent the linear biases.
>>> from dwave.system import DWaveSampler, EmbeddingComposite, LinearAncillaComposite ... >>> with EmbeddingComposite(LinearAncillaComposite(DWaveSampler())) as sampler: ... sampleset = sampler.sample_ising({0:1, 1:-1}, {(0, 1): 1}, fast_anneal=True) ... sampleset.first.energy -3
Properties#
List containing the structured sampler. |
|
Parameters in the form of a dict. |
|
Properties in the form of a dict. |
Methods#
|
Sample from the provided binary quadratic model. |
Reverse Anneal#
Composites that do batch operations for reverse annealing based on sets of initial states or anneal schedules.
ReverseBatchStatesComposite#
- class ReverseBatchStatesComposite(child_sampler)[source]#
Bases:
ComposedSampler,InitializedReverse anneals from multiple initial samples.
Submissions are independent from one another.
- Parameters:
sampler (
Sampler) – A dimod sampler.
Added in version 1.30.0: Support for context manager protocol with
dimod.Scopedimplemented.Examples
This example runs three reverse anneals from two configured and one randomly generated initial states on a problem constructed by setting random \(\pm 1\) values on a clique (complete graph) of 15 nodes, minor-embedded on a D-Wave quantum computer using the
DWaveCliqueSamplersampler.>>> import dimod >>> from dwave.system import DWaveCliqueSampler, ReverseBatchStatesComposite ... >>> schedule = [[0.0, 1.0], [10.0, 0.5], [20, 1.0]] >>> bqm = dimod.generators.ran_r(1, 15) >>> init_samples = [{i: -1 for i in range(15)}, {i: 1 for i in range(15)}] ... >>> with DWaveCliqueSampler() as sampler: ... sampler_reverse = ReverseBatchStatesComposite(sampler) ... sampleset = sampler_reverse.sample( ... bqm, ... anneal_schedule=schedule, ... initial_states=init_samples, ... num_reads=3, ... reinitialize_state=True)
Properties#
Child samplers that are used by this composite. |
|
Supported parameters. |
|
Properties of the child sampler. |
Methods#
|
Sample the binary quadratic model using reverse annealing from multiple initial states. |
ReverseAdvanceComposite#
- class ReverseAdvanceComposite(child_sampler)[source]#
Bases:
ComposedSamplerReverse anneals an initial sample through a sequence of anneal schedules.
The first submission uses your provided initial sample, or, if unspecified, generates a random sample. Each subsequent submission selects as its initial state one of the following samples:
The most-found lowest-energy sample (
reinitialize_state = True, the default).The last returned sample, making each submission behave as a random walk (
reinitialize_state = False).
- Parameters:
sampler (
dimod.Sampler) – A dimod sampler.
Added in version 1.30.0: Support for context manager protocol with
dimod.Scopedimplemented.Examples
This example runs 100 reverse anneals each for three schedules on a problem constructed by setting random \(\pm 1\) values on a clique (complete graph) of 15 nodes, minor-embedded on a D-Wave quantum computer using the
DWaveCliqueSamplersampler.>>> import dimod >>> from dwave.system import DWaveCliqueSampler, ReverseAdvanceComposite ... >>> schedule = [[[0.0, 1.0], [t, 0.5], [20, 1.0]] for t in (5, 10, 15)] >>> bqm = dimod.generators.ran_r(1, 15) >>> init_samples = {i: -1 for i in range(15)} ... >>> with DWaveCliqueSampler() as sampler: ... sampler_reverse = ReverseAdvanceComposite(sampler) ... sampleset = sampler_reverse.sample( ... bqm, ... anneal_schedules=schedule, ... initial_state=init_samples, ... num_reads=100, ... reinitialize_state=True)
Properties#
Child samplers that are used by this composite. |
|
Supported parameters. |
|
Properties of the child sampler. |
Methods#
|
Sample the binary quadratic model using reverse annealing. |