Bindings to ApproxMC, an approximate model counter
Project description
pyapproxmc: bindings to the ApproxMC model counter
This directory provides Python bindings to ApproxMC on the C++ level, i.e. when importing pyapproxmc, the ApproxMC counter becomes part of the Python process itself.
Installing
pip install pyapproxmc
Compiling
If you don't want to use the pip package, you can compile it:
apt-get install python-dev
cd python
git clone https://github.com/msoos/cryptominisat
git clone https://github.com/meelgroup/arjun
cd ..
python -m build
You will then find the files under "dist/".
Usage
import pyapproxmc
c = pyapproxmc.Counter()
c.add_clause([1,2,3])
c.add_clause([3,20])
count = c.count()
print("Approximate count is: %d*2**%d" % (count[0], count[1]))
The above will print that Approximate count is: 88*2**13
. Since the largest variable in the clauses was 20, the system contained 220 (i.e. 1048576) potential models. However, some of these models were prohibited by the two clauses, and so only approximately 88*213 (i.e. 720896) models remained.
If you want to count over a projection set, you need to call count(projection_set)
, for example:
import pyapproxmc
c = pyapproxmc.Counter()
c.add_clause([1,2,3])
c.add_clause([3,20])
count = c.count(range(1,10))
print("Approximate count is: %d*2**%d" % (count[0], count[1]))
This now prints Approximate count is: 56*2**3
, which corresponds to the approximate count of models, projected over variables 1..10.
Counter Object
You can give the following arguments to Counter
:
seed
-- sets the random seedverbosity
-- sets the verbosity of the system (default = 0)epsilon
-- Tolerance parameter, i.e. sets how approximate the returned count is. Default = 0.8delta
-- Confidence parameter, i.e. sets how probabilistically correct the returned count is. Default = 0.20
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pyapproxmc-4.1.16-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72828d4e5a75f1f47b8f5269db3c9f16351d389829a7652599081ee085d2824f |
|
MD5 | 62e4ce28856ae2d071864d870f84742e |
|
BLAKE2b-256 | b3e17eb3c6bc95b49a76a5bc70b39e1be3f8a0509137268914d00a723be94b6d |
Hashes for pyapproxmc-4.1.16-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e16f2ba7e3f7aa418c857490b114234aa6cd0ec5d6bfd476e1e7cdb68507d4ad |
|
MD5 | f728da08c330a40ba65b5417a48c96ab |
|
BLAKE2b-256 | d31fcc159881264e51dd9c4281ee5a6d2bc938813b1fdaeb2e6b1ed68de457a1 |
Hashes for pyapproxmc-4.1.16-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e889edf8a2928cdc26df7517c66bb336102a2b4f9b91c0e3616e15e1ca0438f |
|
MD5 | 51001a7d4e952c281c0c0c3b99548a18 |
|
BLAKE2b-256 | af30e998cf3e13927f69a37c79d8c27e17634f3b4d161ee085edda7a029f81e7 |
Hashes for pyapproxmc-4.1.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d51f6ae0fa143765d1b68863935c3a145bd109ce0cfe1b14a981ac93fd528d2d |
|
MD5 | 1dd5abd496eada9bc402aa2825c3afba |
|
BLAKE2b-256 | 76532e0d6b5d80fafdc3e3f856d25207dbb0a970bc33bcaf6ac0bd97d91c75cb |
Hashes for pyapproxmc-4.1.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 957f13451bdc05200158d269bf77d33514d153232413cee42419554dbfce4198 |
|
MD5 | 3640f2066f5daaf23bffcd8f7f2efe16 |
|
BLAKE2b-256 | a0860117c0922c3dd16df38f9360320352498b9f341d705b5e61ae2e0c447d51 |
Hashes for pyapproxmc-4.1.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a37ec612d4712b248c3053f60c87bffef1b028848e6b72d12f3f64460ede1b0 |
|
MD5 | 90e847ac342131bffe7b07944851ca8a |
|
BLAKE2b-256 | 3b06e3ffd3d6b9ef0353e059ce6cf22ecabd8dcef7b3a076237296054dcfd398 |
Hashes for pyapproxmc-4.1.16-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9245dbd6a6bbafa418e72fc0245e64433c7c82defdd15c28e1460a49ba27cfa |
|
MD5 | ac4ed1a2f0a7977db460b0701f5f06e1 |
|
BLAKE2b-256 | 9d428f674613a93abe519a16041dc8dfb58b2a3e90147e2d91a26d85b5387c3a |
Hashes for pyapproxmc-4.1.16-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50dc14c9ad66f6d1ebf0f061b2d7ba66a193483c1fca681363a23997827c64a4 |
|
MD5 | bd1d7d42eb285fcd8d13c41833009992 |
|
BLAKE2b-256 | 051f4ce1dceaa1f0d3001e77103097bcf3bd040f9cc66f09567e9b47bb0f83dd |