Skip to content

An implementation of a simulated annealing sampler for general Ising model graphs in C++ with a dimod Python wrapper.

License

Notifications You must be signed in to change notification settings

dwavesystems/dwave-neal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0457d05 · Jun 10, 2022
May 9, 2022
Aug 15, 2018
May 12, 2021
Jun 10, 2022
Jun 10, 2022
May 17, 2018
Sep 13, 2018
Jan 30, 2020
Sep 13, 2018
Jun 10, 2022
Dec 21, 2021
Dec 21, 2021
Oct 24, 2018
May 9, 2022

Repository files navigation

https://readthedocs.com/projects/d-wave-systems-dwave-neal/badge/?version=latest https://circleci.com/gh/dwavesystems/dwave-neal.svg?style=svg

dwave-neal

An implementation of a simulated annealing sampler.

A simulated annealing sampler can be used for approximate Boltzmann sampling or heuristic optimization. This implementation approaches the equilibrium distribution by performing updates at a sequence of increasing beta values, beta_schedule, terminating at the target beta. Each spin is updated once in a fixed order per point in the beta_schedule according to a Metropolis- Hastings update. When beta is large the target distribution concentrates, at equilibrium, over ground states of the model. Samples are guaranteed to match the equilibrium for long 'smooth' beta schedules.

For more information, see Kirkpatrick, S.; Gelatt Jr, C. D.; Vecchi, M. P. (1983). "Optimization by Simulated Annealing". Science. 220 (4598): 671–680

Example Usage

import neal

sampler = neal.SimulatedAnnealingSampler()

h = {0: -1, 1: -1}
J = {(0, 1): -1}
sampleset = sampler.sample_ising(h, J)

Installation

To install:

pip install dwave-neal

To build from source:

pip install -r requirements.txt
python setup.py build_ext --inplace
python setup.py install

License

Released under the Apache License 2.0. See LICENSE file.

Contributing

Ocean's contributing guide has guidelines for contributing to Ocean packages.