Download presentation
Presentation is loading. Please wait.
Published byOswald Haynes Modified over 6 years ago
1
An FPTAS for Counting Integer Knapsack Solutions Made Easy
Nir Halman Hebrew University of Jerusalem
2
The Integer Knapsack Problem
Input: n items. Item i has: weight wi , value vi and limit ui on #copies (U=max ui). Knapsack capacity C. Output: Max ๐โค๐ ๐ฃ ๐ ๐ฅ ๐ s.t. ๐โค๐ ๐ค ๐ ๐ฅ ๐ โค๐ถ; 0โค ๐ฅ ๐ โค ๐ข ๐ Admits an FPTAS [IK75,HS76] If all ui=1, called 0/1 knapsack Counting problem: How many feasible solutions exist? (v is obsolete) Theorem. An O( ๐ 3 log 3 ๐log๐ถ ๐ log ๐log ๐ ๐ ) time FPTAS Improves over Gopalan et al. [FOCS11] by ๐ ( ๐ 2 ๐ ) Other well-know counting problems: counting satisfying assignments of distinctive normal form (DNF) formulas (1st FPRAS by [KL85]), counting independent sets in graphs of max. degree ๏โค5 (1st FPTAS by [We06]).
3
A naรฏve DP formulation Let ๐ ๐ (๐)=max. #copies of item i (โคui) using โค j space, ๐ ๐ ๐ =#feasible sols. using โค j space & items 1,โฆ,i Recurrence: ๐ 1 ๐ = ๐ 1 ๐ +1 ๐=1,โฆ,๐ถ ๐ ๐ ๐ = ๐=0 ๐ ๐ ๐ ๐ ๐โ1 ๐โ๐ ๐ค ๐ 2โค๐โค๐, ๐=1,โฆ,๐ถ Solution = ๐ ๐ ๐ถ Running time: i โค n items, space j โค C and summation of size โค U ๏จ O(nUC) time, i.e., pseudopolynomial in both U and C
4
A second DP formulation
Idea: ๏ข item i break integer decision i into โค log ui binary sub-decisions. If all ui were powers of 2 minus one, then easy: ๏ขi Break item i into m bundles of weights ๐ค ๐ ,2 ๐ค ๐ ,โฆ,((ui +1)/2-1) ๐ค ๐ and solve the corresponding 0/1 knapsack counting problem E.g., if ui=7 (=111 in binary encoding) and ๐ค ๐ =1:
5
A second DP formulation
Idea: ๏ข item i break integer decision i into โค log ui binary sub-decisions. But when ui is not a power of 2 minus one, then the bundles are not necessarily โindependentโ: E.g., if ui=5 (=101 in binary encoding) and ๐ค ๐ =1: + - bit # from left Corresponding bundle 1 2 3 constraint non-binding constraint binding - + - + - + - + - 5 4 3 2 1
6
A second DP formulation
Idea: break integer decision i into at most ui binary sub-decisions, ๏ข item i Let: msb(x,i)=place (from the right) of most significant โ1โ bit of the ith least significant bits of x, if exists or -โ e.g., msb(5,2)=1 (5 in binary encoding is 101); msb(4,1)=-โ (4 in binary encoding is 100).
7
A second DP formulation โ contโ
๐ง ๐,๐,0 ๐ = ๐ง ๐,๐โ1,0 ๐ + ๐ง ๐,๐โ1,0 ๐โ 2 ๐โ1 ๐ค ๐ l=2,โฆ (a) ๐ง ๐,๐,1 ๐ = ๐ง ๐,๐โ1,0 ๐ + ๐ง ๐,msb( ๐ข ๐ ,๐โ1),1 ๐โ 2 ๐โ1 ๐ค ๐ l=2,โฆ (b) ๐ง ๐,1,๐ ๐ = ๐ง ๐โ1,โlog+ ๐ ๐ ๐ โ+1,1 ๐ + ๐ง ๐โ1,โlog+ ๐ ๐โ1 ๐ โ๐ค ๐ โ+1,1 ๐โ ๐ค ๐ (c) E.g., ui=5 (101 in binary encoding) and wi=1. ๐ง ๐,3,0 ๐ considers placing a bundle of 4 and then recursively checks a bundle of 2 by using ๐ง ๐,2,0 โ ๐ง ๐,3,1 ๐ considers placing a bundle of 4 and then recursively checks a bundle of 1 (because msb(5,2)=1) by using ๐ง ๐,1,0 โ The last index of z is an indicator for the constraint xi โคui being potentially binding ๐ง ๐,โโ,1 ๐ = ๐ง ๐โ1,โlog+ ๐ ๐โ1 ๐ โ+1,1 ๐ (d) ๐ง 1,๐,๐ ๐ = ๐ 1 ๐ l=1,โฆ (e) ๐ง ๐,๐,๐ ๐ = j<0 (f) where r=0,1, i=2,...,n and j=0,...,C Solution = ๐ง ๐,โlog+ ๐ข ๐ โ+1,1 ๐ถ Running time: i โค n items, l โค log U sub-decisions, r=0,1 space j โค C, and summation of size โค 2๏จ O(nClogU) time, i.e., pseudopolynomial in C only
8
An FPTAS Note: All functions ๐ง ๐,๐,๐ โ are univariate and monotone non-decreasing in their variable This is called a monotone dynamic program Thm[HKLOS14]: A monotone DP with depth T, |action space| โคA, |state space|โคS and bound M on max. value, admits an O( ๐ 2 ๐ ๐ด log๐ log๐ log ๐log๐ ๐ ) FPTAS ๏จ Here T=nlogU, A=2, S=C, and M=Un ๏จ O( ๐ 3 ๐ log3๐ log๐ถ log ๐log๐ ๐ ) time
9
K-approximation functions
Assume function ฯ is defined over integer domains and is non-negative, i.e., ฯ:[0, U] ๏ R+ We say that ฯ* is a K-approximation of ฯ if ฯ(x) โค ฯ*(x) โค Kฯ(x), ๏ขx โ [0, U] We denote this by ฯ* โ
K ฯ
10
1. Calculus of K-apx. Functions
Let ฮฑ,ฮฒ โฅ 0, ฯi* โ
Ki ฯi , K1 โฅ K2, and i =1,2 Operation name Operation and apx. ratio summation ฮฑ+ฮฒฯ1*+ฯ2* โ
K1 ฮฑ+ฮฒฯ1+ฯ2 minimization min{ฯ1*, ฯ2*} โ
K1 min{ฯ1, ฯ2} composition ฯ1*(ฯ) โ
K1 ฯ1(ฯ) approximation ฯ2* โ
K1 K2 ฯ1 when ฯ2= ฯ1* ๐ง ๐,๐,0 ๐ = ๐ง ๐,๐โ1,0 ๐ + ๐ง ๐,๐โ1,0 ๐โ 2 ๐โ1 ๐ค ๐ (๐) ๐งโฒ ๐,๐,0 ๐ = ๐งโ ๐,๐โ1,0 ๐ + ๐งโ ๐,๐โ1,0 ๐โ 2 ๐โ1 ๐ค ๐ (๐โฒ) Corollary: (summation of composition) Let z* in (aโ) be K1 -apx. functions of the original functions. Then ๐งโฒ ๐,๐,0 ๐ โ
K1 ๐ง ๐,๐,0 ๐
11
2. K-approximation Sets Definition: Let ฯ:[0,...,S]โ R+ be monotone. A K-apx. set of ฯ is W๏ [0,...,S] with 0,S๏W and ratio ๏ฃ K between each two consecutive points in W Construction: ฯ* is the apx. of ฯ induced by W: ฯ โฅK ๏ฃ K W ฯ* Question: How small a K-apx. set of ฯ can be, and how fast can it be constructed?
12
Approximating a Monotone Function: The Compress Operator
Answer: A monotone ฯ admits a K-apx. function with |breakpoints| poly. of input size (= log S + log M) via binary search over both domain and range. We explicitly construct it via the compress procedure: g := Compress(ฯ , K=1+๏ฅ ). g is a piecewise step function g โ
K ฯ #pieces is O(logK M) = O( log M ฮต ) (using K<2๏ฎlogKโฅฮต) Running time is O( log M log S ฮต ), query time is O(log log M ฮต ), assuming pieces are stored as a list (x, ฯ(x)) sorted by x
13
FPTAS formulation begin 1. K:= 1+๐ 1 2๐ .
2. Define ๐งโ 1,๐,๐ โ := ๐ง 1,๐,๐ โ 3. for t=2 to depth T do 4. implement ๐งโฒ ๐,๐,๐ โ oracle using DP and ๐งโ ๐ โฒ , ๐ โฒ ,๐ โ where either iโ<i or lโ<l 5. ๐งโ ๐,๐,๐ โ :=compress( ๐งโฒ ๐,๐,๐ โ ,K) 6. endfor end Corollary: (summation of composition) Let z* in (aโ) be K1 -apx. functions of the original functions. Then ๐งโฒ ๐,๐,0 ๐ โ
K1 ๐ง ๐,๐,0 ๐
14
Running Time and Error Analysis
begin 1. K:= 1+๐ 1 2๐ . 2. Define ๐งโ 1,๐,๐ โ := ๐ง 1,๐,๐ โ 3. for t=2 to depth T do 4. implement ๐งโฒ ๐,๐,๐ โ oracle using DP and ๐งโ ๐ โฒ , ๐ โฒ ,๐ โ where either iโ<i or lโ<l 5. ๐งโ ๐,๐,๐ โ :=compress( ๐งโฒ ๐,๐,๐ โ ,K) 6. endfor end each query = O(log logK M) O(logS logK M) queries to ๐งโฒ ๐,๐,๐ โ Running time: O(TlogS logKM log logK M)=O( ๐ 2 ๐ log๐ log๐ log ๐ log๐ ๐ ) Apx. Ratio: By line 1 K2T=1+๏ฅ
15
Summary / Our Approach โข Functional point of view
โข Approximating functions via apx. sets โข Propagation of errors via Calculus of approximation โข Modular framework for deriving FPTASs โข The notion of binding constraints is of independent interest
16
Bibliography: โฆ [G+11] P. Gopalan, A. Klivans, R. Meka, D
Bibliography: โฆ [G+11] P. Gopalan, A. Klivans, R. Meka, D. Stefankoviหc, S. Vempala, E. Vigoda, FPTAS for #Knapsack and Related Counting Problems, FOCS 2011 โฆ[HKLOS14] N. Halman, D. Klabjan, C.L. Li, J. Orlin, D. Simchi-Levi, FPTASs for stochastic DPs, SIAM. Discrete Math โฆ [HS76] E. Horowitz & S. Sahni, Exact and appoximate algs. for scheduling nonidentical processors, J. ACM, โฆ [IK75] H. Ibarra & C. Kim, Fast approximation algor the knapsack and sum of subset problems, J. ACM, โฆ [KL85] R. Karp & M. Luby, Monte Carlo algs. for the planar multiterminal network reliability problem, J. Complexity, 1985 โฆ [We06] D. Weitz, Counting independent sets up to the tree threshold, STOC 2006
17
Thank you!
18
Relative Approximation
OPT โ a minimization problem OPT(x) โ value of problem on instance x A K-apx. alg. A(x) (K>1) returns A(x) โค K OPT(x) A PTAS (Polynomial Time Approximation Scheme) is a (1+ ฮต)-apx. that runs in poly(|x|) time, e.g., O(|x|3/ฮต ) An FPTAS (Fully Poly. Time Approximation Scheme) is a PTAS that runs in poly(|x|,1/ฮต) time, e.g., O((|x|/ฮต)2) FPTASs are considered as the โHolly Grailโ among apx. algs. because one can get as close to opt(x) as one wants in poly. time
19
A Question Does a value oracle for a monotone function ฯ:[0,...,S]โR+ admits an efficient succinct K-approximation? ( Let M = ฯmax . Input size = log S + log M) Def: a K-approximation ฯ* is: succinct if stored in logarithmic space, e.g., O(log S log M) efficient if built in logarithmic time (# of oracle queries)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.