π Definition
β¨ Key Questions
π― Real-World Impact
Poor sequencing leads to:
Good sequencing provides:
π Manufacturing
Order parts through machines β Minimize completion time
π₯ Healthcare
Schedule surgeries in operating room β Minimize waiting
π» Computer Systems
Process jobs in CPU β Optimize throughput
π Service Industry
Prepare food orders β Meet delivery promises
Single Machine
Multiple Machines
π― The Setup
The Question
In what order should we process these jobs?
π Important Definitions
Processing time (\(p_i\)): Time to complete job \(i\)
Completion time (\(C_i\)): Time when job \(i\) finishes
Flow time (\(F_i\)): Total time job \(i\) spends in system \[F_i = C_i\]
Due date (\(d_i\)): Deadline for job \(i\)
Lateness (\(L_i\)): How late (or early) job finishes \[L_i = C_i - d_i\]
π Additional Measures
Tardiness (\(T_i\)): Amount of time past due date \[T_i = \max(0, L_i) = \max(0, C_i - d_i)\]
Earliness (\(E_i\)): Amount of time before due date \[E_i = \max(0, d_i - C_i)\]
Number of tardy jobs (\(n_T\)): Count of late jobs
π― What We Want to Minimize
Mean Flow Time: \(\bar{F} = \frac{1}{n}\sum_{i=1}^{n} F_i\)
Makespan: \(C_{\max} = \max(C_i)\)
Mean Tardiness: \(\bar{T} = \frac{1}{n}\sum_{i=1}^{n} T_i\)
Maximum Tardiness: \(T_{\max} = \max(T_i)\)
Number of Tardy Jobs: \(n_T\)
Weighted measures: \(\sum w_i F_i\), \(\sum w_i T_i\)
π Print Shop Problem
3 jobs arrive at a printing machine
| Job | Processing Time (\(p_i\)) | Due Date (\(d_i\)) |
|---|---|---|
| A | 5 hours | 8 hours |
| B | 3 hours | 6 hours |
| C | 4 hours | 10 hours |
Tip
Question: What sequence minimizes mean flow time?
Processing order: A β B β C
| Job | \(p_i\) | Start | \(C_i\) | \(F_i\) | \(d_i\) | \(L_i\) | \(T_i\) |
|---|---|---|---|---|---|---|---|
| A | 5 | 0 | 5 | 5 | 8 | -3 | 0 |
| B | 3 | 5 | 8 | 8 | 6 | 2 | 2 |
| C | 4 | 8 | 12 | 12 | 10 | 2 | 2 |
Results
Processing order: B β A β C
| Job | \(p_i\) | Start | \(C_i\) | \(F_i\) | \(d_i\) | \(L_i\) | \(T_i\) |
|---|---|---|---|---|---|---|---|
| B | 3 | 0 | 3 | 3 | 6 | -3 | 0 |
| A | 5 | 3 | 8 | 8 | 8 | 0 | 0 |
| C | 4 | 8 | 12 | 12 | 10 | 2 | 2 |
Results
Processing order: B β C β A
| Job | \(p_i\) | Start | \(C_i\) | \(F_i\) | \(d_i\) | \(L_i\) | \(T_i\) |
|---|---|---|---|---|---|---|---|
| B | 3 | 0 | 3 | 3 | 6 | -3 | 0 |
| C | 4 | 3 | 7 | 7 | 10 | -3 | 0 |
| A | 5 | 7 | 12 | 12 | 8 | 4 | 4 |
Results
π Performance Comparison
| Sequence | Mean Flow Time | Mean Tardiness | Tardy Jobs |
|---|---|---|---|
| A-B-C | 8.33 | 1.33 | 2 |
| A-C-B | 8.67 | 2.00 | 2 |
| B-C-A | 7.33 β | 1.33 | 1 |
| B-A-C | 7.67 | 0.67 | 1 |
| C-A-B | 9.00 | 2.00 | 2 |
| C-B-A | 9.33 | 2.67 | 2 |
Important
Best for flow time: B-C-A (shortest jobs first!)
π Definition
Priority rules (or dispatching rules) are simple heuristics that determine the order in which jobs are processed.
How they work:
Tip
Easy to understand and implement! π
π― FCFS - First Come First Served
Process jobs in order of arrival
β‘ SPT - Shortest Processing Time
Process shortest job first
π EDD - Earliest Due Date
Process job with earliest deadline first
π The Rule
Process jobs in the order they arrive
π Advantages
π₯ Medical Lab Problem
A medical lab processes 5 blood samples
| Job | Arrival Order | Processing Time (\(p_i\)) | Due Date (\(d_i\)) |
|---|---|---|---|
| 1 | 1st | 6 | 10 |
| 2 | 2nd | 3 | 8 |
| 3 | 3rd | 8 | 15 |
| 4 | 4th | 2 | 7 |
| 5 | 5th | 5 | 12 |
Tip
FCFS Rule: Process in order 1-2-3-4-5
Sequence: 1 β 2 β 3 β 4 β 5
| Job | \(p_i\) | Start | \(C_i\) | \(F_i\) | \(d_i\) | \(L_i\) | \(T_i\) |
|---|---|---|---|---|---|---|---|
| 1 | 6 | 0 | 6 | 6 | 10 | -4 | 0 |
| 2 | 3 | 6 | 9 | 9 | 8 | 1 | 1 |
| 3 | 8 | 9 | 17 | 17 | 15 | 2 | 2 |
| 4 | 2 | 17 | 19 | 19 | 7 | 12 | 12 |
| 5 | 5 | 19 | 24 | 24 | 12 | 12 | 12 |
| Ξ£=24 | Ξ£=75 | Ξ£=27 |
π Performance Metrics
Warning
Notice: Job 4 (shortest, earliest due date) waited until last! Not ideal for minimizing tardiness.
FCFS Sequence: A β B β C β D
| Order | Time (min) | Ready At | Promised | Lateness | Tardy? |
|---|---|---|---|---|---|
| A | 5 | 8:05 | 8:12 | -7 min | No |
| B | 2 | 8:07 | 8:10 | -3 min | No |
| C | 7 | 8:14 | 8:18 | -4 min | No |
| D | 3 | 8:17 | 8:15 | +2 min | Yes |
Summary
π Important Points
β οΈ Problem
If a short urgent job arrives late, it still waits for all earlier jobs!
β‘ The Rule
Always process the job with the shortest processing time next
π Famous Result
SPT minimizes mean flow time!
This is a proven optimal result for single machine scheduling.
π‘ The Logic
Example: Jobs of 10 min and 2 min
Order 10-2:
Order 2-10:
Shorter jobs first β Fewer jobs waiting!
β Benefits
π Performance
π₯ Medical Lab - Revisited
Using the same 5 blood samples:
| Job | Arrival Order | Processing Time (\(p_i\)) | Due Date (\(d_i\)) |
|---|---|---|---|
| 1 | 1st | 6 | 10 |
| 2 | 2nd | 3 | 8 |
| 3 | 3rd | 8 | 15 |
| 4 | 4th | 2 | 7 |
| 5 | 5th | 5 | 12 |
Tip
SPT Rule: Order by processing time: 4-2-5-1-3
Sequence: 4 β 2 β 5 β 1 β 3
| Job | \(p_i\) | Start | \(C_i\) | \(F_i\) | \(d_i\) | \(L_i\) | \(T_i\) |
|---|---|---|---|---|---|---|---|
| 4 | 2 | 0 | 2 | 2 | 7 | -5 | 0 |
| 2 | 3 | 2 | 5 | 5 | 8 | -3 | 0 |
| 5 | 5 | 5 | 10 | 10 | 12 | -2 | 0 |
| 1 | 6 | 10 | 16 | 16 | 10 | 6 | 6 |
| 3 | 8 | 16 | 24 | 24 | 15 | 9 | 9 |
| Ξ£=24 | Ξ£=57 | Ξ£=15 |
π Performance Comparison
| Metric | FCFS | SPT | Improvement |
|---|---|---|---|
| Mean Flow Time | 15.0 | 11.4 | 24% better β |
| Mean Tardiness | 5.4 | 3.0 | 44% better β |
| Max Tardiness | 12 | 9 | 25% better β |
| Tardy Jobs | 4 | 2 | 50% better β |
| Makespan | 24 | 24 | Same |
Tip
SPT is clearly better for this example!
π» Server Processing Problem
A server must process 6 jobs
| Job | Processing Time (sec) | Due Time (sec) |
|---|---|---|
| A | 15 | 25 |
| B | 8 | 18 |
| C | 12 | 30 |
| D | 5 | 15 |
| E | 20 | 40 |
| F | 10 | 22 |
Tip
SPT Order: D(5) β B(8) β F(10) β C(12) β A(15) β E(20)
Sequence: D β B β F β C β A β E
| Job | \(p_i\) | Start | \(C_i\) | \(d_i\) | \(L_i\) | \(T_i\) |
|---|---|---|---|---|---|---|
| D | 5 | 0 | 5 | 15 | -10 | 0 |
| B | 8 | 5 | 13 | 18 | -5 | 0 |
| F | 10 | 13 | 23 | 22 | 1 | 1 |
| C | 12 | 23 | 35 | 30 | 5 | 5 |
| A | 15 | 35 | 50 | 25 | 25 | 25 |
| E | 20 | 50 | 70 | 40 | 30 | 30 |
| Ξ£=70 | Ξ£=196 | Ξ£=61 |
π Results
Warning
Problem: Jobs A and E are very late because theyβre long jobs! This is the βstarvationβ issue.
π½οΈ Kitchen Problem
5 food orders to prepare
| Order | Dish | Prep Time (min) | Customer Waiting |
|---|---|---|---|
| 1 | Steak | 18 | Table 5 |
| 2 | Salad | 5 | Table 2 |
| 3 | Pasta | 12 | Table 7 |
| 4 | Soup | 7 | Table 3 |
| 5 | Sandwich | 10 | Table 1 |
SPT Order: 2(Salad) β 4(Soup) β 5(Sandwich) β 3(Pasta) β 1(Steak)
| Order | Time | Ready At | Cumulative Wait |
|---|---|---|---|
| 2 | 5 | 5 min | 5 |
| 4 | 7 | 12 min | 12 |
| 5 | 10 | 22 min | 22 |
| 3 | 12 | 34 min | 34 |
| 1 | 18 | 52 min | 52 |
| Total: 52 | Sum: 125 |
Important
Mean waiting time: 125/5 = 25 minutes
π The Rule
Always process the job with the earliest (soonest) due date next
π Famous Result
EDD minimizes maximum lateness (\(L_{\max}\))!
Proven optimal for this specific objective.
π‘ The Logic
Goal: Avoid being very late on any job
Strategy: Do urgent jobs first
Result:
Important: Doesnβt minimize mean tardiness, just maximum!
Important
β Good For
β Not Good For
π₯ Medical Lab - Third Approach
Same 5 blood samples again:
| Job | Processing Time (\(p_i\)) | Due Date (\(d_i\)) |
|---|---|---|
| 1 | 6 | 10 |
| 2 | 3 | 8 |
| 3 | 8 | 15 |
| 4 | 2 | 7 |
| 5 | 5 | 12 |
Tip
EDD Rule: Order by due date: 4(7) β 2(8) β 1(10) β 5(12) β 3(15)
Sequence: 4 β 2 β 1 β 5 β 3
| Job | \(p_i\) | Start | \(C_i\) | \(F_i\) | \(d_i\) | \(L_i\) | \(T_i\) |
|---|---|---|---|---|---|---|---|
| 4 | 2 | 0 | 2 | 2 | 7 | -5 | 0 |
| 2 | 3 | 2 | 5 | 5 | 8 | -3 | 0 |
| 1 | 6 | 5 | 11 | 11 | 10 | 1 | 1 |
| 5 | 5 | 11 | 16 | 16 | 12 | 4 | 4 |
| 3 | 8 | 16 | 24 | 24 | 15 | 9 | 9 |
| Ξ£=24 | Ξ£=58 | Max=9 | Ξ£=14 |
π FCFS vs SPT vs EDD
| Metric | FCFS | SPT | EDD |
|---|---|---|---|
| Mean Flow Time | 15.0 | 11.4 β | 11.6 |
| Mean Tardiness | 5.4 | 3.0 | 2.8 |
| Max Tardiness | 12 | 9 | 9 β |
| Max Lateness | 12 | 9 | 9 β |
| Tardy Jobs | 4 | 2 | 3 |
| Makespan | 24 | 24 | 24 |
Note
π¦ Delivery Service Problem
Driver has 6 packages to deliver
| Package | Delivery Time (min) | Promised By |
|---|---|---|
| A | 10 | 9:30 AM |
| B | 15 | 9:45 AM |
| C | 8 | 9:20 AM |
| D | 12 | 9:40 AM |
| E | 20 | 10:00 AM |
| F | 6 | 9:25 AM |
Current time: 9:00 AM
Convert to Minutes from Now
| Package | Time (min) | Promised | Due in (min) |
|---|---|---|---|
| A | 10 | 9:30 | 30 |
| B | 15 | 9:45 | 45 |
| C | 8 | 9:20 | 20 |
| D | 12 | 9:40 | 40 |
| E | 20 | 10:00 | 60 |
| F | 6 | 9:25 | 25 |
EDD Order: C(20) β F(25) β A(30) β D(40) β B(45) β E(60)
Sequence: C β F β A β D β B β E
| Pkg | Time | Done | Clock | Due | Lateness | Tardy? |
|---|---|---|---|---|---|---|
| C | 8 | 8 | 9:08 | 9:20 | -12 | No |
| F | 6 | 14 | 9:14 | 9:25 | -11 | No |
| A | 10 | 24 | 9:24 | 9:30 | -6 | No |
| D | 12 | 36 | 9:36 | 9:40 | -4 | No |
| B | 15 | 51 | 9:51 | 9:45 | +6 | Yes |
| E | 20 | 71 | 10:11 | 10:00 | +11 | Yes |
Important
Max Lateness: 11 minutes (Package E)
π― Key Differences
SPT (Shortest Processing Time):
EDD (Earliest Due Date):
π― Hospital Emergency Room
5 patients need treatment (non-life threatening)
| Patient | Treatment Time (min) | Triage Priority (due) |
|---|---|---|
| 1 | 20 | 50 min |
| 2 | 15 | 30 min |
| 3 | 10 | 40 min |
| 4 | 25 | 60 min |
| 5 | 12 | 35 min |
Questions: 1. What is the EDD sequence? 2. What is maximum lateness? 3. How many patients wait past their triage time?
β Answer
EDD Sequence: 2(30) β 5(35) β 3(40) β 1(50) β 4(60)
| Patient | Time | \(C_i\) | \(d_i\) | \(L_i\) | Tardy? |
|---|---|---|---|---|---|
| 2 | 15 | 15 | 30 | -15 | No |
| 5 | 12 | 27 | 35 | -8 | No |
| 3 | 10 | 37 | 40 | -3 | No |
| 1 | 20 | 57 | 50 | +7 | Yes |
| 4 | 25 | 82 | 60 | +22 | Yes |
π Quick Reference
| Rule | Based On | Optimal For | Good For | Bad For |
|---|---|---|---|---|
| FCFS | Arrival order | Fairness | Service industry, similar jobs | Efficiency, deadlines |
| SPT | Processing time | Mean flow time | Throughput, many short jobs | Long jobs, fairness |
| EDD | Due date | Max lateness | Critical deadlines | Flow time |
π― How to Choose?
Choose FCFS when:
Choose SPT when:
π― How to Choose? (continued)
Choose EDD when:
βοΈ When Jobs Have Different Importance
Some jobs are more important than others!
Weight \(w_i\) represents:
New Objective
Minimize weighted flow time: \(\sum w_i F_i\)
Or weighted tardiness: \(\sum w_i T_i\)
π Modified SPT Rule
WSPT Rule: Process jobs in order of highest weight-to-time ratio
\(\text{Priority} = \frac{w_i}{p_i}\)
Property: WSPT minimizes weighted mean flow time!
π Jewelry Repair Shop
4 repair jobs with different values
| Job | Time (hrs) | Weight (value) | \(w_i/p_i\) |
|---|---|---|---|
| A | 3 | 6 | 2.0 |
| B | 5 | 15 | 3.0 β |
| C | 2 | 4 | 2.0 |
| D | 4 | 8 | 2.0 |
WSPT Sequence: B(3.0) β A=C=D(2.0, break ties by SPT) Final: B β C β A β D
π Another Important Concept
Slack = How much βbreathing roomβ a job has
\(\text{Slack}_i = d_i - p_i - t\)
Where:
Interpretation:
β° Dynamic Priority Rule
MS Rule: Always process job with smallest slack
Initial Calculation (t=0):
| Job | \(p_i\) | \(d_i\) | Slack = \(d_i - p_i - 0\) |
|---|---|---|---|
| 1 | 4 | 12 | 12 - 4 = 8 |
| 2 | 3 | 8 | 8 - 3 = 5 β |
| 3 | 5 | 15 | 15 - 5 = 10 |
Process job 2 first (smallest slack = 5)
Warning
Note: Slack changes as time passes! Must recalculate.
π Manufacturing Shop
4 parts need machining at a CNC center
| Part | Processing Time (\(p_i\)) | Due Date (\(d_i\)) |
|---|---|---|
| A | 6 | 20 |
| B | 4 | 12 |
| C | 8 | 25 |
| D | 5 | 15 |
Apply Minimum Slack rule starting at t = 0
Step 1: Calculate initial slack at t = 0
| Part | \(p_i\) | \(d_i\) | Slack = \(d_i - p_i - 0\) | Rank |
|---|---|---|---|---|
| A | 6 | 20 | 20 - 6 - 0 = 14 | 3rd |
| B | 4 | 12 | 12 - 4 - 0 = 8 | 1st β |
| C | 8 | 25 | 25 - 8 - 0 = 17 | 4th |
| D | 5 | 15 | 15 - 5 - 0 = 10 | 2nd |
Select Part B (minimum slack = 8)
Process B from t=0 to t=4
Step 2: Recalculate slack at t = 4 (after B completes)
| Part | \(p_i\) | \(d_i\) | Slack = \(d_i - p_i - 4\) | Rank |
|---|---|---|---|---|
| A | 6 | 20 | 20 - 6 - 4 = 10 | 2nd |
| C | 8 | 25 | 25 - 8 - 4 = 13 | 3rd |
| D | 5 | 15 | 15 - 5 - 4 = 6 | 1st β |
Select Part D (minimum slack = 6)
Process D from t=4 to t=9
Step 3: Recalculate slack at t = 9
| Part | \(p_i\) | \(d_i\) | Slack = \(d_i - p_i - 9\) | Rank |
|---|---|---|---|---|
| A | 6 | 20 | 20 - 6 - 9 = 5 | 1st β |
| C | 8 | 25 | 25 - 8 - 9 = 8 | 2nd |
Select Part A, then Part C
Final MS Sequence: B β D β A β C
Complete Schedule:
| Part | \(p_i\) | Start | \(C_i\) | \(F_i\) | \(d_i\) | \(L_i\) | \(T_i\) |
|---|---|---|---|---|---|---|---|
| B | 4 | 0 | 4 | 4 | 12 | -8 | 0 |
| D | 5 | 4 | 9 | 9 | 15 | -6 | 0 |
| A | 6 | 9 | 15 | 15 | 20 | -5 | 0 |
| C | 8 | 15 | 23 | 23 | 25 | -2 | 0 |
Results