1 / 13

PTAS’s with Scaling

PTAS’s with Scaling. Additional material. PTAS’s with Scaling. Scaling technique was discussed in Shortest Paths lecture Often used for obtaining PTAS’s: Polynomial time approximation schemes What is a PTAS? Example: Knapsack. C-approximation.

adara
Download Presentation

PTAS’s with Scaling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PTAS’s with Scaling Additional material Algorithms and Networks: Shortest paths

  2. PTAS’s with Scaling • Scaling technique was discussed in Shortest Paths lecture • Often used for obtaining PTAS’s: Polynomial time approximation schemes • What is a PTAS? • Example: Knapsack Algorithms and Networks: Shortest paths

  3. C-approximation • Optimization problem: output has a value that we want to maximize or minimize • An algorithm A is an C-approximation algorithm, if for all inputs X, we have that (with OPT the optimal value) • value(A(X)) / OPT <= C (minimization), or • OPT / value(A(X)) <= C (maximization) Algorithms and Networks: Shortest paths

  4. PTAS • A Polynomial Time Approximation Scheme is an algorithm, that gets two inputs: the “usual” input X, and a real value e>0, and • For each fixed e>0, the algorithm • Uses polynomial time • Is an (1+e)-approximation algorithm Algorithms and Networks: Shortest paths

  5. FPTAS • A Fully Polynomial Time Approximation Scheme is an algorithm, that gets two inputs: the “usual” input X, and a real value e>0, and • For each fixed e>0, the algorithm • Is an (1+e)-approximation algorithm • The algorithm uses time that is polynomial in the size of X and 1/e. Algorithms and Networks: Shortest paths

  6. Example: Knapsack • Given: n items each with a positive integer weight w(i) and value v(i) (1 <= i <= n), integer B • Question: select items with total weight at most B such that the total value is as large as possible Algorithms and Networks: Shortest paths

  7. A DP for Knapsack • Let P be the maximum value of all items • We can solve the problem in O(n2P) time with dynamic programming: • Tabulate M(i,Q): minimum total weight of a subset of items 1, …, i with total value Q for Q at most nP • M(0,0) = 0; M(0,Q) = infinity, if Q>0 • M(i+1,Q) = min { M(i,Q), M(i,Q-v(i+1))+w(i+1)} • … Algorithms and Networks: Shortest paths

  8. Scaling for Knapsack • Take input for knapsack • Throw away all items that have weight larger than B (never used) • Let c be some constant • Build new input: do not change weights, but set new values v’(i) = |_ v(i) / c _| (round down) • Solve scaled instance with DP optimally • Output this solution: approximates solution for original instance Algorithms and Networks: Shortest paths

  9. Questions • How do we set c, such that • Approximation ratio good enough • Polynomial time Algorithms and Networks: Shortest paths

  10. Approximation ratio • Consider optimal solution Y for original problem, value OPT • Value in scaled instance: at least OPT/c – n • At most n items, for each v(i)/c - |_ v(i)-c) _| <1 • So, DP finds a solution of value at least OPT/c –n for scaled problem • So, value of approximate solution for original instance is at least c*(OPT/c –n) = OPT - nc Algorithms and Networks: Shortest paths

  11. Setting c • Set c = e P / n • This is a FPTAS • Running time: • Largest value of an item is at most P/c = P / (e P / n) = n/e . • Running time is O(n2 * n/e) = O(n3 /e) • Approximation: … next Algorithms and Networks: Shortest paths

  12. e-approximation • Note that each item is a solution (we removed items with weight more than B). • So OPT >= P. • Algorithm gives solution of value at least OPT –nc = OPT – n(e P / n) = OPT – eP • OPT / OPT – eP <= OPT / OPT – eOPT = 1/1-e <=1+ e Algorithms and Networks: Shortest paths

  13. Comments • Technique works for many problems • .. But not always … Algorithms and Networks: Shortest paths

More Related