Download presentation
Presentation is loading. Please wait.
1
Lecture 37 CSE 331 Dec 1, 2010
2
A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email me any objections (or support) by Monday, Dec 6, noon Individual choice for every student
3
Weighted Interval Scheduling Input: n jobs (s i,t i,v i ) Output: A schedule S s.t. no two jobs in S have a conflict Goal: max Σ i in S v j Assume: jobs are sorted by their finish time
4
Couple more definitions p(j) = largest i<j s.t. i does not conflict with j = 0 if no such i exists OPT(j) = optimal value on instance 1,..,j p(j) < j
5
Property of OPT OPT(j) = max { v j + OPT( p(j) ), OPT(j-1) } j in OPT(j) j not in OPT(j) Given OPT(1),…., OPT(j-1), how can one figure out if j in optimal solution or not?
6
A recursive algorithm Compute-Opt(j) If j = 0 then return 0 return max { v j + Compute-Opt( p(j) ), Compute-Opt( j-1 ) } OPT(j) = max { v j + OPT( p(j) ), OPT(j-1) } Proof of correctness by induction on j Correct for j=0 = OPT( p(j) ) = OPT( j-1 )
7
Exponential Running Time 1 2 3 4 5 p(j) = j-2 OPT(5) OPT(3) OPT(4) OPT(1) OPT(2) OPT(1) OPT(2) OPT(1) OPT(2) OPT(3) Formal proof: Q 3 on sample final Only 5 OPT values!
8
Today’s agenda Trading memory for faster run time Computing the optimal schedule from OPT values Iterative view of the dynamic program
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.