Lecture 4: Interval Scheduling

advertisement
CSE 431/531: Analysis of Algorithms
Spring 2016
Lecture 4: Interval Scheduling
Feb 1, 2016
Lecturer: Shi Li
Notations For a natural number n, we use [n] to denote the set {1, 2, 3, · · · , n}.
In the job interval scheduling problem, we are given n jobs indexed by 1, 2, · · · , n. Job i ∈ [n] has
starting time si and finish time fi > si . We say two distinct jobs i, j ∈ [n] are compatible if the
two intervals [si , fi ) are [sj , fj ) are non-intersecting. The goal of the interval scheduling problem is
to choose a maximum-size set S ⊆ [n], such that any two distinct jobs in S are compatible.
Lemma 4.1 Given an interval scheduling instance defined by n job intervals [s1 , f1 ), [s2 , f2 ), · · · , [sn , fn ),
there exists an optimum solution S ∗ ⊆ [n] such that i∗ ∈ S ∗ , where i∗ = arg mini∈[n] fi is the job
with the earliest finish time.
Proof: Let S be an optimum solution for the instance. If i∗ ∈ S then we are done. So, we can
assume i∗ ∈
/ S. Let i = arg minj∈S fj be the job in S with the earliest finish time, i.e, the first
job scheduled by the solution S (S is non-empty since we can always schedule one job). We then
claim that S \ {i} ∪ {i∗ } is also a feasible solution to the instance. To see this, it suffices to prove
that for any job j ∈ S \ {i}, j and i∗ are compatible, since any two distinct jobs j, j 0 ∈ S \ {i} are
compatible.
To prove the statement, we fix a job j ∈ S \ {i}. As i is the first job scheduled by S, we have that
sj ≥ fi . Also, i∗ is the job in [n] with the smallest finish time, and thus we have fi ≥ fi∗ . Overall,
we have sj ≥ fi∗ . So [sj , fj ) and [si∗ , fi∗ ) are disjoint: j and i∗ are compatible.
We define S ∗ = S \ {i} ∪ {i∗ } and thus |S ∗ | = |S|. Then, |S ∗ | is also an optimal solution; moreover
i∗ ∈ S ∗ . This finishes the proof.
4-1
Download