Fix #414: [Model] LongestCommonSubsequence#666
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #666 +/- ##
=======================================
Coverage 97.17% 97.17%
=======================================
Files 304 304
Lines 40108 40061 -47
=======================================
- Hits 38976 38931 -45
+ Misses 1132 1130 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
Pull request overview
This PR implements the Issue #414 decision-model contract for LongestCommonSubsequence (fixed witness length K), refactors the ILP reduction to a feasibility formulation that supports multiple strings, and updates CLI/docs/examples/tests to match the new schema and semantics.
Changes:
- Refactor
LongestCommonSubsequencefrom an optimization/selection model to aSatisfactionProblemwith(alphabet_size, strings, bound)and witness-as-config semantics. - Replace the LCS→ILP reduction with a bounded-witness feasibility ILP (symbol-choice + per-string embedding variables + monotonicity constraints).
- Align unit tests, CLI
pred createparsing/help, example fixtures, and generated docs/paper content with the new model.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/unit_tests/trait_consistency.rs | Adds trait-consistency coverage for the updated LCS model. |
| src/unit_tests/rules/longestcommonsubsequence_ilp.rs | Updates ILP reduction tests to the new bounded-witness feasibility formulation. |
| src/unit_tests/models/misc/longest_common_subsequence.rs | Rewrites model tests for new schema, boolean metric, and witness configs. |
| src/rules/longestcommonsubsequence_ilp.rs | Refactors the rule to build a feasibility ILP for bounded-witness LCS over multiple strings. |
| src/models/misc/mod.rs | Registers canonical example specs for the LCS model. |
| src/models/misc/longest_common_subsequence.rs | Implements the new decision/satisfaction LCS model and variant complexity. |
| src/example_db/fixtures/examples.json | Adds/updates canonical examples for the new LCS model and its ILP reduction. |
| problemreductions-cli/src/commands/create.rs | Updates pred create help + parsing for LCS (strings, bound, alphabet-size). |
| problemreductions-cli/src/cli.rs | Updates CLI flag listing/docs for LCS arguments. |
| docs/src/reductions/reduction_graph.json | Regenerates reduction graph data for updated complexity/overhead formulas. |
| docs/src/reductions/problem_schemas.json | Regenerates schema docs to reflect new LCS fields/types. |
| docs/paper/references.bib | Adds Wagner–Fischer reference for the LCS discussion. |
| docs/paper/reductions.typ | Updates paper section and ILP reduction description to the bounded-witness decision model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let find-embed(target, candidate) = { | ||
| let positions = () | ||
| let j = 0 | ||
| for (i, ch) in target.enumerate() { | ||
| if j < candidate.len() and ch == candidate.at(j) { | ||
| positions.push(i) | ||
| j += 1 | ||
| } |
| "Vec<W>" => "comma-separated: 1,2,3", | ||
| "Vec<CNFClause>" => "semicolon-separated clauses: \"1,2;-1,3\"", | ||
| "Vec<Vec<W>>" => "semicolon-separated rows: \"1,0.5;0.5,2\"", | ||
| "Vec<Vec<usize>>" => "semicolon-separated strings: \"0,1,2;1,2,0\"", |
| "--alphabet-size {} is smaller than the inferred alphabet size ({})", | ||
| alphabet_size, | ||
| inferred_alphabet_size | ||
| ); |
…14-longest-common-subsequence # Conflicts: # docs/src/reductions/problem_schemas.json # docs/src/reductions/reduction_graph.json # problemreductions-cli/src/cli.rs # problemreductions-cli/src/commands/create.rs # src/example_db/fixtures/examples.json # src/unit_tests/trait_consistency.rs
Resolve merge conflicts from recent main additions (StaffScheduling, MultiprocessorScheduling, StringToStringCorrection) and regenerate examples.json fixtures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Fixes #414