Skip to content

Commit e9f6077

Browse files
zazabapclaudeGiggleLiu
authored
Fix #491: Add ExactCoverBy3Sets model (#603)
* Add plan for #491: ExactCoverBy3Sets model * Implement #491: Add ExactCoverBy3Sets model Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove plan file after implementation * Fix Copilot review: validate distinct elements and sort triples in X3C - Sort each triple on construction to enforce the "sorted triple" invariant - Validate that each subset contains 3 distinct elements - Add CLI validation before calling new() to avoid panics Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add ExactCoverBy3Sets to CLAUDE.md architecture section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(x3c): close review gaps * fix: remove duplicate display-name entries and add missing coverage test Remove 3 duplicate display-name entries (OptimalLinearArrangement, RuralPostman, LongestCommonSubsequence) introduced by merge conflict in reductions.typ. Add missing should_panic test for duplicate-element validation in X3C constructor. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: load X3C paper example from models.json, add load-model-example helper Add load-model-example() Typst function (mirrors load-example() for rules) that loads canonical model examples from generated models.json. Rewrite the ExactCoverBy3Sets problem-def example to derive all concrete values from JSON instead of hand-writing them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: migrate all paper examples to load from JSON, add CLI X3C example - Migrate 28 problem-def example sections in reductions.typ to use load-model-example() instead of hand-written data. All concrete values now derived from models.json via Typst expressions. - Add load-model-example() helper (mirrors load-example() for rules) - Add concrete X3C example to CLI help text and docs/src/cli.md - 10 problems without models.json entries remain hand-written: GraphPartitioning, OptimalLinearArrangement, BinPacking, Knapsack, RuralPostman, SubgraphIsomorphism, LongestCommonSubsequence, SubsetSum, MinimumFeedbackArcSet, FlowShopScheduling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: GiggleLiu <cacate0129@gmail.com>
1 parent 5bd4da9 commit e9f6077

16 files changed

Lines changed: 1721 additions & 762 deletions

File tree

docs/paper/reductions.typ

Lines changed: 1089 additions & 643 deletions
Large diffs are not rendered by default.

docs/src/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ pred create SpinGlass --graph 0-1,1-2 -o sg.json
274274
pred create MaxCut --graph 0-1,1-2,2-0 -o maxcut.json
275275
pred create Factoring --target 15 --bits-m 4 --bits-n 4 -o factoring.json
276276
pred create Factoring --target 21 --bits-m 3 --bits-n 3 -o factoring2.json
277+
pred create X3C --universe 9 --sets "0,1,2;0,2,4;3,4,5;3,5,7;6,7,8;1,4,6;2,5,8" -o x3c.json
277278
```
278279

279280
Canonical examples are useful when you want a known-good instance from the paper/example database.

docs/src/reductions/problem_schemas.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@
8989
}
9090
]
9191
},
92+
{
93+
"name": "ExactCoverBy3Sets",
94+
"description": "Determine if a collection of 3-element subsets contains an exact cover",
95+
"fields": [
96+
{
97+
"name": "universe_size",
98+
"type_name": "usize",
99+
"description": "Size of universe X (must be divisible by 3)"
100+
},
101+
{
102+
"name": "subsets",
103+
"type_name": "Vec<[usize; 3]>",
104+
"description": "Collection C of 3-element subsets of X"
105+
}
106+
]
107+
},
92108
{
93109
"name": "Factoring",
94110
"description": "Factor a composite integer into two factors",

0 commit comments

Comments
 (0)