Simulated Annealing Sampler

A dimod sampler that uses the simulated annealing algorithm.

Class

class SimulatedAnnealingSampler[source]

Simulated annealing sampler.

Also aliased as Neal.

Examples

This example solves a simple Ising problem.

>>> import neal
>>> sampler = neal.SimulatedAnnealingSampler()
>>> h = {'a': 0.0, 'b': 0.0, 'c': 0.0}
>>> J = {('a', 'b'): 1.0, ('b', 'c'): 1.0, ('a', 'c'): 1.0}
>>> response = sampler.sample_ising(h, J)
>>> for sample in response:  # doctest: +SKIP
...     print(sample)
... {'a': -1, 'b': 1, 'c': -1}
... {'a': -1, 'b': 1, 'c': 1}
... {'a': 1, 'b': 1, 'c': -1}
... {'a': 1, 'b': -1, 'c': -1}
... {'a': 1, 'b': -1, 'c': -1}
... {'a': 1, 'b': -1, 'c': -1}
... {'a': -1, 'b': 1, 'c': 1}
... {'a': 1, 'b': 1, 'c': -1}
... {'a': -1, 'b': -1, 'c': 1}
... {'a': -1, 'b': 1, 'c': 1}

Sampler Properties

SimulatedAnnealingSampler.properties A dict containing any additional information about the sampler.
SimulatedAnnealingSampler.parameters A dict where keys are the keyword parameters accepted by the sampler methods (allowed kwargs) and values are lists of SimulatedAnnealingSampler.properties relevant to each parameter.

Methods

SimulatedAnnealingSampler.sample(bqm[, …]) Sample from a binary quadratic model using an implemented sample method.
SimulatedAnnealingSampler.sample_ising(h, J, …) Sample from an Ising model using the implemented sample method.
SimulatedAnnealingSampler.sample_qubo(Q, …) Sample from a QUBO using the implemented sample method.