![Page 1: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/1.jpg)
An FPTAS for #Knapsack and Related Counting Problems
Parikshit GopalanAdam KlivansRaghu Meka
Daniel ŠtefankovičSantosh Vempala
Eric Vigoda
![Page 2: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/2.jpg)
An FPTAS for #Knapsack and Related Counting Problems
Parikshit Gopalan, Adam Klivans, Raghu MekaDaniel Štefankovič, Santosh Vempala, Eric Vigoda
![Page 3: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/3.jpg)
What can be counted?
exactly? very little...
(in polynomial-time)
number of spanning trees (using determinant),Kirchoff’1847.
perfect matchings in planar graphs (using Pfaffians), Kasteleyn’1960.
(rest: usually #P-hard)
![Page 4: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/4.jpg)
What can be counted?
approximately? a little more...
(in polynomial-time)
perfect matchings in bipartite graphs (permanent of non-negative matrices), Jerrum, Sinclair, Vigoda’2001.
Ferromagnetic Ising model, Jerrum, Sinclair’1989.
Independent sets (5), Weitz’2004.
k-colorings (k (11/6)), Vigoda’1999.
....
(approximate counting random sampling, Jerrum, Valiant, Vazirani’1986)
![Page 5: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/5.jpg)
Approximate counting(in polynomial-time)
deterministic:
INPUT OUT
OUT Q
randomized:INPUT
OUT
OUT Q
P( )1-
![Page 6: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/6.jpg)
not too many examples: independent sets in degree 5 graphs (Weitz’2004), matchings in bounded degree graphs (Bayati, Gamarnik, Katz, Nair, Tetali’2007),satisfying assignments of DNF formulas with terms ofsize C (Ajtai, Wigderson’1985)
more examples; Monte Carlo, usuallyusing a Markov chain (dependence 1/2)
![Page 7: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/7.jpg)
1) is randomness necessary ?
Is P = BPP ?
Primes P (Agarwal, Kayal, Saxena 2001)
2) dependence on ?
Monte Carlo (1/2)
![Page 8: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/8.jpg)
Knapsack (optimization)INPUT: (w1,v1),...(wn,vn), L
OUTPUT: S [n]
i Smax vi
i S wi L
weights
values
(integers)
![Page 9: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/9.jpg)
Dynamic program #1(L is small)
T[i,M](optimal solution withitems 1,...,i and limit M)
T[i,M] = max {T[i-1,M]
T[i-1,M-wi] + vi
![Page 10: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/10.jpg)
Dynamic program #2(vi’s are small)
T[i,V](smallest weight ofa subset of 1,...,i,with value V)
T[i,V] = min{T[i-1,V]
T[i-1,V-vi] + wi
approximation algorithm
![Page 11: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/11.jpg)
Counting knapsackINPUT: w1,...,wn, L
OUTPUT: S [n]
i S wi L
How many
with
#P-hard
are there?
![Page 12: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/12.jpg)
Counting knapsackDyer, Frieze, Kannan, Kapoor, Perkovic, Vazirani’1993 exp(O*(n1/2)) / 2
randomized approximation algorithm
Morris, Sinclair’1999 O( nc / 2 )
randomized approximation algorithm (MCMC, canonical paths)
Dyer’2003 O(n2.5 + n2/2)
randomized approximation algorithm (dynamic programming)
OURS: O*(n3/)
![Page 13: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/13.jpg)
Dyer’2003:
T[i,M](number of solutions with items 1,...,i and limit M)
T[i,M] = T[i-1,M] + T[i-1,M-wi]
+ rejection sampling approximate counter
![Page 14: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/14.jpg)
+ rejection sampling
approximate counter
wi’ =n2 wi
L
wi’’ = wi’ rounding:
L’ = n2
1) get more solutions, ’’ ’2) not too many more, |’’| (n+1)|’|
S’’ ’’ - ’, X heaviest in S’’, then S’’ - {X}’ Proof:
![Page 15: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/15.jpg)
Our dynamic program
(i,A) = smallest M such that knapsackwith w1,...,wi,M has A solutions
(i,A) = min max[0,1]
{(i-1, A)
(i-1,(1- A)+wi
deterministic approximation algorithm
![Page 16: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/16.jpg)
Q = 1+ /(n+1)s = n logQ 2
T(i,j)=min max[0,1]
{T(i-1,j+lnQ )
T(i-1,j+lnQ(1-)+wi
T[0..n,0..s]
Lemma 1: (i,Qj-i) T[i,j] (i,Qj)
![Page 17: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/17.jpg)
T(i,j)=min max[0,1]
{T(i-1,j+lnQ )
T(i-1,j+lnQ(1-)+wi
Lemma 2: can compute recursion efficiently
Q-j,....,Q0, 1-Q0, .... , 1-Qj
only few values of matter
can use binary search
TOTAL RUN TIME = O( log(n/))n3
![Page 18: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/18.jpg)
How to deal with more constraints ?
S [n]
i S wj,i Lj
How many with
are there?
j{1,...,k}
O( (n/)O(k2) log W) algorithm
(e.g., contingency tables,multi-dimensional knapsack, ...)
multi-dimensional knapsack:
![Page 19: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/19.jpg)
Read once branching programs
n layers
• Layered directed graph
• vertices per layer• Edges between
consecutive layers• Edges labeled • Input: • Output: Label of
final vertex reached
Counting the number of accepting paths ? dynamic programming, time = O(nS)
![Page 20: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/20.jpg)
n layers
ROBP for knapsack
Problem: width too large
Solution: reduce width by approximating
![Page 21: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/21.jpg)
Monotone ROBPs
• ordering: given u,v, is u v ?
• midpoint: given u,v, get w s.t. |{x;uxw}| = |{x;wxv}| 1
• transitions: given u, get the outneighbors of u
u v A(u) A(v)monotone:
given implicitly
accepting paths from u
u
v
![Page 22: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/22.jpg)
group the vertices in the layers according to the rough number of accepting paths processing right-left
already “shrunk”
![Page 23: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/23.jpg)
can be generalized to distributions given by small space sources.
n layers
p1
1-p1
small space sources = ROBP + probability distributions on outgoing edges
More constraints?
![Page 24: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/24.jpg)
More constraints?
n layers
n layers
can be combined to get (S2,n)-ROBP forintersection
additive approximation preserved
![Page 25: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/25.jpg)
1) uniform distribution given by ’’ can be given by small space source
2) additive approximation multiplicative approximation
![Page 26: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/26.jpg)
![Page 27: An FPTAS for #Knapsack and Related Counting Problems](https://reader035.vdocuments.net/reader035/viewer/2022081513/56812cd3550346895d918f7b/html5/thumbnails/27.jpg)
Other problems:
contingency tableswith constant number of rows
What other problems are solvable using the technique?
Thanks!