Fix #219: [Model] SequencingWithinIntervals#222
Open
zazabap wants to merge 11 commits intoCodingThrust:mainfrom
Open
Fix #219: [Model] SequencingWithinIntervals#222zazabap wants to merge 11 commits intoCodingThrust:mainfrom
zazabap wants to merge 11 commits intoCodingThrust:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #222 +/- ##
==========================================
+ Coverage 96.90% 96.91% +0.01%
==========================================
Files 202 204 +2
Lines 27679 27835 +156
==========================================
+ Hits 26823 26977 +154
- Misses 856 858 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add a satisfaction problem model for scheduling tasks within time windows without overlap (Garey & Johnson SS1, NP-complete). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new NP-complete scheduling satisfaction model, SequencingWithinIntervals, and wires it through the library exports and CLI so it can be created/loaded/serialized and brute-force solved.
Changes:
- Implement
SequencingWithinIntervalsmodel with schema registration, variant complexity, and evaluation logic. - Add unit tests covering construction, feasibility checks, brute-force solving, and serde round-trip.
- Integrate the model into public re-exports and the CLI (alias resolution, dispatch,
pred createflags/help).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/models/misc/sequencing_within_intervals.rs | New model implementation + schema registration + variants + tests hook |
| src/unit_tests/models/misc/sequencing_within_intervals.rs | New unit test suite for the model |
| src/models/misc/mod.rs | Register and re-export the new misc model |
| src/models/mod.rs | Re-export SequencingWithinIntervals from models |
| src/lib.rs | Add the model to the crate prelude re-exports |
| problemreductions-cli/src/problem_name.rs | Add CLI alias mapping for the new model name |
| problemreductions-cli/src/dispatch.rs | Add load/serialize dispatch arms for the new model |
| problemreductions-cli/src/commands/create.rs | Add pred create support + hints/example for new flags |
| problemreductions-cli/src/cli.rs | Add CreateArgs flags for release times / deadlines / lengths |
| docs/plans/2026-03-10-sequencing-within-intervals.md | Plan document for implementing the model |
| docs/plans/2026-03-10-multiprocessor-scheduling.md | New plan document for a future model |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+80
to
+87
| for i in 0..release_times.len() { | ||
| assert!( | ||
| release_times[i] + lengths[i] <= deadlines[i], | ||
| "Task {i}: r({}) + l({}) > d({}), time window is empty", | ||
| release_times[i], | ||
| lengths[i], | ||
| deadlines[i] | ||
| ); |
Comment on lines
+137
to
+145
| // Check each variable is within range and compute start times | ||
| let dims = self.dims(); | ||
| let mut starts = Vec::with_capacity(n); | ||
| for (i, (&c, &dim)) in config.iter().zip(dims.iter()).enumerate() { | ||
| if c >= dim { | ||
| return false; | ||
| } | ||
| let start = self.release_times[i] + c as u64; | ||
| // Check task finishes by deadline (should hold by construction) |
Comment on lines
+153
to
+160
| for i in 0..n { | ||
| for j in (i + 1)..n { | ||
| let end_i = starts[i] + self.lengths[i]; | ||
| let end_j = starts[j] + self.lengths[j]; | ||
| // Tasks overlap if neither finishes before the other starts | ||
| if !(end_i <= starts[j] || end_j <= starts[i]) { | ||
| return false; | ||
| } |
Comment on lines
+11
to
+22
| inventory::submit! { | ||
| ProblemSchemaEntry { | ||
| name: "SequencingWithinIntervals", | ||
| module_path: module_path!(), | ||
| description: "Schedule tasks non-overlappingly within their time windows", | ||
| fields: &[ | ||
| FieldInfo { name: "release_times", type_name: "Vec<u64>", description: "Release time r(t) for each task" }, | ||
| FieldInfo { name: "deadlines", type_name: "Vec<u64>", description: "Deadline d(t) for each task" }, | ||
| FieldInfo { name: "lengths", type_name: "Vec<u64>", description: "Processing length l(t) for each task" }, | ||
| ], | ||
| } | ||
| } |
Comment on lines
+5
to
+10
| #[test] | ||
| fn test_sequencingwithinintervals_creation() { | ||
| let problem = SequencingWithinIntervals::new( | ||
| vec![0, 0, 0, 0, 5], | ||
| vec![11, 11, 11, 11, 6], | ||
| vec![3, 1, 2, 4, 1], |
Integrate SequencingWithinIntervals (PR) with registry-based dispatch and new models (main). Use main's registry dispatch for load/serialize, keep PR's CLI create flags with renamed --lengths field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add missing display_name, aliases, dimensions fields to ProblemSchemaEntry. Use 'default sat' prefix in declare_variants! macro. Rename task_lengths CLI field to lengths to avoid clash with FlowShopScheduling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use checked_add to prevent u64 overflow in constructor - Rename test functions to snake_case (test_sequencing_within_intervals_*) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add canonical model example in example_db (satisfaction_example) - Add trait_consistency test entry - Add paper display-name and problem-def block in reductions.typ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… use blocks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
Review Pipeline Report
Fixes applied during review
Remaining issues for final review
🤖 Generated by review-pipeline |
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 SequencingWithinIntervals problem model — a satisfaction problem for scheduling tasks within time windows (Garey & Johnson SS1, NP-complete via Theorem 3.8).
This PR contains only the implementation plan. The plan follows the add-model skill steps 1-7:
misc/(scheduling input with unique structure)Metric = bool,SatisfactionProblemtrait)release_times,deadlines,lengths(allVec<u64>)Test plan
src/models/misc/sequencing_within_intervals.rsmisc/mod.rsandmodels/mod.rsmake checkpassesFixes #219
🤖 Generated with Claude Code