This library aims to provide implementations of elements commonly used in the development on software in the area of satisfiability solving. The focus of the library is to provide as much ease of use without giving up on performance.
Project description
rustsat - A Comprehensive SAT Library for Rust
rustsat
is a collection of interfaces and utilities for working with the boolean satisfiability problem in Rust.
This library aims to provide implementations of elements commonly used in the development of software in the area of satisfiability solving.
The focus of the library is to provide as much ease of use without giving up on performance.
Example
let mut instance: SatInstance = SatInstance::new();
let l1 = instance.new_lit();
let l2 = instance.new_lit();
instance.add_binary(l1, l2);
instance.add_binary(!l1, l2);
instance.add_unit(l1);
let mut solver = rustsat_minisat::core::Minisat::default();
solver.add_cnf(instance.as_cnf().0).unwrap();
let res = solver.solve().unwrap();
assert_eq!(res, SolverResult::Sat);
let sol = solver.full_solution().unwrap();
assert_eq!(sol[l1.var()], TernaryVal::True);
assert_eq!(sol[l2.var()], TernaryVal::True);
Crates
The RustSAT project is split up into multiple crates that are all contained in this repository. These are the crates the project consists of:
Crate | Description |
---|---|
rustsat |
The main library, containing basic types, traits, encodings, parsers, and more. |
rustsat-tools |
A collection of small helpful tools based on RustSAT that can be installed as binaries. For a list of available tools, see this directory with short descriptions of the tools in the headers of the files. |
rustsat-<satsolver> |
Interfaces to SAT solvers that can be used alongside rustsat . Currently interfaces are available for cadical , kissat , glucose , and minisat . |
Installation
To use the RustSAT library as a dependency in your project, simply run cargo add rustsat
.
To use an SAT solver interface in your project, run cargo add rustsat-<satsolver>
.
Typically, the version of the SAT solver can be selected via crate features, refer to the documentation of the respective SAT solver crate for details.
To install the binary tools in rustsat-tools
run cargo install rustsat-tools
.
Features
Feature name | Description |
---|---|
internals |
Make some internal data structures for e.g. encodings public. This is useful when basing a more complex encoding on the rustsat implementation of another encoding. Note that the internal API might change between releases. |
fxhash |
Use the faster firefox hash function from rustc-hash in rustsat . |
ipasir |
Include and link the IPASIR solver interface. |
optimization |
Include optimization (MaxSAT) data structures etc. |
multiopt |
Include data structures etc. for multi-objective optimization. |
compression |
Enable parsing and writing compressed input. |
bench |
Enable benchmark tests. Behind feature flag since it requires unstable Rust. |
rand |
Enable randomization features. (Shuffling clauses etc.) |
Examples
For example usage refer to the small example tools in the rustsat-tools
crate at tools/src/bin
. For a bigger
example you can look at this multi-objective optimization
solver.
For an example of how to use the C-API, see rustsat/examples/capi*.cpp
.
Similarly, for an example of using the Python API, see rustsat/examples/pyapi*.py
.
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
Built Distributions
Hashes for rustsat-0.4.2-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bcad367577b530cc253f2b1cd62626e402f32539a8db66dc314e643580b6690 |
|
MD5 | 6a908fb83ee2cbbba2dc066bc6757270 |
|
BLAKE2b-256 | 55b631af93e2f3eedc15a2d7c33d3f5f5494eb33941cceaeb83fca2dfbbd874b |
Hashes for rustsat-0.4.2-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ed085f02dcaad13f600d381b380d905d0b8c604197172428a3d22a7f8c1fc5a |
|
MD5 | 999c5d8f5150be54714a49dfda07fe94 |
|
BLAKE2b-256 | d5df9f9f8cce7195863a7218bb37d7f40a3a346b67daf2c37b3a1dee78d185a7 |
Hashes for rustsat-0.4.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9bd3461baf8fcf06b74106e81b5201ec6dc2485ec032c957bf2e861a898f134 |
|
MD5 | 6eb374409f6ab5e7e593588ee6251417 |
|
BLAKE2b-256 | e5533e7c9c6235e3863c3d565c542498ba157871f13492cf1f24c2219b5c1cff |
Hashes for rustsat-0.4.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2580b417850410c301fb54bc31434cdb0ba4c34d7e133c001b38566b605c57e3 |
|
MD5 | 34aab3b2b7c081adc3f14af4fc1cf6e2 |
|
BLAKE2b-256 | 38c56cccb7a736007cb094bca2daa3554191ebc0f7be4c11f98b22ee1fa2d99b |
Hashes for rustsat-0.4.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a5e43aff3f367881433ac95f64387cf4bd76d937766803b50193f51d8d4eb80 |
|
MD5 | bea1794ba9b010c659493659ce188b4e |
|
BLAKE2b-256 | 93d94a4cc48890ced5a083b0c3a7efa85892b34269797c36c3f4d2269bed5b51 |
Hashes for rustsat-0.4.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a322b0f2271abbd90c4d3ebd114ef3bd4a464b297898470b6d1b1a7ba0ca96b3 |
|
MD5 | 94d9ace5de387cab0507befebdf5edfe |
|
BLAKE2b-256 | 8d46c8ab1b9f12fa99478d25fb0ca58f66e6d235964a46c99918ade3845bf52c |
Hashes for rustsat-0.4.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd16063cb448e01a4bdeeaecd00397eef22c902b73be936c4f810c863347a1f5 |
|
MD5 | 837a1eb5ea834c8cd58528cb585cf530 |
|
BLAKE2b-256 | 08ff11cdd8df8a2b2adec98a1f404a5552c8643d78bf26f10798cb88e1195dc0 |
Hashes for rustsat-0.4.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df62f6cedf056dd99adcb12ea2be39bd9a19b8d27256d9d040153663d67a9403 |
|
MD5 | e67771a57ddaf03eb1d73894399a31bc |
|
BLAKE2b-256 | a23c903b258f2484bfc70362cd3abc8bfa1a2c2342f28895349734c83edef204 |
Hashes for rustsat-0.4.2-cp37-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ca8d22620d9c923568f2de9ab5484fd4dbbf6318538939fdc75dbe63bef8596 |
|
MD5 | b760770384366dc5a326c407b3b5262b |
|
BLAKE2b-256 | a7ae499228542cb7a049baf4c5c87ddfb1485c48b67819a1b2622f9f39e0f960 |
Hashes for rustsat-0.4.2-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b06402180c179af2fafd26dc8cbfc97216f3e777a663ca3b2798a4284d0f49dd |
|
MD5 | cfd7859d9d4b96abeb0995ba6d63e185 |
|
BLAKE2b-256 | e0b2062b57109c1e151f9a9292b222bfc8eff343270ac31d6f49e51ebc5ab1e0 |