Graham's LPT bound: on identical machines
OpenGraham1969.lpt_makespan_leThis is Graham's worst-case bound for the longest processing time (LPT) rule for scheduling independent jobs on identical parallel machines so as to minimize the makespan (the problem ).
Let be the number of identical machines, and let jobs (with ) have nonnegative real processing times listed in nonincreasing order,
An assignment is a map sending each job to the machine that processes it. The load of machine under is , the makespan of is , and the optimal makespan is
the minimum being taken over all assignments.
An assignment is an LPT schedule if it arises from list scheduling of the jobs in the order : each job is placed on a machine whose current load
(the total processing time of the earlier jobs already placed on machine ) is minimal among all machines . Ties between equally loaded machines may be broken arbitrarily, and jobs of equal length may appear in any order. Then every LPT schedule satisfies
This is the classical first example of the worst-case analysis of a greedy approximation algorithm. It sharpens Graham's earlier bound , valid for list scheduling in an arbitrary order, by exploiting the sorted order of the list; Graham also showed that the constant is attained for every .
Formalization Note Jobs are indexed by Fin n (job of the text is index ) and machines by Fin m; the processing times are a function p : Fin n → ℝ with 0 ≤ p i, and the nonincreasing order is Antitone p. The LPT rule is the hypothesis that for every job and every machine the load of machine from the jobs before is at most the load of machine from the jobs before . For independent jobs this is exactly Graham's list scheduling, in which a processor that becomes free takes the next job on the list, since the processor that becomes free first is a least-loaded one. The makespan is a Finset.sup' over the machines and a Finset.inf' over all functions Fin n → Fin m; the hypothesis (hm : 0 < m) supplies the nonemptiness witnesses. Graham states the bound as the ratio with processors; here it is stated multiplicatively, which also covers the degenerate case . Jobs of length are allowed; they do not change any load.
import Mathlib
namespace Graham1969
/-- Graham's LPT bound (Graham 1969, Theorem 2): on `m ≥ 1` identical machines, list scheduling
of jobs sorted by nonincreasing processing time (each job goes to a currently least-loaded machine,
ties broken arbitrarily) has makespan at most `(4/3 - 1/(3m)) · OPT`.
Jobs are `Fin n` (job `i` is the paper's job `i + 1`), machines are `Fin m`, `p` are the
processing times. The load of machine `j` under an assignment `τ` is
`∑ k ∈ univ.filter (τ · = j), p k`; the makespan is the maximum load (`Finset.sup'` over the
machines) and `OPT` is the minimum makespan over all assignments `τ : Fin n → Fin m`
(`Finset.inf'`). Machine `⟨0, hm⟩` witnesses that both index sets are nonempty. -/
theorem lpt_makespan_le (m n : ℕ) (hm : 0 < m) (p : Fin n → ℝ)
(hp : ∀ i, 0 ≤ p i) (hsorted : Antitone p) (σ : Fin n → Fin m)
(hLPT : ∀ i : Fin n, ∀ j : Fin m,
∑ k ∈ Finset.univ.filter (fun k => k < i ∧ σ k = σ i), p k ≤
∑ k ∈ Finset.univ.filter (fun k => k < i ∧ σ k = j), p k) :
Finset.univ.sup' ⟨⟨0, hm⟩, Finset.mem_univ _⟩
(fun j : Fin m => ∑ k ∈ Finset.univ.filter (fun k => σ k = j), p k) ≤
(4 / 3 - 1 / (3 * (m : ℝ))) *
Finset.univ.inf' ⟨fun _ => ⟨0, hm⟩, Finset.mem_univ _⟩
(fun τ : Fin n → Fin m => Finset.univ.sup' ⟨⟨0, hm⟩, Finset.mem_univ _⟩
(fun j : Fin m => ∑ k ∈ Finset.univ.filter (fun k => τ k = j), p k)) := by
sorry
end Graham1969