This preview shows pages 1–7. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CMSC 451: Dynamic Programming Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Sections 6.1&6.2 of Algorithm Design by Kleinberg & Tardos. Dynamic Programming Dynamic Programming Our 3rd major algorithm design technique Similar to divide & conquer Build up the answer from smaller subproblems More general than simple divide & conquer Also more powerfulcy Generally applies to algorithms where the brute force algorithm would be exponential. Weighted Interval Scheduling Recall the interval scheduling problem weve seen several times: choose as many nonoverlapping intervals as possible. What if each interval had a value? Problem (Weighted Interval Scheduling) Given a set of n intervals ( s i , f i ) , each with a value v i , choose a subset S of nonoverlapping intervals with i S v i maximized. Example s1 f1 v3 = 1 v2 = 3 1 2 3 Note that our simple greedy algorithm for the unweighted case doesnt work. This is becasue some interval can be made very important with a high weight. Greedy Algorithm For Unweighted Case Greedy Algorithm For Unweighted Case: 1 Sort by increasing finishing time 2 Repeat until no intervals left: 1 Choose next interval 2 Remove all intervals it overlaps with Just look for the value of the OPT Suppose for now were not interested in the actual set of intervals. Only interested in the value of a solution (aka its cost, score, objective value)....
View
Full
Document
This note was uploaded on 01/13/2012 for the course CMSC 423 taught by Professor Staff during the Fall '07 term at Maryland.
 Fall '07
 staff

Click to edit the document details