Lawler's algorithm is an efficient algorithm for solving a variety of constrained scheduling problems, particularly single-machine scheduling.[1] It can handle precedence constraints between jobs, requiring certain jobs to be completed before other jobs can be started. It can schedule jobs on a single processor in a way that minimizes the maximum tardiness, lateness, or any function of them.
There are n jobs. Each job is denoted by i {\displaystyle i} and has the following characteristics:
The objective function is m i n m a x 0 ≤ i ≤ n g i ( F i ) {\displaystyle min\,max_{0\leq i\leq n}\,g_{i}(F_{i})} .[2] Some special cases are:
The algorithm builds the schedule back to front. For each scheduling step, it looks only at the tasks that no other tasks depend on, and puts the one with the latest due date at the end of the schedule queue. Then it repeats this process until all jobs are scheduled.
The algorithm works by planning the job with the least impact as late as possible. Starting at t = ∑ p j {\displaystyle t=\sum p_{j}} that p j {\displaystyle p_{j}} is the processing time of job j {\displaystyle j} .
S {\displaystyle S} set of already scheduled jobs (at start: S = ∅ {\displaystyle \emptyset } ) J {\displaystyle J} set of jobs whose successors have been scheduled (at start: all jobs without successors) t {\displaystyle t} time when the next job will be completed (at start: t = ∑ p j {\displaystyle t=\sum p_{j}} ) while J ≠ ∅ {\displaystyle J\neq \emptyset } do select j ∈ J {\displaystyle j\in J} such that f j ( t ) = m i n k ∈ J f k ( t ) {\displaystyle f_{j}(t)=min_{k\in J}f_{k}(t)} schedule j {\displaystyle j} such that it completes at time t {\displaystyle t} add j {\displaystyle j} to S {\displaystyle S} , delete j {\displaystyle j} from J {\displaystyle J} and update J {\displaystyle J} . t = t − p j {\displaystyle t=t-p_{j}} end while
Assuming there are three jobs: t1, t2, and t3, with the following precedence constraints:
And the following deadlines (due date in a month)
Now we construct the required set of jobs:
Repeat the following steps until J is empty:
Do the next round:
J is now empty. The end.
So the final schedule is t1 -> t2-> t3 as S = {t1, t2, t3}
A more complex example, with simplified steps: The jobs and precedence constraints are shown below: a parent node --> child node in the tree.
j1 (2) / \ j2 j3 (2) (4) / \ | j4 j5 j6 (3) (5) (6)
The due dates of jobs are shown underneath of each node of the tree in parentheses.
Now look at the set of jobs without any successors, find the one with latest due date, put it into the front of S: