pyunigen: bindings to the UniGen almost uniform sampler
This directory provides Python bindings to UniGen on the C++ level, i.e. when importing pycryptosat, the CryptoMiniSat solver becomes part of the Python process itself.
Installing
pip install pyunigen
Compiling
If you don't want to use the pip package, you can compile it as:
apt-get install python-dev
cd python
git clone https://github.com/msoos/cryptominisat
git clone https://github.com/meelgroup/arjun
git clone https://github.com/meelgroup/approxmc
cd ..
python -m build
You will then find the files under "dist/".
Usage
The pyunigen module has one object, Sampler that has two functions
sample and add_clause.
The funcion 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 sample() samples the system of equations that have been added
with add_clause():
>>> from pyunigen import Sampler
>>> c = Sampler()
>>> c.add_clause([1, 5])
>>> c.add_clause([10, 11, 12])
>>> cells, hashes, samples = c.sample(num=2, sampling_set=range(1,5))
>>> print("There are approx. ", cells*2**hashes, " solutions over the sampling set. Samples: ", samples)
There are approx. 16 solutions over the sampling set. Samples: [[1, -2, 3, -4], [1, 2, -3, -4]]
The return value is a tuple of cells and hashes. Which gives how many solutions there are, probabilistically approximately
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
Metadata
Release files for pyunigen 2.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyunigen-2.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.17+ x86-64 | Details |
| pyunigen-2.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.17+ x86-64 | Details |
| pyunigen-2.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.17+ x86-64 | Details |
| pyunigen-2.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.17+ x86-64 | Details |
| pyunigen-2.5.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.7 | CPython 3.7 pymalloc | Linux glibc 2.17+ x86-64 | Details |
Total release size: 55.3 MB
Release files / pyunigen-2.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyunigen-2.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
69c49dd9ecb54d4036253a9789f5fbf3b88a1779278e38924e8efcd6e3f98474
|
|
BLAKE2b-256 checksum How to use checksums |
e67722a584ab7bdd77e1527b73e5f2fe12f2239a2ea59967e808433bde739b4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Release files / pyunigen-2.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyunigen-2.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
3de1ad1e55b7453b4da4bbc46cf4f8306ffbddd627364bfbd4ca26dc882cb0b7
|
|
BLAKE2b-256 checksum How to use checksums |
da02db210bb20f4200d7209a44849cd29fb42d73e34460e9412f1642a3e8f562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Release files / pyunigen-2.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyunigen-2.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
90ab7b10fe269792f5b13f97f6a8b53fa6a9100e3e43a4c3bf1b4301773d7e7f
|
|
BLAKE2b-256 checksum How to use checksums |
3e144a979af7b2271b8dafa883daa5c24333af743091e3d027d2301175b38a66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Release files / pyunigen-2.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyunigen-2.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8a280720e89ec00b0057aa1b09952d60156361f89a623102c79a34bed8b1d2da
|
|
BLAKE2b-256 checksum How to use checksums |
6983e49ae161948b445c9d5eb998ff8f8a5b5cfd70613116709965bebb61d6ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Release files / pyunigen-2.5.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyunigen-2.5.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
48eecd7a7089a2d62edf302119831c85bd678224d882d9709329292f658929b5
|
|
BLAKE2b-256 checksum How to use checksums |
584dfc58559ae2783b54e42f54e9b506fa2011737c4c61f830acae6712d2239f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Security for pyunigen 2.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.