Design specs for #P/PP-complete problem support#750
Open
Conversation
Two alternative designs for extending the trait hierarchy to support counting (#P) and threshold (PP-complete) problems: 1. CountingProblem trait (minimal extension) — adds a third leaf trait parallel to OptimizationProblem and SatisfactionProblem, with Weight<W> type, CountingSolver, and ReduceToCount. 2. Generalized aggregation (full unification) — replaces all leaf traits with a single Aggregate monoid trait. Metric types (Max, Min, Sum, Or, And) encode the aggregation strategy directly. One Solver::solve method via fold. Supersedes design 1. Unblocks: #235, #237, #404, #405, #256, #257, #394, #395 Related: #737, #748 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #750 +/- ##
=======================================
Coverage 97.58% 97.58%
=======================================
Files 415 415
Lines 51632 51632
=======================================
Hits 50386 50386
Misses 1246 1246 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Two design specs for extending the trait hierarchy to support counting (#P-complete) and threshold (PP-complete) problems, which currently block 8 issues.
docs/plans/2026-03-22-counting-problem-trait-design.md— Minimal extension: addsCountingProblemas a third leaf trait withWeight<W>,CountingSolver, andReduceToCount. Small diff, no changes to existing code.docs/plans/2026-03-22-generalized-aggregation-design.md— Full unification: replaces all leaf traits (OptimizationProblem,SatisfactionProblem) with a singleAggregatemonoid trait. Metric types (Max,Min,Sum,Or,And) encode the aggregation strategy directly. OneSolver::solvemethod via fold. Supersedes design 1.Blocked issues this unblocks
Models: #235 NetworkReliability, #237 NetworkSurvivability, #404 KthLargestSubset, #405 KthLargestMTuple
Rules: #256 SteinerTree → NetworkReliability, #257 VertexCover → NetworkSurvivability, #394 SubsetSum → KthLargestSubset, #395 SubsetSum → KthLargestMTuple
Related
Test plan
🤖 Generated with Claude Code