14 releases

0.1.14 Nov 25, 2022
0.1.13 Oct 30, 2020
0.1.12 Jun 18, 2020

#1260 in Math

40 downloads per month
Used in 5 crates (4 directly)

MIT license

795KB
18K SLoC

C++ 17K SLoC // 0.2% comments Rust 524 SLoC

CaDiCaL SAT solver

Build Status Crate Documentation GitHub

This is a stand alone crate that contains both the C++ source code of the CaDiCaL incremental SAT solver together with its Rust binding. The C++ files are compiled and statically linked during the build process. This crate works on Linux, Apple OSX, Windows, Android, iOS, Raspberry Pi, NetBSD and FreeBSD.

CaDiCaL won first place in the SAT track of the SAT Race 2019 and second overall place. It was written by Armin Biere, and it is available under the MIT license.

The literals are unwrapped positive and negative integers, exactly as in the DIMACS format. The common IPASIR operations are presented in a safe Rust interface.

let mut sat: cadical::Solver = Default::default();
sat.add_clause([1, 2]);
sat.add_clause([-1, 2]);
assert_eq!(sat.solve(), Some(true));
assert_eq!(sat.value(2), Some(true));

The C++ library is build with assertions disabled and with optimization level 3 by default. C++ assertions are enabled only when cargo is building a debug version and the cpp-debug feature of the library is enabled.

Dependencies