Skip to content

Map constraint satisfaction problems with binary variables to binary quadratic models.

License

Notifications You must be signed in to change notification settings

aidanproy/dwavebinarycsp

 
 

Repository files navigation

https://coveralls.io/repos/github/dwavesystems/dwavebinarycsp/badge.svg?branch=master https://readthedocs.org/projects/dwavebinarycsp/badge/?version=latest https://circleci.com/gh/dwavesystems/dwavebinarycsp.svg?style=svg

dwavebinarycsp

Library to construct a binary quadratic model from a constraint satisfaction problem with small constraints over binary variables.

Example Usage

import dwavebinarycsp
import dimod

csp = dwavebinarycsp.factories.random_2in4sat(8, 4)  # 8 variables, 4 clauses

bqm = dwavebinarycsp.stitch(csp)

resp = dimod.ExactSolver().sample(bqm)

for sample, energy in resp.data(['sample', 'energy']):
    print(sample, csp.check(sample), energy)

Installation

To install:

pip install dwavebinarycsp

To build from source:

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

License

Released under the Apache License 2.0. See LICENSE file.

Contribution

See CONTRIBUTING.rst file.

About

Map constraint satisfaction problems with binary variables to binary quadratic models.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%