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 Document
Unformatted text preview: Optimization Problems • Each instance has a number of candidate solutions . • An objective function (usually) maps each candidate solution to a numeric value. • The goal is to find a candidate solution that either minimizes or maximizes the objective function, depending on the problem. • Example: Maximum subsequence sum. 1 Greedy Algorithms • Builds an optimal solution incrementally. • At each step, the partial solution is extended according to some criterion that is reasonably easy to evaluate. – We must prove that whenever we have a partial solution that can be extended to an optimal solution, this extension will result in a partial solution that can be extended to an optimal solution. • Not all optimization problems admit greedy algorithms; however, when a greedy algorithm is possible, it can usually be implemented efficiently. 2 Job Scheduling Input: A set of jobs { x 1 , . . . , x m } , each having a natural number deadline and value . Output: An array sched [1 ..n ] such that • for 1 ≤ i ≤ n , ≤ sched [ i ] ≤ m ; • if sched [ i ] negationslash = 0 , then i is no greater than the deadline of x sched [ i ] ; • each j , 1 ≤ j ≤ m , appears at most once in sched [1 ..n ] ; and • the sum of the values of the scheduled jobs is maximized. 3 Generalization • The first step in constructing any greedy algorithm is to generalize the problem so that the input also includes a partial solution. • A straightforward generalization includes as input a set of (unscheduled) jobs and a schedule of other jobs. • In making the next scheduling decision, we don’t need to know which jobs occupy the occupied time slots — only that these slots are occupied. • The generalization we use takes as input a set of unscheduled jobs and a boolean array indicating which time slots are available. 4 Scheduling Criterion • We can transform this problem to a smaller instance by assigning a job to an unoccupied time slot so that this schedule can be extended to an optimal schedule....
View
Full
Document
This note was uploaded on 09/06/2009 for the course CIS 11274 taught by Professor Howell during the Spring '09 term at Kansas State University.
 Spring '09
 Howell

Click to edit the document details