A Numpy and Numba based Python library for solving Constraint Satifaction Problems
Project description
NUCS
TLDR
NUCS is a Python library for solving Constraint Satisfaction and Optimization Problems.
NUCS is powered by Numpy (https://numpy.org/) and Numba (https://numba.pydata.org/).
NUCS is fast and easy to use.
How to use NUCS ?
It is very simple to get started with NUCS. Either clone the Github repository or install the package.
Clone the NUCS Github repository
Let's install NUCS from the source:
git clone https://github.com/yangeorget/nucs.git
pip install -r requirements.txt
From there, you can launch some NUCS examples. Note that the second run will be much faster since the Python code will have been compiled.
Run the NUCS tests
NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. pytest tests/
Run some examples
Find all solutions to the 12-queens problem:
NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python3 tests/examples/test_queens.py -n 12
Find the optimal solution to the Golomb ruler problem with 10 marks:
NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python3 tests/examples/test_golomb.py -n 10
Install the NUCS package
pip install nucs
Why Python ?
NUCS is a Python library leveraging Numpy and Numba.
Python is a powerful and flexible programing language that allows to express complex problems in a few lines of code.
Numpy brings the computational power of languages like C and Fortran to Python, a language much easier to learn and use.
Numba translates Python functions to optimized machine code at runtime using the industry-standard LLVM compiler library. Numba-compiled numerical algorithms in Python can approach the speeds of C or FORTRAN.
Architecture
Speed matters
Other constraint solvers in Python
- python-constraint
- CCPMpy
- PyCSP
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 Distribution
File details
Details for the file nucs-0.1.tar.gz
.
File metadata
- Download URL: nucs-0.1.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d506c570786f8991be7e7c812dc19d86e9ac627db39a82c6cd258dddfd6a697 |
|
MD5 | 6d48ae5df2c63bf595e86dd0d2481cec |
|
BLAKE2b-256 | 9cc09191d016602669a7961441b54d20418ae063e90489e9e67a5f935ab85791 |
File details
Details for the file NUCS-0.1-py3-none-any.whl
.
File metadata
- Download URL: NUCS-0.1-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c5c034531bb7783abe408414932fe8f58d76b2af80bee261530f12b9958a6d0 |
|
MD5 | 96ff68f57661a47539fb8557015dc671 |
|
BLAKE2b-256 | 4ed5bc6d20a7f4155f567052cd7115e62e58482b94412f769be98104b2f4ab0c |