want to maxmize weight by scheduling
Greedy no longer works
Dynamic Programming
define the subproblem == Rx
R == nubmer of request , x == f(i) finishing time , Rf(i) ~= request later than f(i)
Rx = {j ∈ R|s(j) ≥ x} given particular x i can always shrink nubmer of request that i have based on {s(j} >=x} (rule)
Dp guessing
Try each request i as a possible First Solution //
n subproblems * subproblem takes max O(n) == O(n^2)
Make it better~ where is the inefficency?
1. repeating solving subproblems , we need to memoize subproblem's result so we can reuse.
2. we shouldn't try every request some request is more suitable to be first
opt(1,2,3...n) == max(opt(2,...n) , w1 + opt(R1))
opt(2..n) == not choosing first request to be my first solution
w1 + opt(R1) == choosing first as my first solution + solving subproblem that satsify s(i) >f(1)
Time == sorting (nlong) + recusrsion (n) == nlogn
why above(first) algorthim's recursion O(n^2) not O(n)
Non-identical machines (NP-complete)
machines τ = {T1, . . . , Tm}.
this particular interval can only work on some subset of machine
Can k ≤ n requests be scheduled? (decision problem) k == specific number
Reference ==
'Algorithm > Design and Analysis of Algorithms' 카테고리의 다른 글
Dijkstra , bellman-ford ,Bi-directional Djikstra (0) | 2021.01.05 |
---|---|
Tree and B-Trees (0) | 2020.12.30 |
Divide & Conquer: FFT (0) | 2020.12.27 |
Convex Hull , Median Find (0) | 2020.12.13 |
Interval Scheduling (0) | 2020.12.12 |