Commit 3ee5da8
Design: trait system refactoring for contributor ergonomics (#50)
* docs: add trait system refactoring design plan
Design for simplifying types and interfaces to lower the contributor
barrier. Key changes: NumericSize supertrait, Weights trait (with real
Unweighted type), minimal Problem trait (dims + evaluate), removal of
CSP trait, and trait-bound-based macro extraction.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: add trait refactoring implementation plan
12-task plan with TDD approach: NumericSize/Weights traits, ProblemV2
minimal trait (dims + evaluate), OptimizationProblemV2, simplified
ReductionResult, trait-bound-based macro, and parallel migration strategy.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* save
* feat: add NumericSize trait, Weights trait, and refactored Unweighted
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2, OptimizationProblemV2, and Direction
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ReductionResultV2 and ReduceToV2 traits
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impl for MaximumIndependentSet (proof of concept)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impl for MinimumVertexCover
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impl for MaximumClique
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impl for MaxCut
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impl for MaximumMatching
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impl for MinimumDominatingSet
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impl for MaximalIS
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impl for KColoring
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add ProblemV2 impls for all remaining models
Add ProblemV2 and OptimizationProblemV2 implementations for:
- Optimization: QUBO, SpinGlass, ILP
- Satisfiability: Satisfiability (SAT), KSatisfiability (KSAT)
- Set: MaximumSetPacking, MinimumSetCovering
- Specialized: CircuitSAT, Factoring, PaintShop, BMF, BicliqueCover
Pattern: Maximization problems return W::min_value() for invalid configs,
minimization problems return W::max_value(), satisfaction problems use
Metric=bool. All models now have ProblemV2 impls.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add SolverV2 trait and BruteForce impl with DimsIterator
Add SolverV2 trait with three methods: find_best_v2 for optimization,
find_satisfying and find_all_satisfying for satisfaction problems.
Add DimsIterator for per-variable dimension enumeration.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: suppress unknown clippy lint warnings
Add #[allow(unknown_lints)] before clippy::manual_is_multiple_of
which is only available in newer clippy versions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* style: apply rustfmt formatting
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: add claude-output.log to .gitignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: add SolutionSize enum implementation plan
* feat: add SolutionSize enum for explicit validity tracking
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add is_better method to SolutionSize for direction-aware comparison
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: update Solver trait and OptimizationProblem for is_better
- Add is_better method to OptimizationProblem trait for direction-aware
metric comparison
- Remove NumericSizeBounds constraint from Solver::find_best
- Remove find_all_satisfying from Solver trait (keep as internal method)
- Update BruteForce to use problem.is_better() instead of direct comparison
- Remove is_infeasible_metric helper and find_best_float method
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: migrate entire codebase to SolutionSize enum
- Update all graph models (MIS, MVC, MaxCut, etc.)
- Update set models (MaximumSetPacking, MinimumSetCovering)
- Update optimization models (SpinGlass, QUBO, ILP)
- Update specialized models (PaintShop, BMF, BicliqueCover)
- Update all reduction rules to handle SolutionSize
- Update examples and tests for new API
- Remove f64 variant tests (SolutionSize requires Ord)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: remove unused BruteForce fields and fix clippy warning
- Remove atol/rtol fields (no longer needed without find_best_float)
- Remove approx_equal method (dead code)
- Fix needless_borrow warning in example
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: convert example tests to direct calls, clean up reduction macro, update docs
- Convert 30 example subprocess tests to direct function calls via include!
(examples expose pub fn run(), test harness calls directly — ~40s → ~17s)
- Remove redundant source_graph/target_graph from all #[reduction] macros
(SimpleGraph is the default, no override needed)
- Update .claude/CLAUDE.md trait hierarchy for new API
- Rewrite .claude/rules/ to point to reference source files instead of
inline snippets that drift when the API changes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: simplify OptimizationProblem trait and unify all metrics to SolutionSize
Remove is_better/is_feasible from OptimizationProblem - they are now
derived from the metric type and direction. Add supertrait bound
Problem<Metric = SolutionSize<Self::Value>> so the solver calls
metric.is_valid() and metric.is_better() directly.
- Remove NumericSizeBounds trait (dead code)
- Migrate 8 unconstrained models (SpinGlass, QUBO, BMF, etc.) from raw W/i32 to SolutionSize<W>
- Migrate 3 constrained models from sentinel values to SolutionSize::Invalid
- Unify cut_size/compute_cut_weight into single public cut_size function
- Update all tests, examples, and documentation
Each model's OptimizationProblem impl shrinks from ~15 lines to ~4 lines.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: address PR review comments
- Relax KColoring W bounds to Clone + Default + 'static (W unused in logic)
- Panic on unbounded ILP variables in dims() instead of silent failure
- Fix extra space in minimumvertexcover_minimumsetcovering test
- Remove duplicate test_dims_iterator_zero_dim in config.rs
- Restore variant_to_map calls in all 21 example files (was exporting empty maps)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent bf0c0e6 commit 3ee5da8
181 files changed
Lines changed: 7006 additions & 7164 deletions
File tree
- .claude
- rules
- benches
- docs
- paper
- plans
- examples
- src
- models
- graph
- optimization
- satisfiability
- set
- specialized
- registry
- rules
- solvers
- testing
- topology
- unit_tests
- models
- graph
- optimization
- satisfiability
- set
- specialized
- registry
- rules
- solvers
- ilp
- testing
- unitdiskmapping_algorithms
- tests
- suites
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
55 | 59 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
97 | | - | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | | - | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
17 | 37 | | |
18 | 38 | | |
19 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
39 | 50 | | |
40 | 51 | | |
41 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
15 | 27 | | |
16 | 28 | | |
17 | 29 | | |
| |||
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
28 | 52 | | |
29 | 53 | | |
30 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
213 | | - | |
| 214 | + | |
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
| |||
0 commit comments