an improved fptas for 0 1 knapsack
play

An Improved FPTAS for 0-1 Knapsack Ce Jin Tsinghua University 0-1 - PowerPoint PPT Presentation

An Improved FPTAS for 0-1 Knapsack Ce Jin Tsinghua University 0-1 Knapsack Problem Given: Knapsack capacity > 0 items Each item has weight 0 < and profit > 0 Find a subset of items


  1. An Improved FPTAS for 0-1 Knapsack Ce Jin Tsinghua University

  2. 0-1 Knapsack Problem Given: Knapsack capacity 𝑋 > 0 π‘œ items Each item 𝑗 has weight 0 < π‘₯ 𝑗 ≀ 𝑋 and profit π‘ž 𝑗 > 0 Find a subset of items 𝐽 βŠ† π‘œ such that: β€’ π‘₯ 𝐽 ≔ Οƒ π‘—βˆˆπ½ π‘₯ 𝑗 ≀ 𝑋 β€’ π‘ž 𝐽 ≔ Οƒ π‘—βˆˆπ½ π‘ž 𝑗 is maximized

  3. 0-1 Knapsack Problem Given: Knapsack capacity 𝑋 > 0 π‘œ items Each item 𝑗 has weight 0 < π‘₯ 𝑗 ≀ 𝑋 and profit π‘ž 𝑗 > 0 Find a subset of items 𝐽 βŠ† π‘œ such that: β€’ π‘₯ 𝐽 ≔ Οƒ π‘—βˆˆπ½ π‘₯ 𝑗 ≀ 𝑋 β€’ π‘ž 𝐽 ≔ Οƒ π‘—βˆˆπ½ π‘ž 𝑗 is maximized A well-known NP-hard problem

  4. FPTAS for 0-1 Knapsack OPT = optimal total profit π‘ž(𝐽) For 𝜁 > 0 , find a subset 𝐽 βŠ† π‘œ such that: β€’ π‘₯ 𝐽 ≀ 𝑋 OPT β€’ π‘ž 𝐽 β‰₯ 1+𝜁 1 Solvable in poly π‘œ, 𝜁 time

  5. Prior Work FPTAS for 0-1 Knapsack: β€’ ΰ·¨ 𝑃(π‘œ 3 /𝜁) (textbook algorithm) β€’ ΰ·¨ 𝑃(π‘œ + 𝜁 βˆ’4 ) [Ibarra and Kim, 1975] β€’ ΰ·¨ 𝑃(π‘œ + 𝜁 βˆ’3 ) [Kellerer and Pferschy, 2004] β€’ ΰ·¨ 𝑃(π‘œ + 𝜁 βˆ’2.5 ) [Rhee, 2015] β€’ ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ“ ) [Chan, 2018]

  6. Prior Work FPTAS for 0-1 Knapsack: β€’ ΰ·¨ 𝑃(π‘œ 3 /𝜁) (textbook algorithm) β€’ ΰ·¨ 𝑃(π‘œ + 𝜁 βˆ’4 ) [Ibarra and Kim, 1975] β€’ ΰ·¨ 𝑃(π‘œ + 𝜁 βˆ’3 ) [Kellerer and Pferschy, 2004] β€’ ΰ·¨ 𝑃(π‘œ + 𝜁 βˆ’2.5 ) [Rhee, 2015] β€’ ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ“ ) [Chan, 2018] β€’ ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ‘πŸ” ) (this work) Conditional Lower Bound: π‘œ + 𝜁 βˆ’1 2βˆ’πœ€ No 𝑃 time algorithm, unless 𝐧𝐣𝐨, + convolution has truly subquadratic algo [Cygan, Mucha, W Δ™ grzycki, and W Ε‚ odarczyk, 2017]

  7. A Special Case FPTAS for Subset Sum ( π‘ž 𝑗 = π‘₯ 𝑗 ): β€’ ΰ·¨ 𝑃 min 𝒐 + 𝜻 βˆ’πŸ‘ , π‘œπœ βˆ’1 [Kellerer, Mansini, Pferschy, and Speranza, 2003]

  8. A Special Case FPTAS for Subset Sum ( π‘ž 𝑗 = π‘₯ 𝑗 ): β€’ ΰ·¨ 𝑃 min 𝒐 + 𝜻 βˆ’πŸ‘ , π‘œπœ βˆ’1 [Kellerer, Mansini, Pferschy, and Speranza, 2003] Our 0-1 Knapsack algorithm utilizes this result

  9. β€’ Our ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ‘πŸ” ) algorithm builds on Chan’s ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ“ ) algorithm β€’ Two new ideas 1. Extending Chan’s number-theoretic technique from two levels to multiple levels.

  10. β€’ Our ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ‘πŸ” ) algorithm builds on Chan’s ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ“ ) algorithm β€’ Two new ideas 1. Extending Chan’s number-theoretic technique from two levels to multiple levels. 2. A greedy argument β‡’ less computation spent on cheap items (small unit profit π‘ž 𝑗 /π‘₯ 𝑗 )

  11. β€’ Our ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ‘πŸ” ) algorithm builds on Chan’s ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ“ ) algorithm β€’ Two new ideas 1. Extending Chan’s number-theoretic technique from two levels to multiple levels. 2. A greedy argument β‡’ less computation spent on cheap items (small unit profit π‘ž 𝑗 /π‘₯ 𝑗 ) This talk

  12. β€’ Our ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ‘πŸ” ) algorithm builds on Chan’s ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ“ ) algorithm β€’ Two new ideas 1. Extending Chan’s number-theoretic technique from two levels to multiple levels. 2. A greedy argument β‡’ less computation spent on cheap items (small unit profit π‘ž 𝑗 /π‘₯ 𝑗 ) Preliminaries (based on [Chan, 2018]) This talk Using Chan’s Lemmas as blackboxes ΰ·© 𝑷(𝒐 + 𝜻 βˆ’πŸ‘.πŸ’πŸ’πŸ’ ) algo

  13. Preliminaries β€’ Assume π‘œ ≀ poly 𝜁 βˆ’1 . 𝜁 β€’ Too cheap items (π‘ž 𝑗 < π‘œ max π‘ž π‘˜ ) are π‘˜ discarded at the beginning (loss ≀ 𝜁 β‹… OPT ) max π‘ž π‘˜ min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1 So π‘œ items, capacity = 𝑋 weight 0 < π‘₯ 𝑗 ≀ 𝑋 and profit π‘ž 𝑗 > 0

  14. Preliminaries β€’β€œProfit function” (defined over real 𝑦 β‰₯ 0 ) 𝑔 𝐽 𝑦 = max π‘ž 𝐾 : 𝐾 βŠ† 𝐽, π‘₯ 𝐾 ≀ 𝑦 π‘œ ≀ poly 𝜁 βˆ’1 items profit max π‘ž π‘˜ /min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1 weight 0 < π‘₯ 𝑗 ≀ 𝑋

  15. Preliminaries β€’β€œProfit function” (defined over real 𝑦 β‰₯ 0 ) 𝑔 𝐽 𝑦 = max π‘ž 𝐾 : 𝐾 βŠ† 𝐽, π‘₯ 𝐾 ≀ 𝑦 β€’ Task: compute a 1 + 𝜁 -approximation of profit function 𝑔 𝐽 , ΰ·© 𝐽 𝑦 ≀ 1 + 𝜁 ΰ·© 𝑔 𝐽 𝑦 ≀ 𝑔 𝑔 𝐽 𝑦 , βˆ€π‘¦ β‰₯ 0 π‘œ ≀ poly 𝜁 βˆ’1 items profit max π‘ž π‘˜ /min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1 weight 0 < π‘₯ 𝑗 ≀ 𝑋

  16. Preliminaries β€’β€œProfit function” (defined over real 𝑦 β‰₯ 0 ) 𝑔 𝐽 𝑦 = max π‘ž 𝐾 : 𝐾 βŠ† 𝐽, π‘₯ 𝐾 ≀ 𝑦 β€’ Task: compute a 1 + 𝜁 -approximation of profit function 𝑔 𝐽 , ΰ·© 𝐽 𝑦 ≀ 1 + 𝜁 ΰ·© 𝑔 𝐽 𝑦 ≀ 𝑔 𝑔 𝐽 𝑦 , βˆ€π‘¦ β‰₯ 0 β€’ For disjoint sets 𝐽, 𝐾 of items, 𝑔 𝐽βˆͺ𝐾 𝑦 = 𝑔 𝐽 βŠ• 𝑔 𝑦 ≔ max 0≀𝑧≀𝑦 𝑔 𝐽 𝑧 + 𝑔 𝐾 𝑦 βˆ’ 𝑧 𝐾 π‘œ ≀ poly 𝜁 βˆ’1 items profit max π‘ž π‘˜ /min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1 weight 0 < π‘₯ 𝑗 ≀ 𝑋

  17. Preliminaries β€’β€œProfit function” (defined over real 𝑦 β‰₯ 0 ) 𝑔 𝐽 𝑦 = max π‘ž 𝐾 : 𝐾 βŠ† 𝐽, π‘₯ 𝐾 ≀ 𝑦 β€’ Task: compute a 1 + 𝜁 -approximation of profit function 𝑔 𝐽 , ΰ·© 𝐽 𝑦 ≀ 1 + 𝜁 ΰ·© 𝑔 𝐽 𝑦 ≀ 𝑔 𝑔 𝐽 𝑦 , βˆ€π‘¦ β‰₯ 0 β€’ For disjoint sets 𝐽, 𝐾 of items, 𝑔 𝐽βˆͺ𝐾 𝑦 = 𝑔 𝐽 βŠ• 𝑔 𝑦 ≔ max 0≀𝑧≀𝑦 𝑔 𝐽 𝑧 + 𝑔 𝐾 𝑦 βˆ’ 𝑧 𝐾 β€’ ΰ·© 𝐽 βŠ• ΰ·© 𝑔 𝑔 𝐾 is a 1 + 𝜁 -approximation of 𝑔 𝐽βˆͺ𝐾 π‘œ ≀ poly 𝜁 βˆ’1 items profit max π‘ž π‘˜ /min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1 weight 0 < π‘₯ 𝑗 ≀ 𝑋

  18. Preliminaries β€’ A nondecreasing step function 𝑔 has a (1 + 𝜁) -approx. with only ΰ·¨ 𝑃 1/𝜁 steps (by rounding down to powers of (1 + 𝜁) ) π‘œ ≀ poly 𝜁 βˆ’1 items profit max π‘ž π‘˜ /min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1

  19. Preliminaries β€’ A nondecreasing step function 𝑔 has a (1 + 𝜁) -approx. with only ΰ·¨ 𝑃 1/𝜁 steps (by rounding down to powers of (1 + 𝜁) ) β€’β€œ Merging Lemma ”: Computing (a 1 + 𝜁 - 𝑛 takes ΰ·¨ 𝑃 𝑛/𝜁 2 approx. of) 𝑔 1 βŠ• β‹― βŠ• 𝑔 time. ( log 𝑛 depth binary tree. 𝜁 β€² ≔ 𝜁/ log 𝑛 ) 𝑔 βŠ• 𝑕 ≔ max 0≀𝑧≀𝑦 𝑔 𝑧 + 𝑕 𝑦 βˆ’ 𝑧

  20. Preliminaries β€’ Divide items into 𝑃 log 1/𝜁 groups (group 𝑙 : π‘ž 𝑗 ∈ [2 𝑙 , 2 𝑙+1 ] ) π‘œ ≀ poly 𝜁 βˆ’1 items profit max π‘ž π‘˜ /min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1 weight 0 < π‘₯ 𝑗 ≀ 𝑋 𝑃 𝑛/𝜁 2 time. 𝑛 : ΰ·¨ Merging 𝑔 1 βŠ• β‹― βŠ• 𝑔

  21. Preliminaries β€’ Divide items into 𝑃 log 1/𝜁 groups (group 𝑙 : π‘ž 𝑗 ∈ [2 𝑙 , 2 𝑙+1 ] ) β€’ Compute all 𝑔 𝑙 and merge them in ΰ·¨ 𝑃(1/𝜁 2 ) time π‘œ ≀ poly 𝜁 βˆ’1 items profit max π‘ž π‘˜ /min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1 weight 0 < π‘₯ 𝑗 ≀ 𝑋 𝑃 𝑛/𝜁 2 time. 𝑛 : ΰ·¨ Merging 𝑔 1 βŠ• β‹― βŠ• 𝑔

  22. Preliminaries β€’ Divide items into 𝑃 log 1/𝜁 groups (group 𝑙 : π‘ž 𝑗 ∈ [2 𝑙 , 2 𝑙+1 ] ) β€’ Compute all 𝑔 𝑙 and merge them in ΰ·¨ 𝑃(1/𝜁 2 ) time β€’ Now assume π‘ž 𝑗 ∈ [1,2] π‘œ ≀ poly 𝜁 βˆ’1 items profit max π‘ž π‘˜ /min π‘ž π‘˜ ≀ poly 𝜁 βˆ’1 weight 0 < π‘₯ 𝑗 ≀ 𝑋 𝑃 𝑛/𝜁 2 time. 𝑛 : ΰ·¨ Merging 𝑔 1 βŠ• β‹― βŠ• 𝑔

  23. Preliminaries π‘ž 1 π‘ž 2 β€’ Simple greedy (sort by unit profit π‘₯ 1 β‰₯ π‘₯ 2 β‰₯ β‹― ) approximates with additive error 𝑒 ≀ max π‘ž 𝑗 = 𝑃(1) profit π‘ž 𝑗 ∈ 1,2 weight 0 < π‘₯ 𝑗 ≀ 𝑋

  24. Preliminaries π‘ž 1 π‘ž 2 β€’ Simple greedy (sort by unit profit π‘₯ 1 β‰₯ π‘₯ 2 β‰₯ β‹― ) approximates with additive error 𝑒 ≀ max π‘ž 𝑗 = 𝑃(1) β€’ For 𝑔 π‘₯ β‰₯ Ξ©(𝜁 βˆ’1 ) , this is 1 + 𝑃(𝜁) multiplicative approx. profit π‘ž 𝑗 ∈ 1,2 weight 0 < π‘₯ 𝑗 ≀ 𝑋

  25. Preliminaries π‘ž 1 π‘ž 2 β€’ Simple greedy (sort by unit profit π‘₯ 1 β‰₯ π‘₯ 2 β‰₯ β‹― ) approximates with additive error 𝑒 ≀ max π‘ž 𝑗 = 𝑃(1) β€’ For 𝑔 π‘₯ β‰₯ Ξ©(𝜁 βˆ’1 ) , this is 1 + 𝑃(𝜁) multiplicative approx. β€’ Only need to 1 + 𝑃(𝜁) approximate for π‘ͺ = 𝑷 𝜻 βˆ’πŸ ! 𝐧𝐣𝐨 π‘ͺ, π’ˆ 𝑱 profit π‘ž 𝑗 ∈ 1,2 weight 0 < π‘₯ 𝑗 ≀ 𝑋

  26. Preliminaries β€’ Round π‘ž 𝑗 down to 1,1 + 𝜁, 1 + 2𝜁, … , 2 βˆ’ 𝜁 1 + 𝜁 multiplicative error β€’ Only 𝑛 = 𝑃(1/𝜁) different π‘ž 𝑗 ’s ! π‘ž 𝑗 ∈ 1,2

  27. Preliminaries β€’ Round π‘ž 𝑗 down to 1,1 + 𝜁, 1 + 2𝜁, … , 2 βˆ’ 𝜁 1 + 𝜁 multiplicative error β€’ Only 𝑛 = 𝑃(1/𝜁) different π‘ž 𝑗 ’s ! β€’ Collect all items with the same profit 𝒒 . Then 𝑔 π‘ž can be computed by simple greedy (sort π‘₯ 1 ≀ π‘₯ 2 ≀ β‹― ) π‘ž 𝑗 ∈ 1,2

  28. Recap π‘ž 𝑗 ∈ 1,2 Profit functions 𝑔 1 , … , 𝑔 𝑛 obtained by simple greedy (one for every π‘ž 𝑗 ) ( 𝑛 = 𝑃(1/𝜁) ) Task: 1 + 𝑃 𝜁 approximate ( 𝐢 = 𝑃(𝜁 βˆ’1 ) ) min 𝐢, 𝑔 1 βŠ• β‹― βŠ• 𝑔 𝑛 𝑃 𝑛/𝜁 2 time. 𝑛 in ΰ·¨ Lemma: Merging 𝑔 1 βŠ• β‹― βŠ• 𝑔 (Immediately gives ΰ·¨ 𝑃(π‘œ + 𝜁 βˆ’3 ) algo)

Recommend


More recommend