Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/composites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ Methods
LazyFixedEmbeddingComposite.sample_ising
LazyFixedEmbeddingComposite.sample_qubo


ParallelEmbeddingComposite
--------------------------

.. autoclass:: ParallelEmbeddingComposite


TilingComposite
---------------

Expand Down
2 changes: 1 addition & 1 deletion dwave/system/composites/parallel_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ParallelEmbeddingComposite(dimod.Composite, dimod.Structured, dimod.Sample
>>> from dwave.system import DWaveSampler
>>> from dwave.system import ParallelEmbeddingComposite
>>> from networkx import from_edgelist
>>> embedder_kwargs = {'max_num_embs': None} # Without this, only 1 embedding will be sought
>>> embedder_kwargs = {'max_num_emb': None} # Without this, only 1 embedding will be sought
>>> source = from_edgelist([('a', 'b')])
>>> qpu = DWaveSampler()
>>> sampler = ParallelEmbeddingComposite(qpu, source=source, embedder_kwargs=embedder_kwargs)
Expand Down
16 changes: 16 additions & 0 deletions dwave/system/composites/tiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
for explanations of technical terms in descriptions of Ocean tools.
"""

import warnings

import dimod
import dwave_networkx as dnx

Expand All @@ -43,6 +45,13 @@ class TilingComposite(dimod.Composite, dimod.Structured, dimod.Sampler):
graph of dimensions ``sub_m``, ``sub_n``, ``t``, or minor-embeddable to
such a graph.

.. deprecated:: 1.32.0
Tiling is generalized in
:class:`~dwave.system.composites.ParallelEmbeddingComposite`
to handle bigger and non-Chimera source graphs on any structured graph
supported by :class:`~dwave.system.samplers.DWaveSampler` (including
Zephyr). ``TilingComposite`` will 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_coordinate`` definition in
Expand Down Expand Up @@ -120,6 +129,13 @@ class TilingComposite(dimod.Composite, dimod.Structured, dimod.Sampler):

def __init__(self, sampler, sub_m, sub_n, t=4):

warnings.warn(
"'TilingComposite' has been deprecated since dwave-system 1.32.0, "
"and will be removed in 2.0. "
"Use 'ParallelEmbeddingComposite' for greater flexibility instead.",
DeprecationWarning, stacklevel=2
)

self.parameters = sampler.parameters.copy()
self.properties = properties = {'child_properties': sampler.properties}

Expand Down
25 changes: 11 additions & 14 deletions tests/test_parallel_embedding_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,17 @@ def test_composite_propagation(self):
"T_family": mock_sampler0.properties["topology"]["type"],
"T_kwargs": {"m": mock_sampler0.properties["topology"]["shape"][0]},
}
try:
sampler = ParallelEmbeddingComposite(
mock_sampler,
source=source,
embedder=embedder,
embedder_kwargs=embedder_kwargs,
)
sampleset = sampler.sample_ising({}, J, num_reads=1)
self.assertGreater(
len(sampleset), 1
) # Equal to the number of parallel embeddings
except:
print('Test is skipped for now, relies on incomplete pull request:'
'https://github.com/jackraymond/minorminer/tree/parallel_embeddings')
sampler = ParallelEmbeddingComposite(
mock_sampler,
source=source,
embedder=embedder,
embedder_kwargs=embedder_kwargs,
)
sampleset = sampler.sample_ising({}, J, num_reads=1)
self.assertGreater(
len(sampleset), 1
) # Equal to the number of parallel embeddings


class TestTiling(unittest.TestCase):
"""Testing for purposes of TilingComposite deprecation. See also testing of
Expand Down