A Numpy and Numba based Python library for solving Constraint Satisfaction Problems over finite domains
Project description
TLDR
NuCS is a Python library for solving Constraint Satisfaction and Optimization Problems. Because it is 100% written in Python, NuCS is easy to install and use. NuCS is also very fast because it is powered by Numpy and Numba.
Installation
pip install nucs
Documentation
Check out NUCS documentation.
With NuCS, in a few seconds you can ...
Find all 14200 solutions to the 12-queens problem
NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.queens -n 12
{
'OPTIMIZER_SOLUTION_NB': 0,
'PROBLEM_FILTER_NB': 262011,
'PROBLEM_PROPAGATOR_NB': 3,
'PROBLEM_VARIABLE_NB': 36,
'PROPAGATOR_ENTAILMENT_NB': 0,
'PROPAGATOR_FILTER_NB': 2269980,
'PROPAGATOR_FILTER_NO_CHANGE_NB': 990450,
'PROPAGATOR_INCONSISTENCY_NB': 116806,
'SOLVER_BACKTRACK_NB': 131005,
'SOLVER_CHOICE_NB': 131005,
'SOLVER_CHOICE_DEPTH': 10,
'SOLVER_SOLUTION_NB': 14200
}
Compute the 92 solutions to the BIBD(8,14,7,4,3) problem
NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -l 3 --symmetry_breaking
{
'OPTIMIZER_SOLUTION_NB': 0,
'PROBLEM_FILTER_NB': 2797,
'PROBLEM_PROPAGATOR_NB': 462,
'PROBLEM_VARIABLE_NB': 504,
'PROPAGATOR_ENTAILMENT_NB': 5273,
'PROPAGATOR_FILTER_NB': 562130,
'PROPAGATOR_FILTER_NO_CHANGE_NB': 531724,
'PROPAGATOR_INCONSISTENCY_NB': 1307,
'SOLVER_BACKTRACK_NB': 1398,
'SOLVER_CHOICE_NB': 1398,
'SOLVER_CHOICE_DEPTH': 41,
'SOLVER_SOLUTION_NB': 92
}
Demonstrate that the optimal 10-marks Golomb ruler length is 55
NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.golomb -n 10 --symmetry_breaking
{
'OPTIMIZER_SOLUTION_NB': 10,
'PROBLEM_FILTER_NB': 22886,
'PROBLEM_PROPAGATOR_NB': 82,
'PROBLEM_VARIABLE_NB': 45,
'PROPAGATOR_ENTAILMENT_NB': 98080,
'PROPAGATOR_FILTER_NB': 2843257,
'PROPAGATOR_FILTER_NO_CHANGE_NB': 1806240,
'PROPAGATOR_INCONSISTENCY_NB': 11406,
'SOLVER_BACKTRACK_NB': 11405,
'SOLVER_CHOICE_NB': 11470,
'SOLVER_CHOICE_DEPTH': 9,
'SOLVER_SOLUTION_NB': 10
}
[1, 6, 10, 23, 26, 34, 41, 53, 55]
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
nucs-1.1.0.tar.gz
(38.5 kB
view details)
Built Distribution
NUCS-1.1.0-py3-none-any.whl
(90.5 kB
view details)
File details
Details for the file nucs-1.1.0.tar.gz
.
File metadata
- Download URL: nucs-1.1.0.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa72b9942fe87f6972fb6a70af3a6ed8ffebfa644c3c26cd8a48b5fbfd31f9c8 |
|
MD5 | 7be1d9a327c21b0be3added63f68bd7c |
|
BLAKE2b-256 | 21649ce143a15de721d3cae9100925d4a1e9535fcca5f385f7c0d932a36903fd |
File details
Details for the file NUCS-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: NUCS-1.1.0-py3-none-any.whl
- Upload date:
- Size: 90.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aa3c53042b6e72ca22d4a7dd8095f0b82ea528fe05d4e60e32b3fd3b26cd755 |
|
MD5 | e3b6c75ba9b4a28e9cfc0d0ac7420390 |
|
BLAKE2b-256 | ce39b3ed04a6bdaf4ff00d170b911cd42860677029c3b4929eaf2e45e06bbe5c |