Online Scheduling of a Single Machine to Minimize Total Weighted Completion Time: Delayed SWPT Has Competitive Ratio 2Research Paper
Motivation
A single machine must process jobs that arrive over time. Job is released at time , needs units of uninterrupted processing, and has weight ; the goal is to minimize the total weighted completion time . Offline, with all release dates equal to zero, Smith's rule (sequence by nondecreasing ) is optimal (Smith 1956); with arbitrary release dates the problem is strongly NP-hard (Lenstra, Rinnooy Kan and Brucker 1977).
In the online version the scheduler learns of job only at time , and at each moment must either start a released job or keep the machine idle. Its quality is measured by its competitive ratio: the worst case, over all instances, of the ratio between the online schedule's cost and the offline optimum. Release-date scheduling is one of the basic test cases of online optimization.
Timeline:
- 1996. Hoogeveen and Vestjens show that no online algorithm has competitive ratio below 2, even with equal weights, and give the 2-competitive algorithm Delayed SPT for equal weights.
- 1997. Hall, Schulz, Shmoys and Wein give a -competitive algorithm for arbitrary weights, based on geometric intervals and linear programming.
- 1998. Phillips, Stein and Wein give another 2-competitive algorithm for equal weights, which does not extend to arbitrary weights.
- 2002. Goemans, Queyranne, Schulz, Skutella and Wang obtain a -competitive deterministic algorithm from an LP relaxation.
- 2004. Anderson and Potts show that Delayed SWPT has competitive ratio exactly 2 for arbitrary positive weights, matching the lower bound.
Setting
An instance has jobs with integer release dates , integer processing times and real weights . A schedule assigns each job an integer start time . It is feasible if for every and no two intervals overlap; idle time is allowed. Its cost is .
Delayed SWPT runs over unit time slots . When the machine is available at time , it looks at the jobs released by and not yet started, and selects one with the smallest ratio . Ties go to the smaller , then to the smaller index. If , it starts at and the machine is busy until . Otherwise the machine stays idle and the rule is applied again at . The resulting schedule is written , or dswpt I in Lean. In particular no job starts before time .
The proof uses three auxiliary problems:
- the doubled problem (2P), with data ;
- the extended problem (E), with release dates , where is the first time at or after at which leaves the machine free;
- one unit-length gap job for each slot in which Delayed SWPT idles although a job is available. The gap job has release date and weight .
The schedule of (E) runs the original jobs as in and each in .
Formalization targets
Goal: Theorem 8
Lean: IsLeast {ρ | ∀ n I S, IsFeasible I.r I.p S → cost I.w I.p (dswpt I) ≤ ρ * cost I.w I.p S} 2. Both halves are required: the upper bound and the fact that no smaller constant is valid for this algorithm.
Milestones
- for every job (§2) and (§3.2).
- is feasible for (E) (§3.2).
- Lemma 1. If and are optimal for (P) and (2P), then .
- Lemma 2. is optimal for (E).
- Lemma 3. If is optimal for (2P) and a feasible for (E) satisfies
then for every feasible . 6. Inequality (1) holds for some feasible , for every optimal of (2P) (§§3.4–3.6).
Significance
The theorem shows that a deterministic online algorithm can match the lower bound of Hoogeveen and Vestjens for arbitrary positive weights. This settles the best competitive ratio for deterministic online algorithms for . The algorithm needs no linear program. The analysis also does not compare the algorithm with a lower bound on the optimum. Instead it shows that the online schedule is optimal for a modified problem (E), and it converts an optimal schedule of (2P) into a schedule of (E).
The result was proved on paper in 2004. Neither Mathlib nor the Prove2Me catalog contains a machine-checked proof of it, or of any competitive ratio for online scheduling with release dates. This mission provides several reusable pieces:
- an executable, verified-terminating definition of an online scheduling rule;
- the doubling lemma for release-date problems;
- the optimality criterion behind Lemma 2;
- the block-by-block exchange argument of §§3.3–3.6.
Difficulty
The obvious argument fails at Lemma 2. Delayed SWPT is far from optimal for (P) itself, and its idle time is unbounded in relative terms. The proof therefore has to show that the inserted gap jobs make every idle slot "justified", so that a preemptive best-available argument becomes valid for (E). That argument rests on an optimality criterion of Belouadah, Posner and Potts (1992), which is not in Mathlib.
The second difficulty is inequality (1). Once is doubled and the gap jobs are inserted, nongap jobs must be shifted, and the gain of each gap-generating job must be charged against the delay of the gap jobs in its block. That accounting (Lemmas 4–7 of the paper) is an induction over blocks with signed differences of completion times.
The natural first idea, plain online SWPT (start the available job with the smallest whenever the machine is free), has no finite competitive ratio (Example 1 of the paper), so the delay is essential to the bound and must be tracked through the whole argument.
Formalization scope
Conventions committed to in Lean:
- Data. Jobs are
Fin n(0-based, so "smallest index" is the order ofFin n). Times are natural numbers, the paper's standing integer-data assumption (p. 688), and weights are real. Every instance carries and . - Schedules and optimality. Schedules are integer start times. Feasibility, cost and optimality are defined for any finite job type, so (E), with job type
Fin n ⊕ gapTimes I, uses the same notions. "Optimal" means optimal among all feasible nonpreemptive schedules with integer start times. - The algorithm. Delayed SWPT is a
def: a unit-time simulation that compares ratios by cross-multiplication and re-applies the rule at every slot. It runs to the horizon . A sorry-free check (not uploaded) shows that every job has started by then, and that the simulation reproduces Examples 3 and 4 of the paper, including the gap times of Table 2. - Completion times. In (2P) the completion time is , and gap jobs have unit length.
The goal quantifies over every feasible schedule of every instance. It cannot be met by restricting the competitor to schedules without idle time or to list schedules, by dropping release-date feasibility, or by leaving jobs unscheduled.
Out of scope:
- The general lower bound "no online algorithm beats 2" (Example 2 of the paper, due to Hoogeveen and Vestjens) is not part of the mission. The lower half of the goal concerns Delayed SWPT only.
- The Belouadah–Posner–Potts optimality criterion is an external ingredient of Lemma 2. Solvers may formalize it as a supporting theorem.
Infrastructure that a complete development needs:
- simulation invariants for the algorithm;
- exchange and left-shift arguments for single-machine schedules;
- the job-splitting relaxation behind the best-available criterion.
The schedule vocabulary and the criterion are reusable for other release-date scheduling results. Contributions toward the block lemmas of §§3.3–3.6 (Lemmas 4–7, the bound (9)) are welcome as supporting theorems.
Selected references
- E. J. Anderson and C. N. Potts, Online Scheduling of a Single Machine to Minimize Total Weighted Completion Time, Mathematics of Operations Research 29(3), 686–697, 2004. https://doi.org/10.1287/moor.1040.0092
- J. A. Hoogeveen and A. P. A. Vestjens, Optimal On-Line Algorithms for Single-Machine Scheduling, IPCO 1996, LNCS 1084, 404–414. https://doi.org/10.1007/3-540-61310-2_30
- L. A. Hall, A. S. Schulz, D. B. Shmoys and J. Wein, Scheduling to Minimize Average Completion Time: Off-line and On-line Approximation Algorithms, Mathematics of Operations Research 22(3), 513–544, 1997. https://doi.org/10.1287/moor.22.3.513
- C. Phillips, C. Stein and J. Wein, Minimizing Average Completion Time in the Presence of Release Dates, Mathematical Programming 82, 199–223, 1998. https://doi.org/10.1007/BF01585872
- M. X. Goemans, M. Queyranne, A. S. Schulz, M. Skutella and Y. Wang, Single Machine Scheduling with Release Dates, SIAM Journal on Discrete Mathematics 15(2), 165–192, 2002. https://doi.org/10.1137/S089548019936223X
- H. Belouadah, M. E. Posner and C. N. Potts, Scheduling with Release Dates on a Single Machine to Minimize Total Weighted Completion Time, Discrete Applied Mathematics 36(3), 213–231, 1992. https://doi.org/10.1016/0166-218X(92)90255-9
- J. K. Lenstra, A. H. G. Rinnooy Kan and P. Brucker, Complexity of Machine Scheduling Problems, Annals of Discrete Mathematics 1, 343–362, 1977. https://doi.org/10.1016/S0167-5060(08)70743-X
- W. E. Smith, Various Optimizers for Single-Stage Production, Naval Research Logistics Quarterly 3, 59–66, 1956. https://doi.org/10.1002/nav.3800030106