Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jix/cnfpack
Converts between the text based DIMACS CNF file format and the compressed binary Cnfpack format
https://github.com/jix/cnfpack
Last synced: 21 days ago
JSON representation
Converts between the text based DIMACS CNF file format and the compressed binary Cnfpack format
- Host: GitHub
- URL: https://github.com/jix/cnfpack
- Owner: jix
- License: other
- Created: 2021-08-23T16:42:26.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-06T17:47:11.000Z (over 2 years ago)
- Last Synced: 2024-05-22T21:32:42.144Z (6 months ago)
- Language: Rust
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-formalized-reasoning - Cnfpack - converts between DIMACS CNF file format and the compressed binary Cnfpack format. (Projects / Libraries)
README
# Cnfpack
[![github][github-badge]][github]
[![crates.io][crate-badge]][crate]Encoder and decoder for the Cnfpack format.
Converts between the text based DIMACS CNF file format and the compressed
binary Cnfpack format.## Format
Cnfpack is a compressed file format for CNF formulas. Converting a DIMACS CNF
formula to and from Cnfpack maintains the order of clauses as well as the order
of literals within clauses. Comments, optional whitespace or leading zeros in
the DIMACS input are not stored.## Example Usage
```bash
# Download example instance
wget -nv https://gbd.iti.kit.edu/file/5fb0d1f02c02c6a7fb485707b637d7e4/bvsub_12973.smt2.cnf.xz
#> 2021-08-23 17:55:24 URL:https://gbd.iti.kit.edu/file/5fb0d1f02c02c6a7fb485707b637d7e4/bvsub_12973.smt2.cnf.xz [1559552/1559552] -> "bvsub_12973.smt2.cnf.xz" [1]
# Decompress `xz` file
xz -dk bvsub_12973.smt2.cnf.xz
# Convert to `cnfpack`
cnfpack bvsub_12973.smt2.cnf bvsub_12973.smt2.cnfpack
# Check file sizes
du -bh bvsub_12973.smt2.{cnf,cnf.xz,cnfpack}
#> 20M bvsub_12973.smt2.cnf
#> 1.5M bvsub_12973.smt2.cnf.xz
#> 2.2K bvsub_12973.smt2.cnfpack
# Decompress and compute GBD hash to verify the formula
cnfpack -d bvsub_12973.smt2.cnfpack | tail +2 | head -c -1 | tr '\n' ' ' | md5sum
#> 5fb0d1f02c02c6a7fb485707b637d7e4 -
# ^ Matches the hash in the download URL
```## Install
Make sure you have a working [Rust toolchain] and then run `cargo install
cnfpack` to download, install and build the latest version. Alternatively I
also provide [binaries for some platforms].[Rust toolchain]:https://www.rust-lang.org/tools/install
[binaries for some platforms]:https://github.com/jix/cnfpack/releases## License
This software is available under the Zero-Clause BSD license, see
[LICENSE](LICENSE) for full licensing information.### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this software by you shall be licensed as defined in
[LICENSE](LICENSE).[github]:https://github.com/jix/cnfpack
[crate]:https://crates.io/crates/cnfpack[github-badge]: https://img.shields.io/badge/github-jix/cnfpack-blueviolet?style=flat-square
[crate-badge]: https://img.shields.io/crates/v/cnfpack?style=flat-square