Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liffiton/pyminisolvers
A Python API for the MiniSat and MiniCard constraint solvers.
https://github.com/liffiton/pyminisolvers
constraints minisat python-api solver
Last synced: 3 months ago
JSON representation
A Python API for the MiniSat and MiniCard constraint solvers.
- Host: GitHub
- URL: https://github.com/liffiton/pyminisolvers
- Owner: liffiton
- License: other
- Created: 2014-03-11T20:08:27.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-06-15T02:26:27.000Z (over 1 year ago)
- Last Synced: 2023-06-15T03:25:22.636Z (over 1 year ago)
- Topics: constraints, minisat, python-api, solver
- Language: C++
- Homepage:
- Size: 2.36 MB
- Stars: 19
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PyMiniSolvers
=============PyMiniSolvers is a Python API for the [MiniSat](http://minisat.se/) and
[MiniCard](http://git.io/minicard) constraint solvers. It accesses the solvers
via shared libraries, reducing overhead and allowing for efficient incremental
solving. Its interfaces closely match the interfaces of each tool's Solver
class, providing flexible and powerful access to most of the solvers' standard
capabilities. Additionally, an extended "SubsetSolver" interface is provided
for each tool, simplifying reasoning about subsets of a constraint set (e.g.,
solving arbitrary subsets of the added constraints, extracting UNSAT cores,
etc.).Basic usage:
```python
>>> import minisolvers
>>> S = minisolvers.MinisatSolver()
>>> for i in range(4):
... S.new_var()
>>> for clause in [1], [-2], [-1, 2, -3], [3, 4]:
... S.add_clause(clause)>>> S.solve()
True>>> list(S.get_model())
[1, 0, 0, 1]>>> S.add_clause([-1, 2, 3, -4])
>>> S.solve()
False
```For further examples, see the documentation.
API Documentation
-----------------https://pyminisolvers.readthedocs.io/
Setup
-----Requirements:
- Python 2.7 or 3.x
- A standard build environment (make, gcc, etc.)
- zlib development libraries (e.g., `zlib1g-dev` or `zlib-devel` packages)Tested Platforms:
- Linux
- Cygwin
- OS XTo build the shared libraries:
$ make
To test the API (automatically tests w/ Python 2 and/or 3 as available):
$ make test
Or manually run the tests:
$ python -m doctest -v minisolvers.py
$ python test_minisolvers.pyand/or
$ python3 -m doctest -v minisolvers.py
$ python3 test_minisolvers.pyLicense
-------This code is licensed under the MIT license. See LICENSE for details.