Repository navigation
docs(z3,#10605): README example for ExactlyOne + pb-bench measurement harness - #22
Merged
Merged
Conversation
… harness Scope: documentation + measurement harness for the unweighted Pseudo-Boolean DSL surface added in #20 (PR feature/c8247-z3linq-pb-exactlyone). README: new section 'Problem - Planning a Single Meal from a Menu' demonstrates Z3Methods.ExactlyOne(...) on a 5-recipe one-hot, matching notebook 09's planner instance. Documents the three new magic methods (ExactlyOne / AtMostOne / AtLeastOne) and their native MkPBGe mapping. pb-bench: standalone harness comparing native MkPBGe vs MkIte+MkAdd expansion on the Exactly-One pattern (n=10/50/100, SAT + UNSAT). Measurement result: native PB ~half the AST, ~2.3x smaller SMT-LIB, 3-6x faster solver check on n=100 UNSAT (9ms vs 56ms). Justifies #20's dedicated DSL surface against the 'MkIte+Add is enough' alternative. See #10605.
jsboige
changed the base branch from
feature/c8247-z3linq-pb-exactlyone
to
main
August 17, 2026 22:02
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.
Closes #10605 / c.8248 (documentation + measurement grain, complements PR #20's implementation).
Scope
Documentation + measurement harness for the unweighted Pseudo-Boolean DSL surface added in #20 (PR
feature/c8247-z3linq-pb-exactlyone).1.
README.md— new example sectionAdded
### Problem - Planning a Single Meal from a Menubetween the existing examples and## Getting Started. DemonstratesZ3Methods.ExactlyOne(...)on a 5-recipe one-hot (matching notebook 09's planner instance) and documents the three new magic methods (ExactlyOne / AtMostOne / AtLeastOne) and their nativeMkPBGemapping.Anti-régression: existing example sections (Propositional Logic, Linear Algebra, Oil Purchasing, Shipping) untouched. +33 lines net.
2.
solutions/pb-bench/— measurement harnessStandalone console app comparing native
MkPBGevsMkIte+MkAddexpansion on the Exactly-One pattern (n=10/50/100, SAT + UNSAT). Reference: issue #10605 criterion #1 ("mesurer, ne pas supposer").Measurement (rerun on this branch)
Native
MkPBGeis measurably cheaper:MkIte+MkAddis 2N+1 nodes)Conclusion: the dedicated DSL surface (PR #20) is not optional — its native Z3 Pseudo-Boolean propagation beats the
MkIteexpansion by an order of magnitude on the planner instance, and the win grows with n.Validation
dotnet run --project pb-bench/pb-bench.csprojruns cleanly, output matches the table abovedotnet buildonsolutions/Z3.Linq.sln+pb-benchclean (0 warnings, 0 errors)Out of scope
MkPBGewith weights ≠ 1, plusMkPBEq/MkPBLe) — issue #10605 body restricts the unweighted case used by notebook 09; the weighted case needs a separate design discussion (signature, semantic).Z3Methods.cs/ExpressionVisitor.cs— already in PR feat(z3,#10605): unweighted Pseudo-Boolean (ExactlyOne/AtMostOne/AtLeastOne) → MkPBGe #20.jsboige/CoursIA) — separate PRs post-merge, tracked in the issue body §"Travail demandé".Suite c.8249 (prochain cycle, on the main repo)
MyIA.AI.Notebooks/SymbolicAI/SMT/Z3-Linq2Z3/09_Meal_Planner_Convergence_Scale.ipynb) — add a## PB — one-hot déclaratif (DSL ExactlyOne)section rewriting the rawMkPB*cells asZ3Methods.ExactlyOne(...). Anti-régression: keep the raw cells (comparison term).jsboige/CoursIAto track this fork's main post-merge.See #10605.