A steady-state genetic algorithm with multi-ratio seeding and pair exchange for the quadratic knapsack problem
Abstract
The quadratic knapsack problem (QKP) seeks a subset of items of maximum total linear and pairwise profit whose total weight does not exceed a given capacity. Most QKP heuristics rank items by a profit-to-weight ratio. We show on benchmark instances that this ranking can steer the search away from the best known solutions, and that on an almost full knapsack a local optimum can be separated from a better solution by an exchange where every single swap loses profit. We propose SSGA-P, a steady-state genetic algorithm with pair exchange that addresses both effects. Its initial population contains greedy solutions built with a grid of exponents between 0.5 and 3 applied to the item weights, and its pair exchange move combines an improving swap violating the capacity with a second swap or removal that restores feasibility. Incremental contribution vectors keep the method practical up to 10{,}000 items. SSGA-P finds optimal solutions in every run on the 100 classical instances and reaches all best known values in 99.8\% of the runs on the 80 instances with 1000 and 2000 items and in 99.75\% on the 40 instances with 5000 and 6000 items, significantly above the 87.7\% of the iterated hyperplane exploration algorithm, improving one best known value. On the 144 Large-QKP instances of Hochbaum et al. (2025), with the same 120-second limit, it improves 20 best known values and matches the other 124. An ablation study shows that the multi-ratio seeding and the pair exchange account for most of this performance.