S13 Interval Scheduling
S13 Interval Scheduling
1) each job gets a number of time slots that equals its size;
Example:
jobs 1 2 3 4 5
size 1 2 1 2 2
deadline 2 4 5 8 9
time 1 2 3 4 5 6 7 8 9 10
job assignment 1 - 2 2 3 4 4 - 5 -
- The rst s1 time slots are assigned to job 1, the next s2 time
slots are assigned to job 2, and so on.
• Example:
job 1
job 2
job 3
job 4
job 5
job 6
job 7
• Example:
job 1
job 2
job 3
job 4
job 5
job 6
job 7
- [Shortest interval]
Consider jobs in ascending order of interval length fj - sj.
• [Shortest interval]
Proof.
- Assume greedy is not optimal, and let’s see what happens.
- Let i1, i2, ... , ik denote the set of jobs selected by greedy.
- Let j1, j2, ... , jm denote the set of jobs in the optimal solution
with i1 = j1, i2 = j2, … , ir = jr for the largest possible value of r.
i1 i2 … ir ir+1
Greedy
j1 j2 … jr jr+1
Optimal
Proof.
- Assume greedy is not optimal, and let’s see what happens.
- Let i1, i2, ... , ik denote the set of jobs selected by greedy.
- Let j1, j2, ... , jm denote the set of jobs in the optimal solution
with i1 = j1, i2 = j2, … , ir = jr for the largest possible value of r.
i1 i2 … ir ir+1
Greedy
j1 j2 … jr ir+1jr+1
Optimal
Proof.
- Assume greedy is not optimal, and let’s see what happens.
- Let i1, i2, ... , ik denote the set of jobs selected by greedy.
- Let j1, j2, ... , jm denote the set of jobs in the optimal solution
with i1 = j1, i2 = j2, … , ir = jr for the largest possible value of r.
i1 i2 … ir ir+1
Greedy
j1 j2 … jr ir+1jr+1
Optimal