def test_unstructured(self): child = dimod.NullSampler() sampler = AutoEmbeddingComposite(child) sampler.sample_ising({}, {(0, 1): -1}) sampler.sample_ising({}, {('a', 0): -1}, embedding_parameters={})
def test_smoke(self): nodelist = [0, 1, 2, 3] edgelist = [(0, 1), (1, 2), (2, 3), (0, 3)] child = dimod.StructureComposite(dimod.NullSampler(), nodelist, edgelist) sampler = AutoEmbeddingComposite(child) sampler.sample_ising({}, {(0, 1): -1}) sampler.sample_ising({}, {('a', 0): -1})
def test_broken_find_embedding(self): nodelist = [0, 1, 2, 3] edgelist = [(0, 1), (1, 2), (2, 3), (0, 3)] child = dimod.StructureComposite(dimod.NullSampler(), nodelist, edgelist) def find_embedding(*args, **kwargs): raise NotImplementedError sampler = AutoEmbeddingComposite(child, find_embedding=find_embedding) sampler.sample_ising({}, {(0, 1): -1}) with self.assertRaises(NotImplementedError): sampler.sample_ising({}, {('a', 0): -1})