Weighted number of tardy jobs
AbbreviationWeighted tardy jobs instances#✓fully proved
An instance of WEIGHTED NUMBER OF TARDY JOBS is a pair consisting of a finite list of jobs, each a triple \((p, d, w)\) of natural numbers giving its processing time \(p\), due date \(d\) and weight \(w\), and a natural number \(K\), the bound.
abbrev WeightedTardyJobsInstance := List (ℕ × ℕ × ℕ) × ℕ
DefinitionOne step of the weighted tardy jobs computation#✓fully proved
Let \(J\) be a list of jobs, each a triple \((p, d, w)\) of natural numbers (processing time, due date, weight). Given a state \((t, s)\) and a natural number \(j\), let \((p, d, w)\) be the job at position \(j\) of \(J\), counting from \(0\), or \((0, 0, 0)\) if \(J\) has no position \(j\), and let \(t' = t + p\). The step returns \((t', s + w)\) if \(d < t'\), and \((t', s)\) otherwise.
def WeightedTardyStep (jobs : List (ℕ × ℕ × ℕ)) (state : ℕ × ℕ) (j : ℕ) : ℕ × ℕ :=
let t := state.1 + (jobs.getD j (0, 0, 0)).1
(t, state.2 + if (jobs.getD j (0, 0, 0)).2.1 < t then (jobs.getD j (0, 0, 0)).2.2 else 0)
Used by 1
DefinitionWeighted number of tardy jobs of an ordering#✓fully proved
Let \(J\) be a list of jobs, each a triple of natural numbers (processing time, due date, weight), and write \((p_i, d_i, w_i)\) for the job at position \(i\) of \(J\), counting from \(0\), with \((p_i, d_i, w_i) = (0, 0, 0)\) when \(J\) has no position \(i\). For a list \((j_1, \dots, j_m)\) of natural numbers, the weighted number of tardy jobs of this order is the sum of \(w_{j_k}\) over all \(k\) with \(d_{j_k} < C_k\), where \(C_k = p_{j_1} + \dots + p_{j_k}\) is the completion time of the \(k\)-th job.
def WeightedTardy (jobs : List (ℕ × ℕ × ℕ)) (order : List ℕ) : ℕ :=
(order.foldl (WeightedTardyStep jobs) (0, 0)).2
def WeightedTardyStep (jobs : List (ℕ × ℕ × ℕ)) (state : ℕ × ℕ) (j : ℕ) : ℕ × ℕ :=
let t := state.1 + (jobs.getD j (0, 0, 0)).1
(t, state.2 + if (jobs.getD j (0, 0, 0)).2.1 < t then (jobs.getD j (0, 0, 0)).2.2 else 0)
WantedExt/Complexity/NPComplete/WeightedTardyJobsWanted.lean:52
Uses 1 · Used by 1
DefinitionFeasible weighted tardy jobs instances#✓fully proved
A weighted tardy jobs instance, consisting of a list of \(n\) jobs and a bound \(K\), is feasible when there is an ordering of its jobs, that is, a list of the job indices \(0, 1, \dots, n - 1\) in which each index occurs exactly once, whose weighted number of tardy jobs is at most \(K\).
def WeightedTardyJobsFeasible
(i : WeightedTardyJobsInstance) : Prop :=
∃ order : List ℕ, order.Perm (List.range i.1.length) ∧
WeightedTardy i.1 order ≤ i.2
abbrev WeightedTardyJobsInstance := List (ℕ × ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/WeightedTardyJobsWanted.lean:48
def WeightedTardy (jobs : List (ℕ × ℕ × ℕ)) (order : List ℕ) : ℕ :=
(order.foldl (WeightedTardyStep jobs) (0, 0)).2
WantedExt/Complexity/NPComplete/WeightedTardyJobsWanted.lean:57
Uses 2 · Used by 1
DefinitionThe weighted number of tardy jobs decision problem#✓fully proved
WEIGHTED NUMBER OF TARDY JOBS is the decision problem that accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding of weighted tardy jobs instances, to a feasible instance, that is, an instance having an ordering of its jobs whose weighted number of tardy jobs is at most its bound. A bitstring that decodes to no instance is rejected.
noncomputable def weightedTardyJobsDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := WeightedTardyJobsInstance) x with
| some i => decide (WeightedTardyJobsFeasible i)
| none => false
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
abbrev WeightedTardyJobsInstance := List (ℕ × ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/WeightedTardyJobsWanted.lean:48
def WeightedTardyJobsFeasible
(i : WeightedTardyJobsInstance) : Prop :=
∃ order : List ℕ, order.Perm (List.range i.1.length) ∧
WeightedTardy i.1 order ≤ i.2
WantedExt/Complexity/NPComplete/WeightedTardyJobsWanted.lean:62
Uses 11 · Used by 1
TheoremWEIGHTED NUMBER OF TARDY JOBS is NP-complete#●ready to prove
The weighted number of tardy jobs decision problem lies in NP, and every decision problem in NP has a polynomial-time many-one reduction to it.
public theorem_wanted weightedTardyJobs_npComplete :
weightedTardyJobsDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L weightedTardyJobsDec
noncomputable def weightedTardyJobsDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := WeightedTardyJobsInstance) x with
| some i => decide (WeightedTardyJobsFeasible i)
| none => false
WantedExt/Complexity/NPComplete/WeightedTardyJobsWanted.lean:69
def NP : DecisionComplexityClass :=
{ L | ∃ (p : Polynomial ℕ), ∃ R : (List Bool × List Bool) → Bool,
IsPolyTime R ∧
∀ x, L x ↔ ∃ w : List Bool, w.length ≤ p.eval x.length ∧ R (x, w) }
MathlibExt/Computability/Complexity.lean:200
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def PolyManyOneRed (L₁ L₂ : MetaMathlibExt.ComplexityTheory.DecisionProblem) : Prop :=
∃ reduce : List Bool → List Bool,
MetaMathlibExt.ComplexityTheory.IsPolyTime reduce ∧ ∀ x, L₁ x = L₂ (reduce x)
CSLibExt/Computability/CookLevin.lean:396
Sources
- M. R. Garey and D. S. Johnson, Computers and Intractability (1979), WEIGHTED NUMBER OF TARDY JOBS (1||sum w_j U_j).
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.