A Fast and Effective Breakpoints Heuristic Algorithm for the Quadratic Knapsack Problem
Dorit S. Hochbaum, Philipp Baumann, Olivier Goldschmidt, Yiqing Zhang
TL;DR
This work tackles the Quadratic Knapsack Problem (QKP) by introducing QKBP, a Breakpoints Algorithm that leverages the concave envelope of the parametric relaxation to identify optimal breakpoints and then uses a fast greedy refinement for budgets between breakpoints. The method rests on a compact directed formulation λ-QKP2, solvable as a minimum s-t cut in a parametric network, yielding a small number of breakpoints (at most $|V|$) and enabling efficient construction of the concave envelope. Extensive experiments on large-scale benchmarks (up to $n=10{,}000$) show that QKBP is consistently fast and often achieves optimal or near-optimal solutions, outperforming a wide range of leading exact and heuristic approaches across varying instance sizes, densities, and budgets. The approach thus offers a robust, scalable, and publicly available solution framework for large QKP instances with broad practical impact.
Abstract
The Quadratic Knapsack Problem (QKP) involves selecting a subset of elements that maximizes the sum of pairwise and singleton utilities without exceeding a given budget. The pairwise utilities are nonnegative, the singleton utilities may be positive, negative, or zero, and the node costs are nonnegative. We introduce a Breakpoints Algorithm for QKP, named QKBP, which is based on a technique proposed in \cite{Hoc09} for efficiently generating the concave envelope of the solutions to the relaxation of the problem for all values of the budget. Our approach utilizes the fact that breakpoints in the concave envelopes are optimal solutions for their respective budgets. For budgets between breakpoints, a fast greedy heuristic derives high-quality solutions from the optimal solutions of adjacent breakpoints. The QKBP algorithm is a heuristic which is highly scalable due to an efficient parametric cut procedure used to generate the concave envelope. This efficiency is further improved by a newly developed compact problem formulation. Our extensive computational study on both existing and new benchmark instances, with up to 10,000 elements, shows that while some leading algorithms perform well on a few instances, QKBP consistently delivers high-quality solutions regardless of instance size, density, or budget. Moreover, QKBP achieves these results in significantly faster running times than all leading algorithms. The source code of the QKBP algorithm, the benchmark instances, and the detailed results are publicly available on GitHub.
