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 97.18% 97.19% +0.01%
==========================================
Files 306 308 +2
Lines 40229 40386 +157
==========================================
+ Hits 39097 39254 +157
Misses 1132 1132 ☔ 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.
| 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; |
| #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. | ||
| ] |
| let h = self.time_horizon() as usize; | ||
| if h == 0 { | ||
| return vec![1; self.num_tasks()]; | ||
| } | ||
| vec![h; self.num_tasks()] |
| 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>
Review Pipeline Report
Changes made during review
Remaining issues for final review
🤖 Generated by review-pipeline |
…release-times-deadlines # Conflicts: # docs/paper/reductions.typ # docs/src/reductions/problem_schemas.json # problemreductions-cli/src/cli.rs # problemreductions-cli/src/commands/create.rs # src/lib.rs # src/models/misc/mod.rs # src/models/mod.rs
The canonical 5-task instance now verified by BruteForce::find_all_satisfying, confirming exactly one feasible schedule exists (Lehmer code [3,0,0,0,0]). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These fields already exist on main (lines 442-445); the PR's copies at lines 467-472 cause E0124 after merge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Lines 86-87 duplicated the checks already at lines 76-78 after merge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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