Skip to main content

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


Download files

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

Source Distribution

nucs-0.1.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

NUCS-0.1.1-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file nucs-0.1.1.tar.gz.

File metadata

  • Download URL: nucs-0.1.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

Hashes for nucs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5972cb601968b202615367502f495745b4d0c0090ab2bce72c79903326d448af
MD5 dffd81718a1b3166ef7dafd12385e9cd
BLAKE2b-256 3d0c24cf94c6acd2240cad5520452a7c5a1cadcc03713a2db4347c256444a727

See more details on using hashes here.

File details

Details for the file NUCS-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: NUCS-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for NUCS-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b092118e26be8a35d3f14659be1e12234426df622383754ec0116b04b1b77acd
MD5 f3406397f7a9c5a350a3a89d00d8201a
BLAKE2b-256 5d6f8964f5824ce8556fbfda95ee07a50ba5d64a110c3fd0d8ca2071e3998f95

See more details on using hashes here.

Supported by

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