Skip to content

Fix #494: Add SequencingWithReleaseTimesAndDeadlines model#633

Open
zazabap wants to merge 5 commits intomainfrom
issue-494-sequencing-release-times-deadlines
Open

Fix #494: Add SequencingWithReleaseTimesAndDeadlines model#633
zazabap wants to merge 5 commits intomainfrom
issue-494-sequencing-release-times-deadlines

Conversation

@zazabap
Copy link
Collaborator

@zazabap zazabap commented Mar 13, 2026

Summary

  • Add SequencingWithReleaseTimesAndDeadlines satisfaction 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
  • Full CLI integration (dispatch, creation with --lengths, --release-times, --deadlines flags)
  • 13 unit tests covering feasibility, infeasibility, overlap detection, brute-force solver, serialization
  • Paper documentation with formal definition and example

Closes #494

Test plan

  • make check passes (fmt + clippy + test)
  • All 13 new unit tests pass
  • CLI dispatch and creation registered
  • Schema export includes new problem (29 total)

🤖 Generated with Claude Code

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
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.90%. Comparing base (f81e52f) to head (1281ddb).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SequencingWithReleaseTimesAndDeadlines model with schema registration, crate exports, and unit tests.
  • Adds full CLI support (alias resolution, dispatch load/serialize, pred create flags --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;
}
zazabap and others added 4 commits March 15, 2026 14:50
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>
@zazabap
Copy link
Collaborator Author

zazabap commented Mar 15, 2026

Review Pipeline Report

Check Result
Copilot comments 4 addressed (refactored to permutation encoding)
Issue/human comments 2 checked, encoding feedback applied
Structural review 18/18 passed
CI green (5/5 checks)
Agentic test passed
Needs human decision 1 item
Board Review pool → Under review → Final review

Changes made during review

  1. Merged with main — resolved 12 conflicting files (registry-based dispatch, paper entries, CLI, module registrations)
  2. Refactored to permutation encoding — switched from start-time encoding to Lehmer code (dims = [n, n-1, ..., 1]), consistent with MinimumTardinessSequencing. Addresses Copilot comments about overflow and search space inflation.
  3. Fixed declare_variants! syntax — added default sat marker and display_name/aliases/dimensions fields to ProblemSchemaEntry (API changed on main)
  4. Added canonical model example — 5-task instance with Lehmer code [3,0,0,0,0] in example-db
  5. Added trait_consistency entry — structural completeness check
  6. Rewrote all unit tests — 12 tests updated for permutation encoding

Remaining issues for final review

  • Alias: Consider adding a short alias like SRTD for CLI convenience. The current name is 42 characters. This is a naming decision for the maintainer.

🤖 Generated by review-pipeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Model] SequencingWithReleaseTimesAndDeadlines

2 participants