Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

milestone/nogoods #74

Merged
merged 54 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9d0845c
Add NoGood and NoGoodStore (#65)
ellmau Jun 15, 2022
795d8ab
Fix issue with nogoods module definition in lib
ellmau Jun 15, 2022
4eb54e7
Fix issues with inconsistencies
ellmau Jun 16, 2022
8059590
Add closure of conclusions of an interpretation and a NoGoodStore
ellmau Jun 17, 2022
ced0b3a
flake.lock: Update
ellmau Jun 17, 2022
670a604
Update Flake to nix 22.05
ellmau Jun 17, 2022
3ce1b54
Add nogood-algorithm to the ADF
ellmau Jun 20, 2022
f6f922d
Fix typo in Readme
ellmau Jun 21, 2022
fa9e622
Add public api for the nogood-learner
ellmau Jun 21, 2022
dece879
Add missing heuristics module to git
ellmau Jun 21, 2022
57cdb46
Fix rustfmt
ellmau Jun 21, 2022
273973f
Update to trigger a new rustfmt
ellmau Jun 21, 2022
f99d617
Updated rustfmt to match the version on the server-CI
ellmau Jun 21, 2022
e78cd57
Update lib/src/nogoods.rs
ellmau Jun 21, 2022
e7f38c1
Fix rustfmt
ellmau Jun 21, 2022
e7d9291
Add direnv to gitignore
ellmau Jun 21, 2022
d68d6cc
Ignore perf data (gitignore)
ellmau Jun 21, 2022
5da2c2c
Avoid a Box, support custom heuristics functions
mmarx Jun 21, 2022
86084d7
Add ng option with heu to binary
ellmau Jun 22, 2022
4eabf16
Optimise ng learner further on and fix a verification bug
ellmau Jun 23, 2022
0dc35d3
Fix tests, which are changed due to the new feature flag
ellmau Jun 23, 2022
55e6c30
Add new heuristic
ellmau Jun 24, 2022
83b403b
Modified heuristics
ellmau Jun 24, 2022
7726d27
Merge remote-tracking branch 'origin/main' into milestone/nogoods
ellmau Jul 18, 2022
c6f112b
Add crossbeam-channel to represent an output-stream of stable models
ellmau Jul 26, 2022
80e1ca9
Add test-case to show multi-threaded use of the ng solver
ellmau Jul 26, 2022
6215573
Add better test coverage
ellmau Jul 26, 2022
ea10436
Fix broken links in rust-doc
ellmau Jul 26, 2022
1163f30
Update Readme for lib to reflect the new NoGood API
ellmau Jul 26, 2022
92a53c4
Merge branch 'main' into milestone/nogoods
ellmau Jul 26, 2022
e1b9eeb
Add metadata to bin/Cargo.toml, add features
ellmau Jul 26, 2022
00674f7
Fix facet count tests
ellmau Jul 26, 2022
84aa627
Add multithread-safe functionality for the dictionary/ordering
ellmau Jul 27, 2022
c531413
Add first documentation structure
ellmau Jul 27, 2022
65de129
mv gh-pages to docs
ellmau Jul 27, 2022
b38c64a
Fix docs string
ellmau Jul 27, 2022
d4465fe
Simple version of gh pages
ellmau Jul 27, 2022
2b86e74
Fix some style issues
ellmau Jul 27, 2022
fa52a02
Added more links and information to the landing page
ellmau Jul 27, 2022
30c0ca6
Fix badges in the app-doc
ellmau Jul 27, 2022
44d41ec
Add two valued interpretation
ellmau Jul 28, 2022
e2e77ea
Refactor nogood-algorithm name
ellmau Jul 28, 2022
ab515e6
Update README.md
ellmau Jul 28, 2022
5fc720d
Fix link to binary and library subfolder
ellmau Jul 28, 2022
20131d7
Update main
ellmau Jul 28, 2022
c234bd4
Fix cli-test
ellmau Jul 28, 2022
deb7282
Update lib/README to match lib-documentation
ellmau Jul 29, 2022
e70d55f
Update Version to 0.3.0
ellmau Jul 29, 2022
e4c5718
Update Documentation navigation (#81)
ellmau Jul 29, 2022
c276372
Merge branch 'main' into milestone/nogoods
ellmau Aug 1, 2022
fac10dd
flake.lock: Update
ellmau Aug 2, 2022
b3b2632
Add type alias for NoGood
ellmau Aug 2, 2022
154b975
Apply review comments
ellmau Aug 2, 2022
5bada6f
Add documentation information about later revisions on VarContainer
ellmau Aug 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ tramp
*_flymake*

/tests/out/

# Ignore direnv data
/.direnv/

# ignore perfdata
perf.data
117 changes: 79 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 14 additions & 100 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,67 +8,23 @@
![Crates.io](https://img.shields.io/crates/l/adf_bdd)
[![GitHub Discussions](https://img.shields.io/github/discussions/ellmau/adf-obdd)](https://github.com/ellmau/adf-obdd/discussions) ![rust-edition](https://img.shields.io/badge/Rust--edition-2021-blue?logo=rust)

# Abstract Dialectical Frameworks solved by Binary Decision Diagrams; developed in Dresden (ADF-BDD)
# Abstract Dialectical Frameworks solved by (ordered) Binary Decision Diagrams; developed in Dresden (ADF-oBDD project)

This project is currently split into two parts:
- a [binary (adf-bdd)](bin), which allows one to easily answer semantics questions on abstract dialectical frameworks
- a [library (adf_bdd)](lib), which contains all the necessary algorithms and an open API which compute the answers to the semantics questions

Latest documentation of the API can be found [here](https://docs.rs/adf_bdd/latest/adf_bdd/).
The current version of the binary can be downloaded [here](https://github.com/ellmau/adf-obdd/releases).

Do not hesitate to report bugs or ask about features in the [issues-section](https://github.com/ellmau/adf-obdd/issues) or have a conversation about anything of the project in the [discussion space](https://github.com/ellmau/adf-obdd/discussions)


## Abstract Dialectical Frameworks
An abstract dialectical framework (ADF) consists of abstract statements. Each statement has an unique label and might be related to other statements (s) in the ADF. This relation is defined by a so-called acceptance condition (ac), which intuitively is a propositional formula, where the variable symbols are the labels of the statements. An interpretation is a three valued function which maps to each statement a truth value (true, false, undecided). We call such an interpretation a model, if each acceptance condition agrees to the interpration.
## Ordered Binary Decision Diagram
An ordered binary decision diagram is a normalised representation of binary functions, where satisfiability- and validity checks can be done relatively cheap.

## Usage of the binary
```
USAGE:
adf_bdd [OPTIONS] <INPUT>

ARGS:
<INPUT> Input filename

OPTIONS:
--an Sorts variables in an alphanumeric manner
--com Compute the complete models
--counter <COUNTER> Set if the (counter-)models shall be computed and printed,
possible values are 'nai' and 'mem' for naive and memoization
repectively (only works in hybrid and naive mode)
--export <EXPORT> Export the adf-bdd state after parsing and BDD instantiation to
the given filename
--grd Compute the grounded model
-h, --help Print help information
--import Import an adf- bdd state instead of an adf
--lib <IMPLEMENTATION> choose the bdd implementation of either 'biodivine', 'naive', or
hybrid [default: hybrid]
--lx Sorts variables in an lexicographic manner
-q Sets log verbosity to only errors
--rust_log <RUST_LOG> Sets the verbosity to 'warn', 'info', 'debug' or 'trace' if -v and
-q are not use [env: RUST_LOG=debug]
--stm Compute the stable models
--stmca Compute the stable models with the help of modelcounting using
heuristics a
--stmcb Compute the stable models with the help of modelcounting using
heuristics b
--stmpre Compute the stable models with a pre-filter (only hybrid lib-mode)
--stmrew Compute the stable models with a single-formula rewriting (only
hybrid lib-mode)
--stmrew2 Compute the stable models with a single-formula rewriting on
internal representation(only hybrid lib-mode)
-v Sets log verbosity (multiple times means more verbose)
-V, --version Print version information
```

Note that import and export only works if the naive library is chosen

Right now there is no additional information to the computed models, so if you use `--com --grd --stm` as the command line arguments the borders between the results are not obviously communicated.
They can be easily identified though:
- The computation is always in the same order
- grd
- com
- stm
- We know that there is always exactly one grounded model
- We know that there always exist at least one complete model (i.e. the grounded one)
- We know that there does not need to exist a stable model
- We know that every stable model is a complete model too


## Input-file format:
Each statement is defined by an ASP-style unary predicate s, where the enclosed term represents the label of the statement.
The binary predicate ac relates each statement to one propositional formula in prefix notation, with the logical operations and constants as follows:
Expand All @@ -82,64 +38,22 @@ The binary predicate ac relates each statement to one propositional formula in p

# Features

`adhoccounting` will cache the modelcount on-the-fly during the construction of the BDD
- `adhoccounting` will cache the modelcount on-the-fly during the construction of the BDD
- `adhoccountmodels` allows in addition to compute the models ad-hoc too. Note that the memoization approach for modelcounting does not work correctly if `adhoccounting` is set and `adhoccountmodels` is not.

# Development notes
Additional information for contribution, testing, and development in general can be found here.
## Contributing to the project
You want to help and contribute to the project? That is great. Please see the [contributing guidelines](https://github.com/ellmau/adf-obdd/blob/main/.github/CONTRIBUTING.md) first.

## Building the binary:
To build the binary, you need to run
```bash
$> cargo build --workspace --release
```

To build the binary with debug-symbols, run
```bash
$> cargo build --workspace
```

## Testing with the `res` folder:
To run all the tests placed in the submodule you need to run
```bash
$> git submodule init
```
at the first time.
Afterwards you need to update the content of the submodule to be on the currently used revision by
```bash
$> git submodule update
```

The tests can be started by using the test-framework of cargo, i.e.
```bash
$> cargo test
```
Note that some of the instances are quite big and it might take some time to finish all the tests.
If you do not initialise the submodule, tests will "only" run on the other unit-tests and (possibly forthcoming) other integration tests.
Due to the way of the generated test-modules you need to call
```bash
$> cargo clean
```
if you change some of your test-cases.

To remove the tests just type
```bash
$> git submodule deinit res/adf-instances
```
or
```bash
$> git submodule deinit --all
```

# Acknowledgements
This work is partly supported by Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) in projects number 389792660 (TRR 248, [Center for Perspicuous Systems](https://www.perspicuous-computing.science/)),
the Bundesministerium für Bildung und Forschung (BMBF, Federal Ministry of Education and Research) in the
[Center for Scalable Data Analytics and Artificial Intelligence](https://www.scads.de) (ScaDS.AI),
and by the [Center for Advancing Electronics Dresden](https://cfaed.tu-dresden.de) (cfaed).

# Affiliation
This work has been party developed by the [Knowledge-Based Systems Group](http://kbs.inf.tu-dresden.de/), [Faculty of Computer Science](https://tu-dresden.de/ing/informatik) of [TU Dresden](https://tu-dresden.de).
This work has been partly developed by the [Knowledge-Based Systems Group](http://kbs.inf.tu-dresden.de/), [Faculty of Computer Science](https://tu-dresden.de/ing/informatik) of [TU Dresden](https://tu-dresden.de).

# Disclaimer
Hosting content here does not establish any formal or legal relation to TU Dresden
Hosting content here does not establish any formal or legal relation to TU Dresden.
14 changes: 10 additions & 4 deletions bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[package]
name = "adf_bdd-solver"
version = "0.2.4"
name = "adf-bdd-solver"
version = "0.3.0"
authors = ["Stefan Ellmauthaler <[email protected]>"]
edition = "2021"
homepage = "https://ellmau.github.io/adf-obdd"
repository = "https://github.com/ellmau/adf-obdd"
license = "MIT"
exclude = ["res/", "./flake*", "*.nix", ".envrc", "_config.yml"]
exclude = ["res/", "./flake*", "*.nix", ".envrc", "_config.yml", "tarpaulin-report.*", "*~"]
description = "Solver for ADFs grounded, complete, and stable semantics by utilising OBDDs - ordered binary decision diagrams"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -14,12 +16,14 @@ name = "adf-bdd"
path = "src/main.rs"

[dependencies]
adf_bdd = { version="0.2.4", default-features = false }
adf_bdd = { version="0.3.0", path="../lib", default-features = false }
clap = {version = "3.2.12", features = [ "derive", "cargo", "env" ]}
log = { version = "0.4", features = [ "max_level_trace", "release_max_level_info" ] }
serde = { version = "1.0", features = ["derive","rc"] }
serde_json = "1.0"
env_logger = "0.9"
strum = { version = "0.24" }
crossbeam-channel = "0.5"

[dev-dependencies]
assert_cmd = "2.0"
Expand All @@ -32,3 +36,5 @@ adhoccounting = ["adf_bdd/adhoccounting"] # count models ad-hoc - disable if
importexport = ["adf_bdd/importexport"]
variablelist = [ "HashSet", "adf_bdd/variablelist" ]
HashSet = ["adf_bdd/HashSet"]
adhoccountmodels = ["adf_bdd/adhoccountmodels"]
benchmark = ["adf_bdd/benchmark"]
Loading