Abstract: Knapsack problems (KPs) are common in industry, but solving KPs is known to be NP-hard and has been tractable only at a relatively small scale. This paper examines KPs in a slightly generalized form and shows that they can be solved nearly optimally at scale via distributed algorithms. The proposed approach can be implemented fairly easily with off-the-shelf distributed computing frameworks (e.g. MPI, Hadoop, Spark). As an example, our implementation leads to one of the most efficient KP solvers known to date – capable to solve KPs at an unprecedented scale (e.g., KPs with 1 billion decision variables and 1 billion constraints can be solved within 1 hour). The system has been deployed to production and called on a daily basis, yielding significant business impacts at Ant Financial.
Introduction
The Knapsack Problem is a cornerstone of combinatorial optimization. In its simplest form, it asks how to select items with specific values and weights to maximize total value without exceeding a weight limit. In modern industrial contexts, such as marketing budget allocation or insurance pricing, these problems grow to a massive scale, involving billions of users and constraints. Traditional solvers like CPLEX or Gurobi are often unable to handle more than a few million variables, creating a critical gap between theoretical complexity and practical industrial needs.
Methodology
The proposed framework leverages Dual Decomposition (DD) to transform a massive global optimization problem into millions of independent, local subproblems. This decomposition allows for massive parallelism across distributed clusters.
Synchronous Coordinate Descent (SCD)
A major challenge in standard Dual Descent is the sensitivity to the "learning rate" hyperparameter, which often leads to unstable convergence and significant constraint violations. To address this, the researchers developed Synchronous Coordinate Descent (SCD). Unlike gradient-based methods, SCD updates Lagrangian multipliers (the "shadow prices" of resources) more robustly, ensuring smoother convergence and minimizing violations during the optimization process.
Hierarchical Constraints and Distributed Execution
Many real-world problems feature nested local constraints (e.g., a per-user budget limit combined with category-specific limits). The authors prove that if these constraints are hierarchical, subproblems can be solved optimally in polynomial time using a greedy Directed Acyclic Graph (DAG) approach. The entire system is built for the MapReduce paradigm, enabling deployment on standard Spark or Hadoop clusters.
Performance and Scalability
The system was evaluated using both synthetic datasets (up to 400 million users) and real-world production data from Ant Financial.
Key Results
- Unprecedented Scale: The solver successfully processed a KP with 1 billion variables and 1 billion constraints in approximately one hour using 200 Spark executors.
- High Optimality: Synthetic tests demonstrated an optimality ratio exceeding 99.8% compared to the theoretical upper bound.
- Efficiency Heuristics: The team introduced a "pre-solving" technique using data sampling to find an initial set of multipliers. This heuristic significantly reduced the total iterations required for convergence.
Conclusion
By combining dual decomposition with a novel coordinate descent algorithm and hierarchical greedy solvers, this research demonstrates that billion-scale knapsack problems are not only solvable but can be handled with high optimality and stability. The system is currently deployed at Ant Financial, powering decision-making for over 10 core products and serving over 1 billion active users daily.
Summary updated