Native BDD construction for flamapy: Logic2BDD by David Fernández-Amorós (UNED) on his modified version of CUDD 3.0, packaged as a Python extension.
Logic2BDD builds the BDD of a set of propositional constraints clause by clause. It groups
related variables, schedules the constraints and reorders variables dynamically with
range-restricted sifting. It handles feature models that the pure-Python BDD engines cannot.
The BDD comes back in DDDMP text format, which flamapy-bdd loads with any dd engine.
pip install flamapy-cuddfrom flamapy_cudd import compile_bdd
dddmp = compile_bdd(["root", "a", "b"], ["root", "(a -> root)", "(b -> root)", "mux(a, b)"])flamapy-bdd (2.9 and later) uses this package when it is installed and the native builder
is selected, either with the FLAMAPY_BDD_BUILDER environment variable or in code:
pip install flamapy-bdd flamapy-cudd
export FLAMAPY_BDD_BUILDER=native # or "auto": native when available, else pure Pythonfrom flamapy.metamodels.bdd_metamodel.transformations import FmToBDD
bdd_model = FmToBDD(feature_model, builder="native").transform()Without flamapy-cudd, flamapy-bdd builds BDDs in pure Python.
Wheels are published for CPython 3.9–3.14 on Linux (x86_64, aarch64), macOS (Intel, Apple Silicon) and Windows (AMD64). A WebAssembly wheel for Pyodide 0.26 (used by the flamapy IDE) is attached to each GitHub release.
vendor/cudd: CUDD 3.0.0. The first commit has the upstream sources unchanged; the next ones apply David Fernández-Amorós's changes. Thedddmppackage of CUDD is not included (see Building).src/logic2bdd: Logic2BDD, the library API (api.hpp), a DDDMP text writer that only uses CUDD's public API (dddmpText.hpp) and the generated parser (generated/; regenerate it with Bison ≥ 3 and flex when the grammar changes, and keep the MSVCssize_ttypedef ingenerated/FlexLexer.h).src/python,python/flamapy_cudd: the Python extension.
pip install . # the Python extension (scikit-build-core + CMake)
cmake -S . -B build && cmake --build build # the logic2bdd command-line toolThe command-line tool reads and writes BDD files (-in, -out) only when it is built with
dddmp, which is not open source and is not part of this repository. Point the build at the
dddmp directory of the CUDD 3.0.0 sources to enable it:
cmake -S . -B build -DCUDD_NATIVE_WITH_DDDMP=ON -DCUDD_NATIVE_DDDMP_DIR=/path/to/cudd-3.0.0/dddmpLogic2BDD and the changes to CUDD were written by David Fernández-Amorós (UNED). The flamapy team packaged them as a library and a Python extension. If you use this package in research, please cite:
D. Fernández-Amorós, S. Bra, E. Aranda-Escolástico and R. Heradio, “Using Extended Logical Primitives for Efficient BDD Building,” Mathematics, vol. 8, no. 8, p. 1253, 2020. https://doi.org/10.3390/math8081253
@article{FernandezAmoros2020,
author = {Fern{\'a}ndez-Amor{\'o}s, David and Bra, Sergio and Aranda-Escol{\'a}stico, Ernesto and Heradio, Ruben},
title = {Using Extended Logical Primitives for Efficient {BDD} Building},
journal = {Mathematics},
volume = {8},
number = {8},
pages = {1253},
year = {2020},
doi = {10.3390/math8081253}
}BSD 3-Clause; see LICENSE. Logic2BDD and the CUDD changes are © David Fernández-Amorós;
CUDD is © the University of Colorado; the packaging is © the flamapy authors.