Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neuring/satoxid
Boolean satisfiability problem encoding library written in rust.
https://github.com/neuring/satoxid
Last synced: 3 months ago
JSON representation
Boolean satisfiability problem encoding library written in rust.
- Host: GitHub
- URL: https://github.com/neuring/satoxid
- Owner: neuring
- License: mit
- Created: 2021-05-22T17:11:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-03T16:34:52.000Z (almost 2 years ago)
- Last Synced: 2024-05-22T21:35:05.614Z (6 months ago)
- Language: Rust
- Homepage:
- Size: 137 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-formalized-reasoning - Satoxid - library to help with encoding SAT problems. (Projects / Libraries)
README
# Satoxid, a SATisfiability encoding library
Satoxid is a library to help with encoding SAT problems with a focus on ergonomics and debugability.
## Features
* Predefined common constraints
* Variables are values of a user defined type instead of integers
* Modular, you can implement your own constraints and backends## Example
```rust
use satoxid::{CadicalEncoder, constraints::ExactlyK};#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
enum Var {
A, B, C
}use Var::*;
fn main() {
let mut encoder = CadicalEncoder::new();let constraint = ExactlyK {
k: 1,
lits: [A, B, C].iter().copied()
};encoder.add_constraint(constraint);
if let Some(model) = encoder.solve() {
let true_vars = model.vars()
.filter(|v| v.is_pos())
.count();assert_eq!(true_vars, 1);
}
}
```For a more complex example see [this rummy solver](https://github.com/neuring/rummy_to_sat).