You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build as optimization, not decision.Value = Min<usize>. Objective: Minimize the number of tardy tasks.
Do not add a bound/threshold field — let the solver find the optimum directly. See #765.
This generalizes the existing MinimumTardinessSequencing model (unit-length tasks) to arbitrary task lengths. The existing unit-length model becomes the weight: "One" variant.
Motivation
SEQUENCING TO MINIMIZE TARDY TASKS (P186) from Garey & Johnson, A5 SS2. A single-machine scheduling problem with precedence constraints: given n tasks with arbitrary lengths, deadlines, and a partial order, find a schedule that minimizes the number of tardy tasks (tasks finishing after their deadline). NP-complete by reduction from CLIQUE (Garey & Johnson, 1976). Remains NP-complete even with unit task lengths and chain precedence constraints. Without precedence constraints, it is solvable in polynomial time by Moore's algorithm (1968) for unit lengths and by the Lawler-Moore algorithm for arbitrary lengths.
The existing MinimumTardinessSequencing model only supports unit-length tasks (pj = 1). This issue generalizes it to support arbitrary task lengths using a weight parameter W, where W = One recovers the unit-length variant and W = usize enables arbitrary lengths.
Name:MinimumTardinessSequencing (generalized with weight parameter W) Reference: Garey & Johnson, Computers and Intractability, A5 SS2
Mathematical definition:
INSTANCE: Set T of n tasks, partial order ≺ on T (precedence constraints), for each task t ∈ T a processing time l(t) ∈ Z⁺ and a deadline d(t) ∈ Z⁺.
OBJECTIVE: Find a one-processor schedule σ (a permutation of T respecting ≺) that minimizes the number of tardy tasks:
|{t ∈ T : C(t) > d(t)}|
where C(t) = σ(t) + l(t) is the completion time of task t, and σ(t) is the start time (sum of processing times of all tasks scheduled before t).
Variants:
W = One (default): Unit-length tasks (l(t) = 1 for all t). The lengths field is omitted. This is the existing MinimumTardinessSequencing model.
W = usize: Arbitrary task lengths. The lengths field stores l(t) for each task.
The corresponding decision problem (GJ SS2) asks whether a schedule exists with at most K tardy tasks.
Variables
Count: n = |T|. The configuration is a permutation of tasks (encoded as Lehmer code, matching the existing implementation).
Per-variable domain: n − i for position i (Lehmer code: dims() returns [n, n-1, …, 1])
Meaning: The Lehmer code encodes a permutation of tasks. The evaluate function decodes the permutation, checks precedence constraints, computes completion times using task lengths, and counts tardy tasks.
dims() returns the Lehmer code dimensions (same as existing MinimumTardinessSequencing).
Schema (data type)
Type name:MinimumTardinessSequencing<W> Variants:W — weight/length type (One for unit-length, usize for arbitrary)
Field
Type
Description
Getter
lengths
Vec<W> (omitted when W = One)
Processing time l(t) for each task
num_tasks() → number of tasks
deadlines
Vec<usize>
Deadline d(t) for each task
precedences
Vec<(usize, usize)>
Precedence pairs (predecessor, successor)
num_precedences()
Problem type: Optimization (minimization) Value type:Min<usize>
Relationship to existing model: The current MinimumTardinessSequencing (no type parameter) becomes MinimumTardinessSequencing<One>. The num_tasks field is replaced by self.deadlines.len() (or self.lengths.len() for W = usize).
Complexity
Decision complexity: NP-complete (Garey & Johnson, 1976; transformation from CLIQUE). Remains NP-complete even with unit task lengths and chain precedence constraints.
Best known exact algorithm:
Unit-length (W = One): Brute-force over all permutations. Existing complexity: "2^num_tasks" (Lehmer code encoding).
Arbitrary-length (W = usize): Same brute-force approach, "2^num_tasks".
Without precedence constraints: Moore's algorithm O(n log n) for unit lengths; Lawler-Moore DP for weighted case.
References:
[Garey & Johnson, 1976] M. R. Garey and D. S. Johnson, "Scheduling tasks with nonuniform deadlines on two processors", JACM 23, 1976.
[Moore, 1968] J. M. Moore, "An n job, one machine sequencing algorithm for minimizing the number of late jobs", Management Science 15, 1968.
Extra Remark
Full book text:
INSTANCE: Set T of tasks, partial order < on T, for each task t in T a length l(t) in Z+ and a deadline d(t) in Z+, and a positive integer K <= |T|.
QUESTION: Is there a one-processor schedule sigma for T that obeys the precedence constraints, i.e., such that t < t' implies sigma(t) + l(t) <= sigma(t'), and such that there are at most K tasks t in T for which sigma(t) + l(t) > d(t)?
Reference: [Garey and Johnson, 1976]. Transformation from CLIQUE.
Comment: NP-complete even if l(t) = 1 for all t in T and < is a collection of chains [Garey and Johnson, 1976]. Can be solved in polynomial time if < is empty [Moore, 1968].
How to solve
It can be solved by (existing) bruteforce. Enumerate all permutations (via Lehmer code), check precedences, compute completion times from task lengths, count tardy tasks, return minimum.
It can be solved by reducing to integer programming. Binary ILP with ordering variables and tardiness indicators (same approach as existing ILP reduction for the unit-length variant).
Other: Moore's O(n log n) greedy when precedence is empty and lengths are unit.
Example Instance
Arbitrary-length variant (W = usize)
Input:
T = {t₀, t₁, t₂, t₃, t₄} (n = 5 tasks)
Lengths: l = [3, 2, 2, 1, 2] (total processing time = 10)
Deadlines: d = [4, 3, 8, 3, 6]
Precedences: t₀ ≺ t₂, t₁ ≺ t₃
Optimal schedule (Min(2)):
σ: t₀, t₄, t₂, t₁, t₃
Pos
Task
Length
Start
Finish
Deadline
Tardy?
0
t₀
3
0
3
4
No ✓
1
t₄
2
3
5
6
No ✓
2
t₂
2
5
7
8
No ✓
3
t₁
2
7
9
3
Yes ✗
4
t₃
1
9
10
3
Yes ✗
Tardy tasks: t₁ and t₃ (both have tight deadlines that conflict with precedence). Min(2).
Important
Build as optimization, not decision.
Value = Min<usize>.Objective: Minimize the number of tardy tasks.
Do not add a
bound/thresholdfield — let the solver find the optimum directly. See #765.This generalizes the existing
MinimumTardinessSequencingmodel (unit-length tasks) to arbitrary task lengths. The existing unit-length model becomes theweight: "One"variant.Motivation
SEQUENCING TO MINIMIZE TARDY TASKS (P186) from Garey & Johnson, A5 SS2. A single-machine scheduling problem with precedence constraints: given n tasks with arbitrary lengths, deadlines, and a partial order, find a schedule that minimizes the number of tardy tasks (tasks finishing after their deadline). NP-complete by reduction from CLIQUE (Garey & Johnson, 1976). Remains NP-complete even with unit task lengths and chain precedence constraints. Without precedence constraints, it is solvable in polynomial time by Moore's algorithm (1968) for unit lengths and by the Lawler-Moore algorithm for arbitrary lengths.
The existing
MinimumTardinessSequencingmodel only supports unit-length tasks (pj = 1). This issue generalizes it to support arbitrary task lengths using a weight parameterW, whereW = Onerecovers the unit-length variant andW = usizeenables arbitrary lengths.Associated rules:
Definition
Name:
MinimumTardinessSequencing(generalized with weight parameterW)Reference: Garey & Johnson, Computers and Intractability, A5 SS2
Mathematical definition:
INSTANCE: Set T of n tasks, partial order ≺ on T (precedence constraints), for each task t ∈ T a processing time l(t) ∈ Z⁺ and a deadline d(t) ∈ Z⁺.
OBJECTIVE: Find a one-processor schedule σ (a permutation of T respecting ≺) that minimizes the number of tardy tasks:
|{t ∈ T : C(t) > d(t)}|
where C(t) = σ(t) + l(t) is the completion time of task t, and σ(t) is the start time (sum of processing times of all tasks scheduled before t).
Variants:
W = One(default): Unit-length tasks (l(t) = 1 for all t). Thelengthsfield is omitted. This is the existingMinimumTardinessSequencingmodel.W = usize: Arbitrary task lengths. Thelengthsfield stores l(t) for each task.The corresponding decision problem (GJ SS2) asks whether a schedule exists with at most K tardy tasks.
Variables
dims()returns[n, n-1, …, 1])dims()returns the Lehmer code dimensions (same as existingMinimumTardinessSequencing).Schema (data type)
Type name:
MinimumTardinessSequencing<W>Variants:
W— weight/length type (Onefor unit-length,usizefor arbitrary)lengthsVec<W>(omitted whenW = One)num_tasks()→ number of tasksdeadlinesVec<usize>precedencesVec<(usize, usize)>num_precedences()Problem type: Optimization (minimization)
Value type:
Min<usize>Relationship to existing model: The current
MinimumTardinessSequencing(no type parameter) becomesMinimumTardinessSequencing<One>. Thenum_tasksfield is replaced byself.deadlines.len()(orself.lengths.len()forW = usize).Complexity
W = One): Brute-force over all permutations. Existing complexity:"2^num_tasks"(Lehmer code encoding).W = usize): Same brute-force approach,"2^num_tasks".Extra Remark
Full book text:
INSTANCE: Set T of tasks, partial order < on T, for each task t in T a length l(t) in Z+ and a deadline d(t) in Z+, and a positive integer K <= |T|.
QUESTION: Is there a one-processor schedule sigma for T that obeys the precedence constraints, i.e., such that t < t' implies sigma(t) + l(t) <= sigma(t'), and such that there are at most K tasks t in T for which sigma(t) + l(t) > d(t)?
Reference: [Garey and Johnson, 1976]. Transformation from CLIQUE.
Comment: NP-complete even if l(t) = 1 for all t in T and < is a collection of chains [Garey and Johnson, 1976]. Can be solved in polynomial time if < is empty [Moore, 1968].
How to solve
Example Instance
Arbitrary-length variant (
W = usize)Input:
T = {t₀, t₁, t₂, t₃, t₄} (n = 5 tasks)
Lengths: l = [3, 2, 2, 1, 2] (total processing time = 10)
Deadlines: d = [4, 3, 8, 3, 6]
Precedences: t₀ ≺ t₂, t₁ ≺ t₃
Optimal schedule (Min(2)):
σ: t₀, t₄, t₂, t₁, t₃
Tardy tasks: t₁ and t₃ (both have tight deadlines that conflict with precedence). Min(2).
Precedence check: t₀(pos 0) < t₂(pos 2) ✓; t₁(pos 3) < t₃(pos 4) ✓.
Suboptimal schedules:
Out of 30 valid (precedence-respecting) permutations: 3 achieve Min(2), 16 achieve Min(3), 11 achieve Min(4).
Unit-length variant (
W = One, existing behavior)Uses the existing
MinimumTardinessSequencingcanonical example:T = {t₀, t₁, t₂, t₃}, deadlines = [2, 3, 1, 4], precedences = [(0, 2)].
Optimal: Min(1) (one tardy task). See existing implementation.
Expected outcome: Min(2) for the arbitrary-length example.
Reduction Rule Crossref