Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Lipen/backdoor-solver
Backdoor-based SAT solver
https://github.com/Lipen/backdoor-solver
backdoor rust sat-solver
Last synced: 2 months ago
JSON representation
Backdoor-based SAT solver
- Host: GitHub
- URL: https://github.com/Lipen/backdoor-solver
- Owner: Lipen
- Created: 2024-04-05T11:39:01.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-08-28T17:24:10.000Z (2 months ago)
- Last Synced: 2024-08-28T19:11:27.753Z (2 months ago)
- Topics: backdoor, rust, sat-solver
- Language: Rust
- Homepage:
- Size: 11.5 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-rust-formalized-reasoning - backdoor-solver - backdoor-based SAT solver. (Projects / Provers and Solvers)
README
# Backdoor-based SAT Solver
> SAT solver based on rho-backdoors.
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13375121.svg)](https://doi.org/10.5281/zenodo.13375121)
[![Build Status](https://github.com/Lipen/backdoor-solver/actions/workflows/ci.yml/badge.svg)](https://github.com/Lipen/backdoor-solver/actions)- For ECAI-2024 related code, please refer to the [`ecai-2024`](https://github.com/Lipen/backdoor-solver/tree/ecai-2024) branch.
- For SAT Competition 2024 related code, please refer to the [`sc2024`](https://github.com/Lipen/backdoor-solver/tree/sc2024) branch.## Setup
```sh
git clone https://github.com/Lipen/backdoor-solver
cd backdoor-solver
git submodule update --init --recursive --progress
cargo check --workspace --lib --bins --tests
```Do not forget to update submodules every time you switch branches!
Below, you can find instructions on how to use different components provided in this repository, for example, SAT solver and backdoor searcher.
## SAT solver
> SAT solver that interleaves CaDiCaL with clauses derivation procedures utilizing rho-backdoors.
### CLI Usage
```
Usage: interleave [OPTIONS] --backdoor-size --num-iters --max-product --budget-filter --budget-solveArguments:
Input file with CNF in DIMACS formatOptions:
-o, --output
Path to output file in DIMACS format. If the problem is SAT, contains two lines: "s SATISFIABLE\nv 1 2 ... 0\n", else contains a single line: "s UNSATISFIABLE" or "s INDET"
--results
Path to a file with results
--seed
Random seed [default: 42]
--backdoor-size
Backdoor size
--num-iters
Number of EA iterations
--stagnation-limit
Number of stagnated iterations before re-initialization
--ban-used
Do ban variables used in the best backdoors on previous runs?
--reset-used-vars
Reset banned used variables on empty product
--allow
Comma-separated list of allowed variables (1-based indices)
--ban
Comma-separated list of banned variables (1-based indices)
--derive-ternary
Derive ternary clauses
--max-product
Maximum product size
--use-sorted-filtering
Use novel sorted filtering method
--num-conflicts
Number of conflicts (budget per task in filtering) [default: 1000]
--budget-filter
Initial budget (in conflicts) for filtering
--factor-budget-filter
Multiplicative factor for filtering budget [default: 1]
--budget-solve
Initial budget (in conflicts) for solving
--factor-budget-solve
Multiplicative factor for solving budget [default: 1]
--budget-presolve
Budget (in conflicts) for pre-solve [default: 0]
--compute-cores
Do compute cores for easy tasks and invalid cubes
--add-cores
Do add lemmas from cores
--max-core-size
Maximum core size to be added (0 = unlimited) [default: 0]
--cadical-options
Comma-separated list of Cadical options ('key=value' pairs, e.g. 'elim=0,ilb=0,check=1')
-h, --help
Print help
-V, --version
Print version
```### Example
```sh
cargo run --release --bin interleave -- data/mult/lec_CvK_12x12.cnf --backdoor-size 10 --num-iters 10000 --ban-used --max-product 10000 --budget-filter 10000 --factor-budget-filter 1.1 --budget-solve 100000 --factor-budget-solve 1.1 --budget-presolve 10000 --output out.txt
```## Backdoor Searcher
> Evolutionary algorithm for searching rho-backdoors for a given SAT formula.
### CLI Usage
```
Usage: search [OPTIONS] --backdoor-size --num-itersArguments:
Input file with CNF in DIMACS formatOptions:
--backdoor-size Backdoor size
--num-iters Number of EA iterations
--num-runs Number of EA runs [default: 1]
-o, --output Path to a output file with backdoors
--seed Random seed [default: 42]
--allow Comma-separated list of allowed variables (1-based indices)
--ban Comma-separated list of banned variables (1-based indices)
--ban-used Do ban variables used in best backdoors on previous runs?
--stagnation-limit Number of stagnated iterations before re-initialization
--max-rho Maximum required rho value (break EA upon reaching) [default: 1]
--min-iter Minimum number of EA iterations [default: 0]
--dump-records Do dump records for each EA run?
--derive Do derive clauses from backdoors?
--dump-derived Do dump derived clauses after each EA run?
--probe Do probe the backdoor variables?
--probe-derive Do try to probe-derive all units and binary clauses?
--derive-ternary Derive ternary clauses
--budget-presolve Budget (in conflicts) for pre-solve [default: 0]
-h, --help Print help
-V, --version Print version```
### Example
Search for 3 backdoors, each of size 10, using 1000 iterations of EA and the random seed 42 (default):
```sh
cargo run --release --bin search -- data/mult/lec_CvK_12.cnf --backdoor-size 10 --num-iters 1000 --num-runs 3 --seed 42 --output output.txt
````output.txt` might look like:
```
ackdoor [4242, 4919, 2082, 1920, 4969, 5082, 4903, 2163, 2154, 4071] of size 10 on iter 829 with fitness = 0.029296875, rho = 0.970703125, hard = 30 in 120.671 ms
Backdoor [5089, 3989, 3375, 4265, 2163, 4273, 2648, 4158, 2082, 3133] of size 10 on iter 935 with fitness = 0.009765625, rho = 0.990234375, hard = 10 in 99.219 ms
Backdoor [4022, 4034, 4475, 4383, 2606, 4902, 1895, 960, 3538, 2471] of size 10 on iter 884 with fitness = 0.013671875, rho = 0.986328125, hard = 14 in 70.435 ms
```Note: variables in the reported backdoors (in file/console) are 1-based.