TL;DR
This paper introduces the first deterministic fully polynomial-time approximation schemes (FPTAS) for counting the number of solutions to classic #P-hard problems, including the Knapsack problem. By cleverly sparsifying read-once branching programs (ROBPs), the authors replace previous randomized approaches with fast, guaranteed deterministic algorithms, while also unlocking new techniques for PAC-learning functions of halfspaces.
What Problem Does This Paper Address?
Finding the optimal solution to the Knapsack problem is famously NP-hard, but counting the total number of valid solutions (e.g., how many different subsets of items fit into the knapsack without exceeding the weight limit) is even harder—it belongs to a class of problems called #P-hard.
Because exact counting is computationally intractable, researchers look for algorithms that can quickly provide a highly accurate estimate. While randomized approximation algorithms (FPRAS) have been known for years (using techniques like Markov Chain Monte Carlo or randomized dynamic programming), finding a deterministic algorithm that runs in polynomial time (an FPTAS) remained an open challenge. The authors tackle this exact gap for the 0-1 Knapsack problem, as well as related problems like Multidimensional Knapsack, Integer Knapsack, and counting Contingency Tables.
Methods
The core engine of the authors' approach is the Read-Once Branching Program (ROBP). You can think of an ROBP for the Knapsack problem as a layered, directed graph where each layer represents an item, and each node represents a possible partial sum of weights. An exact ROBP keeps track of all possible partial sums, making it exponentially wide and too slow to compute.
To fix this, the authors introduce a novel sparsification (or rounding) technique:
- Backward Construction: Instead of building the graph from the first item to the last, they build it backward.
- State Merging: At each layer, they group nodes (partial sums) into intervals. If two partial sums result in roughly the same number of valid future combinations (within a $1+\epsilon$ factor), they are merged into a single representative state.
- Small-Space Sources: To handle multiple constraints (Multidimensional Knapsack), the authors generalize their algorithm to count solutions under "small-space sources"—distributions that can themselves be generated by small-width branching programs. They then use an existing mathematical rounding trick to turn additive approximations into multiplicative ones.
Datasets
Not discussed in the paper. (This is a theoretical computer science paper focused on algorithm design and complexity bounds, so it does not rely on empirical datasets).
Key Insights and Ideas
- Monotonicity is a Superpower: The exact branching program for Knapsack has a natural total ordering: a larger partial sum strictly means fewer valid items can be added later. This monotonicity allows the algorithm to use binary search when grouping states, drastically reducing the time complexity from linear to logarithmic with respect to the knapsack's weight.
- Backward is Better: By building the approximate branching program from the last layer to the first, the algorithm always knows the exact number of accepting suffixes for the already-rounded layers. This prevents approximation errors from compounding uncontrollably.
- Bridging Counting and Learning: The authors realized that if a mathematical function can be approximated by a small-width ROBP, it can also be learned efficiently. They introduce the concept of "Almost ROBPs" to translate their counting techniques into computational learning theory, yielding new ways to learn intersections of halfspaces.
Key Results
- 0-1 Knapsack: The authors provide a deterministic algorithm that computes a $(1+\epsilon)$-relative error approximation in $O(n^3 \log(W) \log(n/\epsilon)/\epsilon)$ time (where $n$ is the number of items and $W$ is the total weight).
- Multidimensional Knapsack: They achieved a deterministic polynomial-time approximation for knapsacks with multiple constraints, provided the number of constraints ($k$) is a constant.
- Integer Knapsack & Contingency Tables: The techniques successfully extend to FPTASs for general integer knapsacks and for counting integer-valued contingency tables (grids of numbers with specific row and column sums) with a constant number of rows.
- Machine Learning: They provide a new algorithm for PAC-learning arbitrary Boolean functions of $k$ halfspaces under the uniform distribution. It achieves accuracy $\epsilon$ in $(n/\epsilon)^{O(k)}$ time. Previously, algorithms for this had an exponential dependence on $\epsilon$ or the weights of the halfspaces.
Limitations and Future Work
While the algorithms are fully polynomial for a single knapsack constraint, the runtime for the Multidimensional Knapsack and Contingency Table algorithms scales exponentially with the number of constraints ($k$) or rows ($m$). Therefore, these algorithms are only practically efficient (polynomial time) when $k$ and $m$ are small constants ($O(1)$).
Additionally, the new machine learning algorithm for halfspaces requires active membership queries (the ability to ask an oracle for the label of any specific data point), which is a stronger requirement than passively learning from a pre-existing dataset. Future work could explore removing the need for membership queries or improving the algorithmic dependence on the number of constraints.
Summary updated