Metadata-Version: 2.4
Name: flamapy-dnnf
Version: 2.6.0.dev6
Summary: flamapy-dnnf is a plugin to flamapy providing exact analysis of feature models via d-DNNF knowledge compilation with the d4 compiler
Author-email: Flamapy <flamapy@us.es>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/flamapy/dnnf_metamodel
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: flamapy-fw~=2.6.0.dev5
Requires-Dist: flamapy-fm~=2.6.0.dev5
Requires-Dist: flamapy-sat~=2.6.0.dev5
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-mock; extra == "dev"
Requires-Dist: prospector; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Dynamic: license-file

# flamapy-dnnf

`flamapy-dnnf` is a [flamapy](https://flamapy.github.io) plugin for **exact** analysis of feature
models via **d-DNNF knowledge compilation**, using the [d4](https://github.com/crillab/d4) compiler.

d-DNNF (deterministic Decomposable Negation Normal Form) is a highly succinct compilation target
that supports exact, polytime model counting. It complements the ecosystem:

- `flamapy-bdd` — OBDD; exact, but can blow up on large models.
- `flamapy-sdd` — SDD; exact, more succinct than OBDD, pure-Python (PySDD).
- `flamapy-sharpsat` — ApproxMC; **approximate** count for very large models.
- `flamapy-dnnf` — d4/d-DNNF; **exact** count that scales to large industrial models.

## Requirements

d4 is a native C++ binary with **no PyPI package**. Install it from
<https://github.com/crillab/d4> and either put it on your `PATH` as `d4` or point
`FLAMAPY_D4_PATH` at the binary.

```
pip install flamapy-dnnf
export FLAMAPY_D4_PATH=/path/to/d4   # or have `d4` on PATH
```

## Operations

| Operation | Class |
|---|---|
| Exact number of configurations | `DDNNFConfigurationsNumber` |
| Satisfiable (non-void) | `DDNNFSatisfiable` |

## Usage

```python
from flamapy.metamodels.fm_metamodel.transformations import UVLReader
from flamapy.metamodels.dnnf_metamodel.transformations import FmToDDNNF
from flamapy.metamodels.dnnf_metamodel.operations import DDNNFConfigurationsNumber

fm = UVLReader('model.uvl').transform()
dnnf_model = FmToDDNNF(fm).transform()          # add compile=True to also dump the d-DNNF file
count = DDNNFConfigurationsNumber().execute(dnnf_model).get_result()
```

## License

GPL-3.0-or-later.
