macOS build support + exact small-weight counting (configurable CUDD epsilon)#2
Draft
HenryKautz wants to merge 1 commit into
Draft
macOS build support + exact small-weight counting (configurable CUDD epsilon)#2HenryKautz wants to merge 1 commit into
HenryKautz wants to merge 1 commit into
Conversation
…D epsilon)
Two independent, portability/correctness improvements. No change to the counting
algorithm; the Linux build path is unchanged.
1. Build on macOS (guarded by IF(APPLE), so the Linux flags are untouched):
- CMakeLists.txt: macOS clang cannot fully static-link (-static), and -Ofast
(-ffast-math) makes the -infinity log-space sentinel undefined behavior, so
the Apple branch uses "-g -O3"; non-Apple keeps "-g -Ofast -static".
- src/interface/util.hpp: add #include <sstream> (libstdc++ pulled it in
transitively, libc++ does not).
2. Exact counting for tiny weighted counts, exposed as --ep:
Counter::getModelCount now calls mgr.SetEpsilon(cuddEpsilon). CUDD's built-in
epsilon (1e-12) merges ADD terminals within that tolerance into the 0 terminal,
rounding legitimately tiny weighted counts (e.g. exp(-69) ~ 1e-30) down to 0.
The new --ep option sets this tolerance and defaults to 0 (exact, down to
double-precision underflow); pass --ep <e> to trade exactness for merging.
README documents the macOS build and the --ep / numerical behavior.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small, independent improvements. No change to the counting algorithm, and the Linux build path is unchanged (the build change is guarded by
IF(APPLE)).1. Build on macOS (Apple clang)
CMakeLists.txt(guarded byIF(APPLE)): macOS clang can't fully static-link (-static), and-Ofast(-ffast-math) makes ADDMC's-infinitylog-space sentinel undefined behavior — so the Apple branch uses-g -O3; non-Apple keeps the original-g -Ofast -static.src/interface/util.hpp: add#include <sstream>(used byformula.cpp/join.cpp; libstdc++ pulled it in transitively, libc++ does not).(One environment note, no code change: CMake ≥ 4 removed compatibility with
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12); configure with-DCMAKE_POLICY_VERSION_MINIMUM=3.5. Happy to bump the declared minimum instead if you prefer.)2. Exact counting for tiny weighted counts (
--ep)Counter::getModelCountnow callsmgr.SetEpsilon(cuddEpsilon). CUDD's built-in epsilon (1e-12) merges ADD terminals within that tolerance into the0terminal, which rounds legitimately tiny weighted counts down to0. With small literal weights a count can be far below1e-12(e.g.exp(-69) ≈ 1e-30):The new
--epoption sets the tolerance and defaults to0(exact, down to double-precision underflow); pass--ep <e>to trade exactness for the speed/memory of more terminal merging.These two parts are independent — happy to split into separate PRs if you'd rather take them separately. Opened as a draft for your consideration.
🤖 Generated with Claude Code