1
0
mirror of https://github.com/ellmau/adf-obdd.git synced 2025-12-19 09:29:36 +01:00

REORGANISE with workspace (#29)

Reorganise the structure of the repository to have a workspace with the library and the binary.
This commit is contained in:
Stefan Ellmauthaler 2022-03-03 13:37:14 +01:00 committed by GitHub
parent 3f32db45ee
commit 20d59bc767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 159 additions and 68 deletions

View File

@ -8,11 +8,15 @@ version = "0.2.1"
dependencies = [
"biodivine-lib-bdd",
"derivative",
"env_logger 0.9.0",
"lexical-sort",
"log",
"nom",
"quickcheck",
"quickcheck_macros",
"serde",
"serde_json",
"test-log",
]
[[package]]
@ -23,7 +27,7 @@ dependencies = [
"assert_cmd",
"assert_fs",
"clap",
"env_logger",
"env_logger 0.9.0",
"log",
"predicates",
"serde",
@ -97,7 +101,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bddcfb460c1131729ec8d797ce0be49ec102506e764ce62f20a40056516851c5"
dependencies = [
"fxhash",
"rand",
"rand 0.7.3",
]
[[package]]
@ -131,9 +135,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "3.1.3"
version = "3.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f8c0e2a6b902acc18214e24a6935cdaf8a8e34231913d4404dcaee659f65a1"
checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312"
dependencies = [
"atty",
"bitflags",
@ -148,9 +152,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "3.1.2"
version = "3.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01d42c94ce7c2252681b5fed4d3627cc807b13dfc033246bd05d5b252399000e"
checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16"
dependencies = [
"heck",
"proc-macro-error",
@ -198,6 +202,16 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "env_logger"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
dependencies = [
"log",
"regex",
]
[[package]]
name = "env_logger"
version = "0.9.0"
@ -252,7 +266,18 @@ checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if",
"libc",
"wasi",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
dependencies = [
"cfg-if",
"libc",
"wasi 0.10.2+wasi-snapshot-preview1",
]
[[package]]
@ -510,6 +535,28 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "quickcheck"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6"
dependencies = [
"env_logger 0.8.4",
"log",
"rand 0.8.5",
]
[[package]]
name = "quickcheck_macros"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b22a693222d716a9587786f37ac3f6b4faedb5b80c23914e7303ff5a1d8016e9"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "quote"
version = "1.0.15"
@ -525,13 +572,22 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"getrandom 0.1.16",
"libc",
"rand_chacha",
"rand_core",
"rand_core 0.5.1",
"rand_hc",
]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"rand_core 0.6.3",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
@ -539,7 +595,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core",
"rand_core 0.5.1",
]
[[package]]
@ -548,7 +604,16 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom",
"getrandom 0.1.16",
]
[[package]]
name = "rand_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
"getrandom 0.2.5",
]
[[package]]
@ -557,7 +622,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core",
"rand_core 0.5.1",
]
[[package]]
@ -680,9 +745,9 @@ dependencies = [
[[package]]
name = "termcolor"
version = "1.1.2"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
@ -694,10 +759,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b"
[[package]]
name = "textwrap"
version = "0.14.2"
name = "test-log"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
checksum = "eb78caec569a40f42c078c798c0e35b922d9054ec28e166f0d6ac447563d91a4"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "textwrap"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "thread_local"
@ -746,6 +822,12 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "winapi"
version = "0.3.9"

View File

@ -1,44 +1,3 @@
[package]
name = "adf_bdd"
version = "0.2.1"
authors = ["Stefan Ellmauthaler <stefan.ellmauthaler@tu-dresden.de>"]
edition = "2021"
repository = "https://github.com/ellmau/adf-obdd/"
license = "GPL-3.0-only"
exclude = ["res/", "./flake*", "flake.lock", "*.nix", ".envrc", "_config.yml"]
description = "Library to solve grounded, complete, and stable ADF-semantics by utilising OBDDs - ordered binary decision diagrams"
build = "build.rs"
[lib]
name="adf_bdd"
path = "src/lib.rs"
test = true
doctest = true # Documentation examples are tested by default.
bench = true # Is benchmarked by default.
doc = true # Is documented by default.
harness = true # Use libtest harness.
edition = "2021" # The edition of the target.
crate-type = ["lib"] # The crate types to generate.
[dependencies]
log = { version = "0.4"}
nom = "7.1.0"
lexical-sort = "0.3.1"
serde = { version = "1.0", features = ["derive","rc"] }
serde_json = "1.0"
biodivine-lib-bdd = "0.3.0"
derivative = "2.2.0"
[dev-dependencies]
test-log = "0.2"
env_logger = "0.9"
quickcheck = "1"
quickcheck_macros = "1"
[features]
default = ["adhoccounting", "variablelist" ]
adhoccounting = [] # count models ad-hoc - disable if counting is not needed
importexport = []
variablelist = [ "HashSet" ]
HashSet = []
[workspace]
members=[ "lib", "bin" ]
default-members = [ "lib" ]

View File

@ -14,7 +14,7 @@ name = "adf_bdd"
path = "src/main.rs"
[dependencies]
adf_bdd = { path = "../" }
adf_bdd = { path = "../lib", default-features = false }
clap = {version = "3.1.3", features = [ "derive", "cargo", "env" ]}
log = { version = "0.4", features = [ "max_level_trace", "release_max_level_info" ] }
serde = { version = "1.0", features = ["derive","rc"] }
@ -27,6 +27,8 @@ predicates = "2.1"
assert_fs = "1.0"
[features]
default = ["adhoccounting"]
adhoccounting = [] # count models ad-hoc - disable if counting is not needed
importexport = []
default = ["adhoccounting", "variablelist", "adf_bdd/default" ]
adhoccounting = ["adf_bdd/adhoccounting"] # count models ad-hoc - disable if counting is not needed
importexport = ["adf_bdd/importexport"]
variablelist = [ "HashSet", "adf_bdd/variablelist" ]
HashSet = ["adf_bdd/HashSet"]

44
lib/Cargo.toml Normal file
View File

@ -0,0 +1,44 @@
[package]
name = "adf_bdd"
version = "0.2.1"
authors = ["Stefan Ellmauthaler <stefan.ellmauthaler@tu-dresden.de>"]
edition = "2021"
repository = "https://github.com/ellmau/adf-obdd/"
license = "GPL-3.0-only"
exclude = ["res/", "./flake*", "flake.lock", "*.nix", ".envrc", "_config.yml", "tarpaulin-report.*", "*~"]
description = "Library to solve grounded, complete, and stable ADF-semantics by utilising OBDDs - ordered binary decision diagrams"
build = "build.rs"
[lib]
name="adf_bdd"
path = "src/lib.rs"
test = true
doctest = true # Documentation examples are tested by default.
bench = true # Is benchmarked by default.
doc = true # Is documented by default.
harness = true # Use libtest harness.
edition = "2021" # The edition of the target.
crate-type = ["lib"] # The crate types to generate.
[dependencies]
log = { version = "0.4"}
nom = "7.1.0"
lexical-sort = "0.3.1"
serde = { version = "1.0", features = ["derive","rc"] }
serde_json = "1.0"
biodivine-lib-bdd = "0.3.0"
derivative = "2.2.0"
[dev-dependencies]
test-log = "0.2"
env_logger = "0.9"
quickcheck = "1"
quickcheck_macros = "1"
[features]
default = ["adhoccounting", "variablelist" ]
adhoccounting = [] # count models ad-hoc - disable if counting is not needed
importexport = []
variablelist = [ "HashSet" ]
HashSet = []

1
lib/LICENSE Symbolic link
View File

@ -0,0 +1 @@
../LICENSE

1
lib/README.md Symbolic link
View File

@ -0,0 +1 @@
../README.md

View File

@ -17,7 +17,7 @@ fn gen_tests() {
let destination = Path::new(&out_dir).join("tests.rs");
let mut test_file = File::create(&destination).unwrap();
if let Ok(test_data_directory) = read_dir("./res/adf-instances/instances/") {
if let Ok(test_data_directory) = read_dir("../res/adf-instances/instances/") {
// write test file header, put `use`, `const` etc there
write_header(&mut test_file);

View File

@ -106,8 +106,10 @@ impl Bdd {
pub fn restrict(&mut self, tree: Term, var: Var, val: bool) -> Term {
let node = self.nodes[tree.0];
#[cfg(feature = "variablelist")]
if !self.var_deps[tree.value()].contains(&var) {
return tree;
{
if !self.var_deps[tree.value()].contains(&var) {
return tree;
}
}
#[allow(clippy::collapsible_else_if)]
// Readability of algorithm > code-elegance