Exemplo n.º 1
0
    def test_passthrough(self):
        samples = [[-1, +1], [+1, -1]]

        sampler = dimod.IdentitySampler()
        sampleset = sampler.sample_ising({}, {(0, 1): 1},
                                         initial_states=samples)

        np.testing.assert_array_equal(sampleset.samples()[:, [0, 1]], samples)
Exemplo n.º 2
0
    def test_passthrough(self):
        samples = [[-1, +1], [+1, -1]]

        sampler = dimod.IdentitySampler()
        sampleset = sampler.sample_ising({}, {(0, 1): 1},
                                         initial_states=samples,
                                         initial_states_generator='tile',
                                         num_reads=10)

        self.assertEqual(len(sampleset), 10)
        np.testing.assert_array_equal(sampleset.samples()[:2, [0, 1]], samples)
Exemplo n.º 3
0
    def test_kwargs(self):
        sampler = dimod.IdentitySampler()
        bqm = dimod.BinaryQuadraticModel({}, {}, 0.0, dimod.SPIN)

        with self.assertWarns(SamplerUnknownArgWarning):
            sampleset = sampler.sample(bqm, a=1, b=4)