Capacitated Dynamic Programming: Faster Knapsack and Graph Algorithms
One of the most fundamental problems in Theoretical Computer Science is the Knapsack problem. Given a set of n items with different weights and values, it asks to pick the most valuable subset whose total weight is below a capacity threshold T. Despite its wide applicability in various areas in computer science, operations research, and finance, the best known running time for the problem is O(T n). The main result of our work is an improvement of this algorithm for the special case where the number of distinct weights D is small, running in time O(T D). Previously, better algorithms for knapsack were known only for cases with weights and values bounded by M and V respectively, running in time O(nMV). In comparison, our algorithm implies a bound of O(nM^2) without any dependence on V. Additionally, for the unbounded knapsack problem, we provide an algorithm running in time O(M^2 log T). We also initiate a systematic study of general capacitated dynamic programming, of which knapsack is core problem. This problem asks to compute the maximum weight path of length k in an edge- or node-weighted directed acyclic graph. In a graph with m edges, these problems are solvable by dynamic programming in time O(km), and we explore under which conditions the dependence on k can be eliminated. We identify large classes of graphs where this is possible and apply our results to obtain linear time algorithms for the problem of k-sparse Delta-separated sequences. The main technical innovation behind our results is identifying and exploiting concavity that appears in relaxations and subproblems of the tasks we consider.
READ FULL TEXT