Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #675 +/- ##
==========================================
+ Coverage 97.04% 97.06% +0.01%
==========================================
Files 284 286 +2
Lines 38037 38212 +175
==========================================
+ Hits 36914 37089 +175
Misses 1123 1123 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add the String-to-String Correction satisfaction problem (Garey & Johnson SR20). Given source/target strings and bound K, determine if the target can be derived from the source using at most K deletions and adjacent swaps. - Model: src/models/misc/string_to_string_correction.rs - Tests: 11 unit tests + 1 doctest (creation, evaluation, solver, paper example) - CLI: --source-string, --target-string, --bound, --alphabet-size flags - Paper: problem-def with figure, Wagner 1974/1975 references - Example-db: canonical instance with 2 satisfying solutions
Contributor
Author
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
Pull request overview
Adds a new NP-complete satisfaction problem model, StringToStringCorrection, to the problemreductions model registry and CLI, including examples and documentation updates, to address issue #439.
Changes:
- Introduce
StringToStringCorrectionmodel with schema registration, variant declaration, evaluation logic, and example-db spec. - Add unit tests and example fixtures for the new model.
- Integrate the model into the CLI (
pred create) and regenerate docs JSON + paper references/definition section.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/models/misc/string_to_string_correction.rs | New model implementation, schema registration, variant declaration, and example-db spec |
| src/models/misc/mod.rs | Export and include the new misc model + example-db spec aggregation |
| src/models/mod.rs | Re-export StringToStringCorrection from the top-level models module |
| src/unit_tests/models/misc/string_to_string_correction.rs | New unit tests covering creation, evaluation, invalid ops, serialization, and brute-force solving |
| src/unit_tests/trait_consistency.rs | Add trait consistency check coverage for the new model |
| src/example_db/fixtures/examples.json | Add example instance + sample/optimal configs for StringToStringCorrection |
| problemreductions-cli/src/cli.rs | Add --source-string / --target-string flags and update help text |
| problemreductions-cli/src/commands/create.rs | Add pred create StringToStringCorrection ... parsing and example string |
| docs/src/reductions/problem_schemas.json | Add generated schema entry for the new model |
| docs/src/reductions/reduction_graph.json | Add generated graph node entry for the new model and adjust indices |
| docs/paper/references.bib | Add Wagner (1974/1975) references used by the paper |
| docs/paper/reductions.typ | Add paper definition + example figure block for String-to-String Correction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1415
to
+1417
| let bound_k = args.bound.ok_or_else(|| { | ||
| anyhow::anyhow!("StringToStringCorrection requires --bound\n\n{usage}") | ||
| })? as usize; |
| if config.iter().any(|&v| v >= domain) { | ||
| return false; | ||
| } | ||
| let noop = 2 * n; |
…39-string-to-string-correction # Conflicts: # docs/src/reductions/problem_schemas.json # docs/src/reductions/reduction_graph.json # problemreductions-cli/src/commands/create.rs # src/models/mod.rs # src/unit_tests/trait_consistency.rs
- reject negative StringToStringCorrection bounds in CLI creation - tighten model pruning and add integration coverage for help/create/solve flows - align StringToStringCorrection help and docs with brute-force solver usage
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
Add the StringToStringCorrection problem model — a classical NP-complete satisfaction problem from Garey & Johnson (A4 SR20) concerning minimum-cost string transformation using only deletions and adjacent swaps.
Fixes #439