15
Lecture 38 CSE 331 Dec 3, 2010

Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Lecture 38

CSE 331Dec 3, 2010

Page 2: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

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

Individual choice for

every student

Page 3: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Homework stuff

http://xkcd.com/336/

HW 10 posted

Graded HW 9 pickups: my office hours today

Jeff/Alex next week

Page 4: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Weighted Interval Scheduling

Input: n jobs (si,ti,vi)

Output: A schedule S s.t. no two jobs in S have a conflict

Goal: max Σj in S vj

Assume: jobs are sorted by their finish time

Page 5: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Property of OPT

OPT(j) = max { vj + OPT( p(j) ), OPT(j-1) }

Page 6: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

A recursive algorithm

M-Compute-Opt(j)

If j = 0 then return 0

M[j] = max { vj + M-Compute-Opt( p(j) ), M-Compute-Opt( j-1 ) }

If M[j] is not null then return M[j]

return M[j]

M-Compute-Opt(j) = OPT(j)

M-Compute-Opt(j) = OPT(j)

Run time = O(# recursive calls)Run time = O(# recursive calls)

Page 7: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Bounding # recursionsM-Compute-Opt(j)

If j = 0 then return 0

M[j] = max { vj + M-Compute-Opt( p(j) ), M-Compute-Opt( j-1 ) }

If M[j] is not null then return M[j]

return M[j]

Whenever a recursive call is made an M value of assigned

Whenever a recursive call is made an M value of assigned

At most n values of M can be assignedAt most n values of M can be assigned

O(n) overallO(n) overall

Page 8: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email
Page 9: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Property of OPT

OPT(j) = max { vj + OPT( p(j) ), OPT(j-1) }

Given OPT(1), …, OPT(j-1), one can compute OPT(j)

Given OPT(1), …, OPT(j-1), one can compute OPT(j)

Page 10: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Recursion+ memory = IterationIteratively compute the OPT(j) valuesIteratively compute the OPT(j) values

M[0] = 0

M[j] = max { vj + M[p(j)], M[j-1] }

For j=1,…,n

Iterative-Compute-Opt

M[j] = OPT(j)M[j] = OPT(j) O(n) run timeO(n) run time

Page 11: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Reading AssignmentSec 6.1, 6.2 of [KT]

Page 12: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

When to use Dynamic Programming

There are polynomially many sub-problems

Optimal solution can be computed from solutions to sub-problems

There is an ordering among sub-problem that allows for iterative solution

Richard Bellman

Page 13: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Shortest Path Problem

Input: (Directed) Graph G=(V,E) and for every edge e has a cost ce (can be <0)

t in V

Output: Shortest path from every s to t

1 1

100

-1000

899

s t

Shortest path has cost negative

infinity

Shortest path has cost negative

infinity

Assume that G has no negative

cycle

Assume that G has no negative

cycle

Page 14: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

Today’s agenda

Dynamic Program for shortest path

Page 15: Lecture 38 CSE 331 Dec 3, 2010. A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) Email

May the Bellman force be with you