Definition · The number of late jobsU_j is 1 when C_j > d_j and 0 otherwise, and the objective sum U counts the late jobs. A schedule is measured by how many promises it broke, not by how far.
Definition · The Moore–Hodgson algorithmSort the jobs by due date ascending. Keep a set S, initially empty, and a running finish time. Offer the jobs in that order: add the next job to S and advance the finish time by its processing time. If the finish time now exceeds the due date of the job just added, remove from S the job with the largest processing time and reduce the finish time by it.
At the end, S is a largest set of jobs that can all be on time. Schedule S in due-date order, then the discarded jobs in any order. The number of late jobs is the number discarded.
The algorithm is offered the jobs in due-date order and it is not the due-date rule. That distinction is the whole reason it works, and the lab prints both figures side by side so it cannot be blurred: due-date order alone leaves four jobs late on the instance where the algorithm leaves two.
Five jobs, five steps, two discards
jobs offered in due-date order B 4:4, D 3:6, A 6:8, C 5:12, E 7:20
1 B joins set B finish 4 against due 4 on time
2 D joins set B D finish 7 against due 6 LATE
discard the longest in the set: B at 4
set D, finish drops to 3
3 A joins set D A finish 9 against due 8 LATE
discard the longest in the set: A at 6
set D, finish drops to 3
4 C joins set D C finish 8 against due 12 on time
5 E joins set D C E finish 15 against due 20 on time
kept D C E discarded B, A late 2
schedule D C E B A C = 3, 8, 15, 19, 25
enumerated minimum over all 120 orders: 2 the algorithm attains it
Example · Step 2, and why B goes rather than DD is the job that pushed the set past a due date: adding it took the finish from 4 to 7 against D's due date of 6. The instinct is to discard D. Either choice leaves exactly one job late at this point, so the two are tied on the objective and the tie is broken by what is left behind.
Discarding D frees three hours; discarding B frees four. The algorithm takes the four, and the extra hour is what lets C and E both join later without another discard. B had been comfortably on time at step 1 and is thrown out at step 2 without ever having been the problem.
The two rules it beats, measured
due-date order alone B D A C E late 4
Moore–Hodgson D C E B A late 2
shortest-first D B C A E late 3
the enumerated minimum late 2, attained by 10 of the 120 orders
Due-date order leaves four late, and it is not a bad rule — it is the optimal rule for maximum lateness on this very instance. It loses here because it never gives up on anything: it keeps trying to run B and A on time and fails at both, and the hours spent failing make C late as well. Writing two jobs off at the start is what buys the other three.
That is the difference between a sorting rule and an algorithm, and it is why this lesson is not a fourth exchange argument. There is no key you can sort the jobs by that produces D C E B A; the answer depends on a set being built and repaired, and the repair looks at jobs that were accepted several steps earlier.
What the algorithm does not do
It does not minimise total tardiness, and it does not try to. Its output on the lab's instance runs the two discarded jobs at the very end, where B finishes at 19 against a due date of 4 and A at 25 against 8. That is 15 + 17 = 32 hours of tardiness against the 17 due-date order costs, and the algorithm is indifferent to all of it, because the objective counts jobs.
It also does not weight the jobs. The weighted version — minimise sum w U, the value of the work that misses its date — is a genuinely harder problem, and no version of this argument reaches it: the tie that let us discard the longest job was a tie because every discard cost one unit, and with weights the discards cost different amounts. The lab does not offer a weighted mode, and this is why.
One structural point worth keeping. The kept set finishes on time in due-date order, and the lab checks that job by job rather than trusting it: D at 3 against 6, C at 8 against 12, E at 15 against 20. If a set can be run on time at all, it can be run on time in due-date order — which is the exchange argument of “Earliest Due Date and Maximum Lateness”, used here as a tool rather than as a result.