diff --git a/docs/composites.rst b/docs/composites.rst index 7290d473..08b721ee 100644 --- a/docs/composites.rst +++ b/docs/composites.rst @@ -202,6 +202,13 @@ Methods LazyFixedEmbeddingComposite.sample_ising LazyFixedEmbeddingComposite.sample_qubo + +ParallelEmbeddingComposite +-------------------------- + +.. autoclass:: ParallelEmbeddingComposite + + TilingComposite --------------- diff --git a/dwave/system/composites/parallel_embeddings.py b/dwave/system/composites/parallel_embeddings.py index 5b1e353f..e09596ff 100644 --- a/dwave/system/composites/parallel_embeddings.py +++ b/dwave/system/composites/parallel_embeddings.py @@ -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) diff --git a/dwave/system/composites/tiling.py b/dwave/system/composites/tiling.py index 05430304..5b547a40 100644 --- a/dwave/system/composites/tiling.py +++ b/dwave/system/composites/tiling.py @@ -27,6 +27,8 @@ for explanations of technical terms in descriptions of Ocean tools. """ +import warnings + import dimod import dwave_networkx as dnx @@ -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 @@ -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} diff --git a/tests/test_parallel_embedding_composite.py b/tests/test_parallel_embedding_composite.py index 1af3cb43..05b99587 100644 --- a/tests/test_parallel_embedding_composite.py +++ b/tests/test_parallel_embedding_composite.py @@ -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