-
Notifications
You must be signed in to change notification settings - Fork 3
[Model] SequencingWithDeadlinesAndSetUpTimes #499
Description
Motivation
SEQUENCING WITH DEADLINES AND SET-UP TIMES (P190) from Garey & Johnson, A5 SS6. A single-processor scheduling problem where tasks belong to different "compiler" classes, and switching between classes incurs a set-up time penalty. The question is whether all tasks can meet their individual deadlines given these switching costs. NP-complete even with equal set-up times (via reduction from PARTITION, R136). Can be solved in pseudo-polynomial time when the number of distinct deadlines is bounded by a constant.
Associated rules:
- R136: PARTITION → SequencingWithDeadlinesAndSetUpTimes (this model is the target)
Definition
Name: SequencingWithDeadlinesAndSetUpTimes
Reference: Garey & Johnson, Computers and Intractability, A5 SS6
Mathematical definition:
INSTANCE: Set C of "compilers," set T of n tasks, for each t ∈ T a length l(t) ∈ Z⁺, a deadline d(t) ∈ Z⁺, and a compiler k(t) ∈ C, and for each c ∈ C a "set-up time" s(c) ∈ Z⁰⁺.
QUESTION: Is there a one-processor schedule σ for T (a permutation of tasks) that meets all task deadlines, where whenever two consecutively scheduled tasks t and t' have different compilers (k(t) ≠ k(t')), the start of t' is delayed by the set-up time s(k(t'))?
Formally: for consecutively scheduled tasks t, t' with σ(t) < σ(t'), if k(t) ≠ k(t'), then σ(t') ≥ σ(t) + l(t) + s(k(t')). A schedule is feasible if σ(t) + l(t) ≤ d(t) for all t ∈ T.
This is a satisfaction (feasibility) problem: Value = Or.
Variables
- Count: n = |T|. The configuration is a permutation of the n tasks.
- Per-variable domain: n (each position selects a task index 0..n−1)
- Meaning: config[i] = j means task j is scheduled in position i. Start times are computed left-to-right: for the task at position i, the start time equals the finish time of position i−1, plus the set-up time s(k(t)) if the compiler changed. A configuration is valid if it is a permutation.
evaluate()returnsOr(true)if all deadlines are met,Or(false)otherwise.
dims() returns [n; n] (permutation encoding).
Schema (data type)
Type name: SequencingWithDeadlinesAndSetUpTimes
Variants: none (no type parameters)
| Field | Type | Description | Getter |
|---|---|---|---|
lengths |
Vec<u64> |
Processing time l(t) for each task t | num_tasks() → self.lengths.len() |
deadlines |
Vec<u64> |
Deadline d(t) for each task t | |
compilers |
Vec<usize> |
Compiler index k(t) for each task t | num_compilers() → distinct compiler count |
setup_times |
Vec<u64> |
Set-up time s(c) for each compiler c ∈ C |
Problem type: Satisfaction (feasibility)
Value type: Or
Complexity
- Decision complexity: NP-complete (Bruno & Downey, 1978; transformation from PARTITION). Remains NP-complete even if all set-up times are equal.
- Best known exact algorithm: Brute-force over all n! permutations, checking deadline feasibility for each. Worst-case time:
factorial(num_tasks). - Complexity string for
declare_variants!:"factorial(num_tasks)" - Special cases: Can be solved in pseudo-polynomial time when the number of distinct deadlines is bounded by a constant. The related problem with "changeover costs" is also NP-complete even with equal costs.
- References:
- [Bruno & Downey, 1978] J. Bruno and P. Downey, "Sequencing tasks with set-up times", 1978.
- [Garey & Johnson, 1979] M. R. Garey and D. S. Johnson, Computers and Intractability, A5 SS6.
Extra Remark
Full book text:
INSTANCE: Set C of "compilers," set T of tasks, for each t ∈ T a length l(t) ∈ Z+, a deadline d(t) ∈ Z+, and a compiler k(t) ∈ C, and for each c ∈ C a "set-up time" l(c) ∈ Z0+.
QUESTION: Is there a one-processor schedule σ for T that meets all the task deadlines and that satisfies the additional constraint that, whenever two tasks t and t' with σ(t) < σ(t') are scheduled "consecutively" (i.e., no other task t'' has σ(t) < σ(t'') < σ(t')) and have different compilers (i.e., k(t) ≠ k(t')), then σ(t') ≥ σ(t) + l(t) + l(k(t'))?
Reference: [Bruno and Downey, 1978]. Transformation from PARTITION.
Comment: Remains NP-complete even if all set-up times are equal. The related problem in which set-up times are replaced by "changeover costs," and we want to know if there is a schedule that meets all the deadlines and has total changeover cost at most K, is NP-complete even if all changeover costs are equal. Both problems can be solved in pseudo-polynomial time when the number of distinct deadlines is bounded by a constant. If the number of deadlines is unbounded, it is open whether these problems are NP-complete in the strong sense.
How to solve
- It can be solved by (existing) bruteforce. Enumerate all n! permutations; for each, compute start times including set-up penalties for compiler switches; check all deadlines.
- It can be solved by reducing to integer programming. Binary ILP: x_{ij} ∈ {0,1} (task i in position j), with set-up time constraints for compiler switches and deadline constraints.
- Other: Pseudo-polynomial DP when the number of distinct deadlines is bounded by a constant.
Example Instance
Input:
C = {c₀, c₁} (2 compilers), setup_times = [1, 2] (switch to c₀ costs 1, switch to c₁ costs 2)
T = {t₁, t₂, t₃, t₄, t₅} (n = 5 tasks)
| Task | Length | Deadline | Compiler |
|---|---|---|---|
| t₁ | 2 | 4 | c₀ |
| t₂ | 3 | 11 | c₁ |
| t₃ | 1 | 3 | c₀ |
| t₄ | 2 | 16 | c₁ |
| t₅ | 2 | 7 | c₀ |
Total processing time = 2 + 3 + 1 + 2 + 2 = 10. With setup costs, actual completion depends on compiler switches.
Feasible schedule (YES instance):
σ: t₃, t₁, t₅, t₂, t₄ (group c₀ tasks first, then c₁ — one switch)
| Task | Compiler | Setup | Start | Finish | Deadline | Meets? |
|---|---|---|---|---|---|---|
| t₃ | c₀ | — | 0 | 1 | 3 | ✓ |
| t₁ | c₀ | — | 1 | 3 | 4 | ✓ |
| t₅ | c₀ | — | 3 | 5 | 7 | ✓ |
| t₂ | c₁ | +2 | 7 | 10 | 11 | ✓ |
| t₄ | c₁ | — | 10 | 12 | 16 | ✓ |
All deadlines met. Answer: Or(true).
Infeasible schedules (confirming non-triviality):
- σ = (t₁, t₂, t₃, t₄, t₅): t₃ finishes at 9 > deadline 3, t₅ finishes at 13 > deadline 7. ✗
- σ = (t₁, t₃, t₅, t₄, t₂): t₂ finishes at 12 > deadline 11 (switch c₁→c₀→c₁ adds extra setups). ✗
- σ = (t₂, t₁, t₃, t₅, t₄): t₁ finishes at 6 > deadline 4. ✗
Out of 120 permutations, only 2 are feasible (both group all c₀ tasks before c₁ tasks), confirming the setup-time constraint is the binding factor.
Expected outcome: Or(true)
Reduction Rule Crossref
- R136: Partition → SequencingWithDeadlinesAndSetUpTimes
- Direct ILP: SequencingWithDeadlinesAndSetUpTimes → ILP (binary ordering + setup + deadline constraints)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status