Commit fb9c608
feat: Decision wrapper for optimization→decision conversion (#1014)
* docs: add Decision wrapper design spec and implementation plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add OptimizationValue trait for Min/Max decision conversion
* feat: add Decision<P> generic wrapper with Problem impl
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add ReduceToAggregate<P> impl for Decision<P>
Implements the aggregate reduction from Decision<P> to P that
extracts the optimization value by comparing against the threshold.
This is Task 3 of the decision-wrapper plan.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: extract_type_name handles Decision<T> nested generics
* feat: register Decision variants for MVC and MDS
* refactor: remove hand-written VertexCover, replaced by Decision<MinimumVertexCover>
* feat: add golden-section search solver via Decision queries
* docs: migrate VertexCover paper entry and example_db to DecisionMinimumVertexCover
* chore: integration fixups for Decision wrapper
* fix: address PR #1014 review comments and quality issues
- Add register_decision_variant! macro to reduce per-type boilerplate (~80 lines each for MVC/MDS)
- Add Decision<MinimumDominatingSet> behavioral tests (creation, evaluate, reduction, solver)
- Add boundary test for reduce_to_aggregate with infeasible bound
- Rename golden_section.rs to decision_search.rs (binary search, not golden section)
- Fix schema-driven CLI creation for Decision types (restructure flat JSON to nested {inner, bound})
- Add canonical rule example specs for Decision→Optimization aggregate edges
- Update example_db test to handle aggregate-only reduction paths
- Filter trivial Decision<P>↔P edges from paper completeness check
- Remove plan files
- Generalize DecisionProblemMeta to blanket impl per optimization model
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: relax flaky kclique_ilp assertion (ILP may return larger valid clique)
The K4 graph with k=3 has both size-3 and size-4 valid cliques.
The ILP solver nondeterministically picks either, so assert >= k
instead of == k.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add Turing (multi-query) reduction edges for Optimization → Decision
Registers P → Decision<P> as a Turing reduction edge — representing
that solving an optimization problem via its decision version requires
multiple adaptive queries (binary search over the bound).
- Add `turing` field to EdgeCapabilities and ReductionMode::Turing
- Register reverse Turing edges in register_decision_variant! macro
- Export turing flag in JSON graph
- Turing edges excluded from rule example coverage (no single-shot demo)
- Add tests for MVC→DecisionMVC and MDS→DecisionMDS Turing edges
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: parameterize register_decision_variant! size fields
The macro previously hardcoded num_vertices/num_edges as size getters,
which only works for graph problems. Now accepts dims, fields, and
size_getters as parameters so non-graph Decision variants can specify
their own problem-size fields (e.g., num_vars/num_clauses for SAT).
Callers define inherent methods on Decision<P> before invoking the macro.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: update CLAUDE.md and add-model skill for Decision wrapper
- Document Decision<P> wrapper, OptimizationValue trait, decision_search solver
- Document EdgeCapabilities.turing field and ReductionMode::Turing
- Document register_decision_variant! macro with dims/fields/size_getters params
- Document Decision↔P completeness filter in paper section
- Add anti-pattern entry in add-model skill: use Decision<P> not hand-written models
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: CLI compat for Decision types (--k alias, MDS example)
- Map --k to --bound for Decision types in schema_field_flag_keys
so `pred create VC --k 2` works (backward compat with old VertexCover)
- Add canonical model example for DecisionMinimumDominatingSet
so `pred create --example DecisionMinimumDominatingSet` works
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: remove backward-compat aliases (VertexCover/VC/--k)
Breaking changes are allowed at this stage. Remove:
- VertexCover and VC aliases from DecisionMinimumVertexCover schema
- --k → --bound mapping for Decision types
- Replace with DMVC alias
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Typst syntax errors in paper completeness filter
- Use if/else instead of `not ... and` (Typst precedence issue)
- Fix RR_ge → RR_(gt.eq 0) in DecisionMVC math notation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 07caf14 commit fb9c608
File tree
30 files changed
+1260
-326
lines changed- .claude
- skills/add-model
- docs/paper
- problemreductions-cli/src
- commands
- create
- mcp
- problemreductions-macros/src
- src
- models
- graph
- rules
- solvers
- unit_tests
- models
- graph
- registry
- rules
- solvers
30 files changed
+1260
-326
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| 126 | + | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
| 140 | + | |
| 141 | + | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| |||
171 | 180 | | |
172 | 181 | | |
173 | 182 | | |
174 | | - | |
175 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
176 | 186 | | |
177 | 187 | | |
178 | 188 | | |
179 | 189 | | |
180 | 190 | | |
181 | | - | |
| 191 | + | |
| 192 | + | |
182 | 193 | | |
183 | 194 | | |
184 | 195 | | |
| |||
195 | 206 | | |
196 | 207 | | |
197 | 208 | | |
198 | | - | |
199 | | - | |
| 209 | + | |
| 210 | + | |
200 | 211 | | |
201 | 212 | | |
202 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| 314 | + | |
314 | 315 | | |
315 | 316 | | |
316 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| |||
234 | 244 | | |
235 | 245 | | |
236 | 246 | | |
237 | | - | |
| 247 | + | |
238 | 248 | | |
239 | 249 | | |
240 | 250 | | |
| |||
649 | 659 | | |
650 | 660 | | |
651 | 661 | | |
652 | | - | |
| 662 | + | |
| 663 | + | |
653 | 664 | | |
654 | 665 | | |
655 | | - | |
| 666 | + | |
656 | 667 | | |
657 | 668 | | |
658 | 669 | | |
659 | | - | |
660 | | - | |
| 670 | + | |
| 671 | + | |
661 | 672 | | |
662 | | - | |
| 673 | + | |
663 | 674 | | |
664 | | - | |
| 675 | + | |
665 | 676 | | |
666 | 677 | | |
667 | | - | |
| 678 | + | |
668 | 679 | | |
669 | 680 | | |
670 | 681 | | |
| |||
13086 | 13097 | | |
13087 | 13098 | | |
13088 | 13099 | | |
| 13100 | + | |
| 13101 | + | |
| 13102 | + | |
| 13103 | + | |
13089 | 13104 | | |
13090 | | - | |
| 13105 | + | |
| 13106 | + | |
13091 | 13107 | | |
13092 | 13108 | | |
13093 | 13109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
672 | 673 | | |
673 | 674 | | |
674 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
675 | 689 | | |
676 | 690 | | |
677 | 691 | | |
| |||
1787 | 1801 | | |
1788 | 1802 | | |
1789 | 1803 | | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
1790 | 1861 | | |
1791 | 1862 | | |
1792 | 1863 | | |
| |||
1848 | 1919 | | |
1849 | 1920 | | |
1850 | 1921 | | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
1855 | | - | |
1856 | | - | |
1857 | | - | |
1858 | | - | |
1859 | | - | |
1860 | | - | |
1861 | | - | |
1862 | | - | |
1863 | | - | |
1864 | | - | |
1865 | | - | |
1866 | | - | |
1867 | | - | |
1868 | | - | |
1869 | | - | |
1870 | | - | |
1871 | | - | |
1872 | | - | |
1873 | | - | |
1874 | 1922 | | |
1875 | 1923 | | |
1876 | 1924 | | |
| |||
2232 | 2280 | | |
2233 | 2281 | | |
2234 | 2282 | | |
2235 | | - | |
| 2283 | + | |
2236 | 2284 | | |
2237 | 2285 | | |
2238 | 2286 | | |
| |||
0 commit comments