Documentation

CslibFrontier.Algorithms.Lean.Scheduling.LPT

Graham's Longest-Processing-Time Rule #

Graham's longest-processing-time rule runs list scheduling with the jobs sorted by non-increasing processing time. This module proves Graham's sharp approximation ratio 4/3 - 1/(3m) ([Gra69], Theorem 2; announced in [Gra66], §III, p. 1581): for jobs listed in non-increasing order every list schedule satisfies 3m · C_LPT ≤ (4m - 1) · C against every assignment.

The proof follows the case split of the 4/3 analysis in [WS11], Theorem 2.7, but the second case is argued differently. If the last-finishing job is short (3 p_j ≤ OPT), Graham's averaging bound already gives 4/3 - 1/(3m). Otherwise [WS11] appeal to Lemma 2.8 (LPT is optimal when every job exceeds OPT / 3), whose proof is left as an exercise there. This module instead uses its own counting lemma, exists_prefixLoad_add_le_makespan: since every job up to j is longer than OPT / 3, an optimal machine holds at most two of them, so some machine is light enough when job j arrives. This yields the sharp constant directly.

Main definitions #

Main results #

References #

theorem Cslib.Algorithms.Lean.Scheduling.load_comp_perm {α : Type u_1} {n m : ℕ} [AddCommMonoid α] (p : Fin n → α) (σ : Fin n → Fin m) (e : Equiv.Perm (Fin n)) (i : Fin m) :
load (p ∘ ⇑e) (σ ∘ ⇑e) i = load p σ i

Relabelling the jobs does not change the machine loads.

theorem Cslib.Algorithms.Lean.Scheduling.makespan_comp_perm {α : Type u_1} {n m : ℕ} [AddCommMonoid α] [LinearOrder α] [NeZero m] (p : Fin n → α) (σ : Fin n → Fin m) (e : Equiv.Perm (Fin n)) :
makespan (p ∘ ⇑e) (σ ∘ ⇑e) = makespan p σ

Relabelling the jobs does not change the makespan.

theorem Cslib.Algorithms.Lean.Scheduling.optMakespan_comp_perm {α : Type u_1} {n m : ℕ} [AddCommMonoid α] [LinearOrder α] [NeZero m] (p : Fin n → α) (e : Equiv.Perm (Fin n)) :
optMakespan m (p ∘ ⇑e) = optMakespan m p

Relabelling the jobs does not change the optimal makespan.

theorem Cslib.Algorithms.Lean.Scheduling.exists_prefixLoad_add_le_makespan {α : Type u_1} {n m : ℕ} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [NeZero m] (p : Fin n → α) (hp : ∀ (k : Fin n), 0 ≤ p k) (σ τ : Fin n → Fin m) (j : Fin n) (hanti : ∀ k ≤ j, p j ≤ p k) (hj : makespan p τ < 3 * p j) :
∃ (i : Fin m), prefixLoad p σ (↑j) i + p j ≤ makespan p τ

The counting step of the LPT analysis. Let τ be any assignment with makespan T, and let job j be no longer than the jobs before it, with T < 3 · p j. Then in any assignment σ of the jobs before j some machine has load at most T - p j. Each machine of τ holds at most two of the jobs 0, …, j; if every machine of σ had load above T - p j, every machine of σ would carry an earlier job, and the jobs alone on their machine could share a τ-machine with no other job, which leaves too few τ-places for the j + 1 jobs. This replaces the appeal to [WS11], Lemma 2.8, in their 4/3 proof; the counting argument is this module's own route to the sharp constant.

theorem Cslib.Algorithms.Lean.Scheduling.IsListSchedule.card_mul_makespan_le_of_antitone {α : Type u_1} {n m : ℕ} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [NeZero m] {p : Fin n → α} {σ : Fin n → Fin m} (hσ : IsListSchedule p σ) (hp : ∀ (j : Fin n), 0 ≤ p j) (hanti : Antitone p) (τ : Fin n → Fin m) :
3 * ↑m * makespan p σ ≤ (4 * ↑m - 1) * makespan p τ

Graham's LPT bound for jobs listed in non-increasing order ([Gra69], Theorem 2): every list schedule has makespan at most 4/3 - 1/(3m) times the makespan of any assignment, stated as 3m · C_LPT ≤ (4m - 1) · C. The case split follows the 4/3 proof of [WS11], Theorem 2.7, with exists_prefixLoad_add_le_makespan for long jobs.

theorem Cslib.Algorithms.Lean.Scheduling.IsListSchedule.makespan_le_optMakespan_of_antitone {α : Type u_1} {n m : ℕ} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [NeZero m] {p : Fin n → α} {σ : Fin n → Fin m} (hσ : IsListSchedule p σ) (hp : ∀ (j : Fin n), 0 ≤ p j) (hanti : Antitone p) :
makespan p σ ≤ (4 / 3 - 1 / (3 * ↑m)) * optMakespan m p

Graham's LPT bound against the optimum: C_LPT ≤ (4/3 - 1/(3m)) · OPT.

def Cslib.Algorithms.Lean.Scheduling.lptOrder {α : Type u_1} {n : ℕ} [LinearOrder α] (p : Fin n → α) :

An ordering of the jobs by non-increasing processing time (Tuple.sort for the dual order), so that p ∘ lptOrder p is antitone.

def Cslib.Algorithms.Lean.Scheduling.lptSchedule {α : Type u_1} {n m : ℕ} [LinearOrder α] [AddCommMonoid α] [NeZero m] (p : Fin n → α) :
Fin n → Fin m

Graham's LPT rule ([Gra69]): list scheduling with the jobs taken in non-increasing order of processing time, ties broken by lowest machine index.

theorem Cslib.Algorithms.Lean.Scheduling.makespan_listSchedule_le {α : Type u_1} {n m : ℕ} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [NeZero m] (p : Fin n → α) (hp : ∀ (j : Fin n), 0 ≤ p j) :
makespan p (listSchedule p) ≤ (2 - 1 / ↑m) * optMakespan m p

Graham's bound for listSchedule: C_LS ≤ (2 - 1/m) · OPT ([Gra66]; [WS11], Theorem 2.6 and the refinement after Theorem 2.5).

theorem Cslib.Algorithms.Lean.Scheduling.makespan_lptSchedule_le {α : Type u_1} {n m : ℕ} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [NeZero m] (p : Fin n → α) (hp : ∀ (j : Fin n), 0 ≤ p j) :
makespan p (lptSchedule p) ≤ (4 / 3 - 1 / (3 * ↑m)) * optMakespan m p

Graham's LPT theorem ([Gra69], Theorem 2): C_LPT ≤ (4/3 - 1/(3m)) · OPT. The weaker 4/3 bound is [WS11], Theorem 2.7.