Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 9 CSE 331 June 18, 2013. The “real” end of Semester blues MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term.

Similar presentations


Presentation on theme: "Lecture 9 CSE 331 June 18, 2013. The “real” end of Semester blues MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term."— Presentation transcript:

1 Lecture 9 CSE 331 June 18, 2013

2 The “real” end of Semester blues MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term paper There are deadlines and durations of tasks

3 The “real” end of Semester blues MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term paper There are deadlines and durations of tasks

4 The algorithmic task MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term paper YOU decide when to start each task You have to do ALL the tasks

5 Scheduling to minimize lateness MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term paper All the tasks have to be scheduled GOAL: minimize maximum lateness All the tasks have to be scheduled GOAL: minimize maximum lateness

6 One possible schedule MondayTuesdayWednesdayThursdayFriday 331 HW Exam study Party! Write up a term paper All the tasks have to be scheduled GOAL: minimize maximum lateness All the tasks have to be scheduled GOAL: minimize maximum lateness Lateness = 0 Lateness = 2

7 Scheduling to minimize lateness n jobs: ith job (t i,d i ) Schedule the n jobs: ith job gets interval [s(i),f(i)=s(i)+t i ) At most one job at any time Algo picks s(i) GOAL: Minimize MAXIMUM lateness Lateness of job i, l i = max(0,f(i)-d i ) Not the sum start time: s

8 The Greedy Algorithm (Assume jobs sorted by deadline: d 1 ≤ d 2 ≤ ….. ≤ d n ) f=s For every i in 1..n do Schedule job i from s(i)=f to f(i)=f+t i f=f+t i

9 Solving end of Semester blues MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Term paper Party! Exam study 331 HW Project Term paper 0000 2 Max lateness = 2

10 Proof of Correctness on visualizer “Exchange argument” But first, a few definitions

11 Two definitions for schedules f=s For every i in 1..n do Schedule job i from s(i)=f to f(i)=f+t i f=f+t i Idle time Inversion Max “gap” between two consecutively scheduled tasks i i j j Idle time =1Idle time =0 (i,j) is an inversion if i is scheduled before j but d i > d j i i j j i i j j What is the idle time and max # inversion for greedy schedule?

12 Will prove today Any two schedules with 0 idle time and 0 inversions have the same max lateness Greedy schedule has 0 idle time and 0 inversions There is an optimal schedule with 0 idle time and 0 inversions

13 Optimal schedule with 0 idle time = = = = ≥ ≥ ≥ ≥ Lateness “Only” need to convert a 0 idle optimal ordering to one with 0 inversions (and 0 idle time)


Download ppt "Lecture 9 CSE 331 June 18, 2013. The “real” end of Semester blues MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term."

Similar presentations


Ads by Google