Skip to main content

Bindings to CMSGen, uniform-like sampler

Project description

pycmsgen uniform-like sampler

This directory provides Python bindings to the CMSGen unform-like sampler,

Installing

pip install pycmsgen

Compiling

If you don't want to use the pip package, you can compile it as:

apt-get install python-dev
python -m build

Usage

The pycmsgen module has one object, Solver that has three main functions solve, add_clause, and get_model.

The function add_clause() takes an iterable list of literals such as [1, 2] which represents the truth 1 or 2 = True. For example, add_clause([1]) sets variable 1 to True.

The function solve() solves the system of equations that have been added with add_clause():

>>> from pycmsgen import Solver
>>> s = Solver()
>>> s.add_clause([1, 2])
>>> sat = s.solve()
True
>>> print(s.get_model())
[1, 2]

The solve() method optionally takes an argument assumptions that allows the user to set values to specific variables in the solver in a temporary fashion. This means that in case the problem is satisfiable but e.g it's unsatisfiable if variable 2 is FALSE, then solve([-2]) will return UNSAT. However, a subsequent call to solve() will still return a solution. If instead of an assumption add_clause() would have been used, subsequent solve() calls would have returned unsatisfiable.

Solver takes the following keyword arguments:

  • time_limit: the time limit (integer)
  • confl_limit: the propagation limit (integer)
  • verbose: the verbosity level (integer)

Both time_limit and confl_limit set a budget to the solver. The former is based on time elapsed while the former is based on number of conflicts met during search. If the solver runs out of budget, it returns with (None, None). If both limits are used, the solver will terminate whenever one of the limits are hit (whichever first). Warning: Results from time_limit may differ from run to run, depending on compute load, etc. Use confl_limit for more reproducible runs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycmsgen-6.1.1.tar.gz (247.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pycmsgen-6.1.1-pp310-pypy310_pp73-win_amd64.whl (262.6 kB view details)

Uploaded PyPyWindows x86-64

pycmsgen-6.1.1-pp39-pypy39_pp73-win_amd64.whl (262.6 kB view details)

Uploaded PyPyWindows x86-64

pycmsgen-6.1.1-pp38-pypy38_pp73-win_amd64.whl (262.7 kB view details)

Uploaded PyPyWindows x86-64

pycmsgen-6.1.1-pp37-pypy37_pp73-win_amd64.whl (262.7 kB view details)

Uploaded PyPyWindows x86-64

pycmsgen-6.1.1-cp313-cp313-win_amd64.whl (258.1 kB view details)

Uploaded CPython 3.13Windows x86-64

pycmsgen-6.1.1-cp312-cp312-win_amd64.whl (262.3 kB view details)

Uploaded CPython 3.12Windows x86-64

pycmsgen-6.1.1-cp311-cp311-win_amd64.whl (262.2 kB view details)

Uploaded CPython 3.11Windows x86-64

pycmsgen-6.1.1-cp310-cp310-win_amd64.whl (262.1 kB view details)

Uploaded CPython 3.10Windows x86-64

pycmsgen-6.1.1-cp39-cp39-win_amd64.whl (262.1 kB view details)

Uploaded CPython 3.9Windows x86-64

pycmsgen-6.1.1-cp38-cp38-win_amd64.whl (262.0 kB view details)

Uploaded CPython 3.8Windows x86-64

pycmsgen-6.1.1-cp37-cp37m-win_amd64.whl (259.9 kB view details)

Uploaded CPython 3.7mWindows x86-64

File details

Details for the file pycmsgen-6.1.1.tar.gz.

File metadata

  • Download URL: pycmsgen-6.1.1.tar.gz
  • Upload date:
  • Size: 247.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycmsgen-6.1.1.tar.gz
Algorithm Hash digest
SHA256 b1625d20d29d43cbe562b72c1656a6156ec59648a962005f761833a6e4833537
MD5 0be6b31e5ed30ca40e2e929269dcea5e
BLAKE2b-256 946504400fa5e4dc87a5548b98ba4e056aa24b13bbcaf7a07d95ce0a096b2618

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-pp310-pypy310_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for pycmsgen-6.1.1-pp310-pypy310_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 2293a85cc717350d806084e301e206e524524ed899e159d19bcbb90ac88b0f56
MD5 5004babf73e4f0ececff33060ed44b0c
BLAKE2b-256 0bcb342c30d02ab56b05eea39414810dddc9304edda3540bde582883d20d8367

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-pp39-pypy39_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for pycmsgen-6.1.1-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 7d29b0fe065af0d22f514b120f10b83ad6fb8dcb262da229b1f76ed5a8b3a034
MD5 a020ac7cab4b9c3fa84b3c04103bba20
BLAKE2b-256 47a654660c698d12b78b404ae7c22060d04a372cb278e81579f36211a9e177df

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-pp38-pypy38_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for pycmsgen-6.1.1-pp38-pypy38_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 98f2108aaff02d2514e393cb749b46f9b5ea998fa136dfc2f1d90b9f65d83b11
MD5 dca9d2eba1c0966c933b9332c0133237
BLAKE2b-256 3a9dcda8b897c4e57f1369e46ea5b4ac921c8a8234688e3142b245028a29eaf7

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-pp37-pypy37_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for pycmsgen-6.1.1-pp37-pypy37_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 3cc0805ba38177bfed6e7d300128a946daa4b7bd215e52e1c16ad43627fa90ae
MD5 68e4cf8b880c098efc272cb91804096f
BLAKE2b-256 ceb912ea242a9e3087aee559ddef990b8f12e0c41f25a1087e17c9c04238b3f8

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pycmsgen-6.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 258.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycmsgen-6.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1203bb6ee7c80b2a7e9ad5ce66ffc50ca3d760118d08116ec36df803ca3241b4
MD5 270a6754973f0ca9640dacc3d5bd13d9
BLAKE2b-256 f3b0863c320184e7c44da34e7c7b307c618ac098cd6dbea8052e027173206b40

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pycmsgen-6.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 262.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pycmsgen-6.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ce29ccdc1469c219d1e9b100ff1e62523e1b440f0b1e1791d867d07c0dbb42fd
MD5 c7e9e0bfce9e687560773aa380be6d0f
BLAKE2b-256 e0b9b5dc064ac9934d7744db4e6bcbb3d76aee05be7139bd036959c77da052a2

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pycmsgen-6.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 262.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pycmsgen-6.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7c81316c4fefb3bf4bf70802411b35926f5a4ddca29a45d6991d810862e61367
MD5 a7226bcca55a2a28d04fb943937a83de
BLAKE2b-256 681a252e2f97101f72dfac3b8da2ac86d9f9c7592c216f691ffd466481e3037c

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pycmsgen-6.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 262.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pycmsgen-6.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 edc291d6c2dcbdbe1a4316647dba1ac6344758219be3c2dd257510e9f443a46d
MD5 400bc0d73ca8fbac72c4b4859c6eb4a2
BLAKE2b-256 0b65cde3be2dc134e996150b924ef2cfddd0c36379c2bbacf09e19cb76060219

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pycmsgen-6.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 262.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pycmsgen-6.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 43710bf5a608dda165776b21d4a30bed54bf2ab19ee9af7c5dcb87726971db73
MD5 76cd06af7f2abdc0ab5be21019b4aa71
BLAKE2b-256 14c7fd5acc67263fc9689c9bf83a4721684976bc90789dd72230dafc2bf4180b

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pycmsgen-6.1.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 262.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pycmsgen-6.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3eab03ca87b7f9bf048a9e7e6ad172e8946fa079afc75a40f1308eb21a0e502a
MD5 a251da142c4de5f6f62fe9c5bf251a03
BLAKE2b-256 1794f6f0aebe8034ef394db42101e3b1bda00eedbcb67f9dcc42d9b5beb120fc

See more details on using hashes here.

File details

Details for the file pycmsgen-6.1.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pycmsgen-6.1.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 259.9 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pycmsgen-6.1.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c139b4d8ea1a1bf34982b84ecea4513e1d46d5a1eb97dec42678613a56683770
MD5 845711c5eee435e6133eae8ee81af0d8
BLAKE2b-256 c481b477316fe14097bebac4aec10bf42cf8a20a12a1872f58d09322c24535ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page