Download presentation
Presentation is loading. Please wait.
1
Lecture 35 CSE 331 Nov 27, 2017
2
Quiz 2 next Monday
3
Final exam post
4
Official Feedback forms
5
CS Ed week (Dec 5) We need volunteers! We need demos!
6
When to use Dynamic Programming
There are polynomially many sub-problems OPT(1), …, OPT(n) Richard Bellman Optimal solution can be computed from solutions to sub-problems OPT(j) = max { vj + OPT( p(j) ), OPT(j-1) } There is an ordering among sub-problem that allows for iterative solution OPT (j) only depends on OPT(j-1), …, OPT(1)
7
Scheduling to min idle cycles
n jobs, ith job takes wi cycles You have W cycles on the cloud What is the maximum number of jobs you can schedule?
8
Subset sum problem n integers w1, w2, …, wn bound W
Input: bound W Output: subset S of [n] such that sum of wi for all i in S is at most W w(S) is maximized
9
Recursive formula OPT(j, B) = max value out of w1,..,wj with bound B
If wj > W’ OPT(j, B) = OPT(j-1, B) else OPT(j, B) = max { OPT(j-1, B), wj + OPT(j-1,B-wj) }
10
Today’s agenda Dynamic Program for Subset Sum problem
11
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 Assume that G has no negative cycle 1 100 -1000 899 s t Shortest path has cost negative infinity
12
May the Bellman force be with you
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.