Sequencing with deadlines and penalties #
JobSequencing is Karp's problem JOB SEQUENCING [Kar72], the problem SEQUENCING TO MINIMIZE
TARDY TASK WEIGHT of Garey and Johnson, Problem SS3: given jobs with
(time, deadline, penalty) (Cslib.Complexity.JobSequencing.Job) and a bound
(Cslib.Complexity.JobSequencingInstance), some order of the jobs, run one after another from
time 0 without idle time, has total penalty at most bound, where a job pays its penalty when
it completes after its deadline.
All numbers are natural numbers in binary (encNat); orders are permutations (List.Perm) of the
list of jobs, so repeated jobs are scheduled with multiplicity.
Karp's reduction from SubsetSum (his KNAPSACK) maps the numbers a and target t to jobs of
time and penalty a and common deadline t, with penalty bound a.sum - t
(SubsetSum.toJobSequencing). The jobs completed on time in an order hold numbers of total at
most t, and the others pay their whole time as penalty, so the bound is met exactly when the
jobs on time sum to t. A target above a.sum is mapped to a fixed instance without a feasible
order, since then the subtraction would truncate.
NP membership uses the order itself as the witness (Turing.MultiTapeTM.Decoder.list): the
verifier checks that it is a permutation of the jobs by counting occurrences, and computes its
total penalty in closed form from prefix sums.
Main definitions #
Cslib.Complexity.JobSequencing.Job,Cslib.Complexity.JobSequencing.encJob: jobs with processing time, deadline, and penalty, and their binary encoding.Cslib.Complexity.JobSequencing.penaltyFrom,Cslib.Complexity.JobSequencing.totalPenalty: the total penalty of an order.Cslib.Complexity.JobSequencingInstance,Cslib.Complexity.JobSequencing,Cslib.Complexity.encJobSequencing.Cslib.Complexity.SubsetSum.toJobSequencing: Karp's reduction.
Main results #
Cslib.Complexity.JobSequencing.penaltyFrom_append: penalties of consecutive runs add up.Cslib.Complexity.JobSequencing.computableInPolyTime_totalPenalty: the total penalty of an order is polynomial-time.Cslib.Complexity.JobSequencing.mem_NP:JobSequencing ∈ NP encJobSequencing.Cslib.Complexity.SubsetSum.toJobSequencing_mem_iff: correctness of the reduction.Cslib.Complexity.polyTimeReducible_SubsetSum_JobSequencing,Cslib.Complexity.JobSequencing_npHard,Cslib.Complexity.JobSequencing_npComplete:JobSequencingisNP-complete.
References #
A job in JobSequencing, with processing time, deadline, and tardiness penalty.
- time : ℕ
The processing time required by the job.
- deadline : ℕ
The deadline by which the job must complete to avoid paying its penalty.
- penalty : ℕ
The penalty incurred if the job completes strictly after its deadline.
Instances For
Instances For
The total penalty of the jobs run in the given order from time 0.
Instances For
The penalties of two consecutive runs add up; the second starts when the first ends.
An instance of JobSequencing: a list of jobs to schedule and a penalty bound.
- jobs : List JobSequencing.Job
The jobs to schedule consecutively without idle time starting at time
0. - bound : ℕ
The maximum allowed total tardiness penalty.
Instances For
Instances For
Instances For
Instances of JobSequencing are encoded as a list of jobs and a penalty bound, all in
binary.
Instances For
Sequencing with deadlines and penalties [Kar72]: some order of the jobs has total penalty at most the bound.
Instances For
The total penalty of an order is polynomial-time computable.
JobSequencing belongs to NP, with the order as the witness; a permutation of the jobs is
encoded with the length of the encoded list of jobs.
Karp's reduction from SubsetSum to JobSequencing [Kar72]: each number a becomes a
job of time and penalty a with the target t as deadline, and the penalty bound is
a.sum - t. A target above the total is mapped to a single job that is always late.
Instances For
Correctness of the reduction to JobSequencing.
The reduction toJobSequencing is computable in polynomial time.
SubsetSum reduces to JobSequencing in polynomial time.
JobSequencing is NP-hard.
Sequencing with deadlines and penalties is NP-complete, with the numbers in binary [Kar72].