Fix #494: Add SequencingWithReleaseTimesAndDeadlines model#633
Open
Fix #494: Add SequencingWithReleaseTimesAndDeadlines model#633
Conversation
Add the single-machine scheduling feasibility problem (Garey & Johnson A5 SS1): given tasks with processing times, release times, and deadlines, determine if a non-preemptive schedule exists. Strongly NP-complete. - Model implementation with Problem/SatisfactionProblem traits - CLI dispatch (load/serialize) and creation support - 13 unit tests covering feasibility, infeasibility, brute-force solver - Paper documentation in reductions.typ - Schema registration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #633 +/- ##
==========================================
+ Coverage 96.88% 96.90% +0.01%
==========================================
Files 268 270 +2
Lines 35563 35720 +157
==========================================
+ Hits 34456 34613 +157
Misses 1107 1107 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new satisfaction problem model, SequencingWithReleaseTimesAndDeadlines (Garey & Johnson A5 SS1), and wires it through the library, CLI, tests, and documentation so instances can be created/serialized/solved (via brute force) and appear in generated schema docs.
Changes:
- Introduces
SequencingWithReleaseTimesAndDeadlinesmodel with schema registration, crate exports, and unit tests. - Adds full CLI support (alias resolution, dispatch load/serialize,
pred createflags--lengths/--release-times/--deadlines). - Updates documentation artifacts (paper definition, regenerated
problem_schemas.json) and applies formatting-only cleanups to existing LCS↔ILP tests/examples.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/models/misc/sequencing_with_release_times_and_deadlines.rs | New scheduling-feasibility model + schema registration + tests module hook |
| src/unit_tests/models/misc/sequencing_with_release_times_and_deadlines.rs | Unit tests for feasibility, infeasibility, overlap, brute force, serialization |
| src/models/misc/mod.rs | Registers new misc model module + re-export |
| src/models/mod.rs | Re-exports new model at models:: level |
| src/lib.rs | Adds new model to prelude exports |
| problemreductions-cli/src/cli.rs | Adds pred create flags for lengths/release times/deadlines |
| problemreductions-cli/src/commands/create.rs | Adds instance creation logic for the new model |
| problemreductions-cli/src/dispatch.rs | Adds load/serialize dispatch arms for the new model |
| problemreductions-cli/src/problem_name.rs | Adds alias resolution for the new model name |
| docs/src/reductions/problem_schemas.json | Regenerated schema JSON to include the new model (and LCS entry) |
| docs/paper/reductions.typ | Adds formal paper definition + example for the new model |
| src/rules/longestcommonsubsequence_ilp.rs | Formatting-only changes |
| src/unit_tests/rules/longestcommonsubsequence_ilp.rs | Formatting-only changes |
| src/unit_tests/models/misc/longest_common_subsequence.rs | Formatting-only changes |
| examples/reduction_longestcommonsubsequence_to_ilp.rs | Formatting-only changes |
| examples/reduction_binpacking_to_ilp.rs | Formatting-only changes |
| examples/detect_unreachable_from_3sat.rs | Formatting-only changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+141
to
+146
| let si = config[i] as u64; | ||
| let ei = si + self.lengths[i]; | ||
| let sj = config[j] as u64; | ||
| let ej = sj + self.lengths[j]; | ||
| if ei > sj && ej > si { | ||
| return false; |
Comment on lines
+1001
to
+1007
| #problem-def("SequencingWithReleaseTimesAndDeadlines")[ | ||
| Given a set $T$ of $n$ tasks and, for each task $t in T$, a processing time $ell(t) in ZZ^+$, a release time $r(t) in ZZ^(>=0)$, and a deadline $d(t) in ZZ^+$, determine whether there exists a one-processor schedule $sigma: T -> ZZ^(>=0)$ such that for all $t in T$: $sigma(t) >= r(t)$, $sigma(t) + ell(t) <= d(t)$, and no two tasks overlap (i.e., $sigma(t) > sigma(t')$ implies $sigma(t) >= sigma(t') + ell(t')$). | ||
| ][ | ||
| Problem SS1 in Garey and Johnson's appendix @garey1979, and a fundamental single-machine scheduling feasibility problem. It is strongly NP-complete by reduction from 3-Partition, so no pseudo-polynomial time algorithm exists unless P = NP. The problem becomes polynomial-time solvable when: (1) all task lengths equal 1, (2) preemption is allowed, or (3) all release times are zero. The best known exact algorithm for the general case runs in $O^*(2^n dot n)$ time via dynamic programming on task subsets. | ||
|
|
||
| *Example.* Let $T = {t_1, t_2, t_3}$ with $ell(t_1) = 2$, $r(t_1) = 0$, $d(t_1) = 5$; $ell(t_2) = 3$, $r(t_2) = 1$, $d(t_2) = 6$; $ell(t_3) = 1$, $r(t_3) = 2$, $d(t_3) = 4$. A feasible schedule: $sigma(t_1) = 0$ (runs $[0, 2)$), $sigma(t_3) = 2$ (runs $[2, 3)$), $sigma(t_2) = 3$ (runs $[3, 6)$). All release and deadline constraints are satisfied with no overlap. | ||
| ] |
Comment on lines
+113
to
+117
| let h = self.time_horizon() as usize; | ||
| if h == 0 { | ||
| return vec![1; self.num_tasks()]; | ||
| } | ||
| vec![h; self.num_tasks()] |
Comment on lines
+127
to
+134
| for (i, &start_val) in config.iter().enumerate() { | ||
| let start = start_val as u64; | ||
| if start < self.release_times[i] { | ||
| return false; | ||
| } | ||
| if start + self.lengths[i] > self.deadlines[i] { | ||
| return false; | ||
| } |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve merge conflicts from origin/main: - Accept main's deletion of per-reduction example binaries - Merge registry-based dispatch (main) with PR's model registration - Combine both sides' additive entries in paper, schemas, CLI, and module files - Fix declare_variants! syntax and ProblemSchemaEntry fields to match current API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…leaseTimesAndDeadlines Switch from start-time encoding to permutation encoding consistent with MinimumTardinessSequencing, as recommended in issue #494 review. This: - Uses dims = [n, n-1, ..., 2, 1] instead of [max_deadline; n] - Eliminates overflow concerns (no u64 arithmetic on config values) - Dramatically reduces brute-force search space - Schedules tasks left-to-right with greedy start times Addresses Copilot review comments about overflow protection and inflated search space. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…WithReleaseTimesAndDeadlines Add missing structural completeness items: - Canonical model example in example-db (Lehmer code [3,0,0,0,0] for 5-task instance) - trait_consistency test entry Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
Review Pipeline Report
Changes made 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
SequencingWithReleaseTimesAndDeadlinessatisfaction problem model (Garey & Johnson A5 SS1): given tasks with processing times, release times, and deadlines, determine if a feasible non-preemptive single-processor schedule exists--lengths,--release-times,--deadlinesflags)Closes #494
Test plan
make checkpasses (fmt + clippy + test)🤖 Generated with Claude Code