This is the MiniExact exact cover solver, implementing Donald Knuth's Algorithm X, C, and M using the Dancing Links technique.
Project description
miniexact
A minimalistic implementation of Donald Knuth's exact cover solving algorithms. Currently supporting:
- Algorithm X
- Algorithm C
- Algorithm M
- SAT Backend
Features:
- Web and CLI version
- Two input formats: One inspired by Donald Knuth's text representation, one by DIMACS from SAT solving.
- C-code is kept as close to Knuth's description as possible using Macros.
- Extensively hackable
- No dependencies
- SWIG Bindings support (if available on the system), see the Python example.
Usage
Either use the web-version in your
browser, the latest universal APE release, or compile yourself. The command line
tools expect the algorithm to use (-x, -c, or -m) and the input file(s).
If multiple files are given (e.g. using your shell's wildcard), each file is
solved separately.
A solution is the list of selected options. You can also print the options as
they were listed in the input file with the -p (print) switch.
In order to enumerate all possible solutions, use the -e (enumerate) switch.
You can change the heuristic used internally to a naive one, but the MRV heuristic (the default) is a good choice usually.
Knuth Exact Cover Format
This format is inspired by Donald Knuth's notation in /The Art of Computer Programming Volume 4 Fasicle 5/. You first list all primary (possibly with multiplicity values) and secondary items, then you list all options. This format is well readable and easy to generate and parse.
Example
< a b c d e f g >
c e;
a d g;
b c f;
a d f;
b g;
d e g;
Input Grammar
problem ::= primary_items [ secondary_items ] { option }
primary_items ::= '<' { primary_item } '>'
primary_item ::= ident [ ':' u [ ';' v ] ]
secondary_items ::= '[' { secondary_item } ']'
secondary_item ::= ident
option ::= { ident [ ':' color ] } ';'
DIMACS-inspired Format
This format is optimized to be generated by tools and is a combination of the DIMACS format known from SAT solving and the requirements for Exact Cover problems. You first define the number of primary and secondary items, then you list the options below. No item names are supported, as only integers are used. Colors can be given as negative integers after a secondary item was given.
Example
p xcc 2 1
2 3 -1 0
1 3 -1 0
Input Grammar
problem ::= 'p' ( 'xc' | 'xcc' ) <primary count> <secondary count> options
options ::= { option '0' }
option ::= { primary | secondary }
primary ::= <int>
secondary ::= <int> [ '-'<int> ]
Compiling
Reqirements:
- C Compiler (e.g. GCC or Clang)
- make
- cmake
- Optional: SWIG and Python 2/3
Create a sub-directory, generate a build script and compile the tool. Use something like this:
mkdir build
cd build
cmake ..
make
By default, a Release build is created. To develop the project, using the
Debug build is recommended. For this, run cmake using cmake .. -DCMAKE_BUILD_TYPE=Debug.
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file miniexact-1.2.7-0-cp310-cp310-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: miniexact-1.2.7-0-cp310-cp310-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 173.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f303516cc70856b25634ac02836758a9e54db390b3c0a38c1d79ab4d728d5b42
|
|
| MD5 |
964d440bb90ea4ec3c1731884835466e
|
|
| BLAKE2b-256 |
2d6ac86c61f1144b49fff74b8ee5e68b8415026b8a241af5b4dce0a7d1f275fb
|
Provenance
The following attestation bundles were made for miniexact-1.2.7-0-cp310-cp310-manylinux_2_35_x86_64.whl:
Publisher:
publish.yml on miniexact/miniexact
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
miniexact-1.2.7-0-cp310-cp310-manylinux_2_35_x86_64.whl -
Subject digest:
f303516cc70856b25634ac02836758a9e54db390b3c0a38c1d79ab4d728d5b42 - Sigstore transparency entry: 394394912
- Sigstore integration time:
-
Permalink:
miniexact/miniexact@445ae9f05db9960dbe10cd9d224a0ec1cb7b712e -
Branch / Tag:
refs/tags/v1.2.7 - Owner: https://github.com/miniexact
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@445ae9f05db9960dbe10cd9d224a0ec1cb7b712e -
Trigger Event:
release
-
Statement type: