Beyond Worst-Case Subset Sum: An Adaptive, Structure-Aware Solver with Sub-$2^{n/2}$ Enumeration
Jesus Salas
TL;DR
This work reframes Subset Sum through the lens of the effective search space U, the number of distinct subset sums, and develops a deterministic, structure-aware solver that enumerates unique sums via a novel enumerator. It combines a double meet-in-the-middle strategy with Controlled Aliasing to guarantee sub-^{n/2} worst-case bounds, while maintaining anytime/online capabilities and strong practical performance on structured inputs. The approach is validated by theoretical claims (runtime bounds parameterized by U) and extensive empirical results showing dramatic speedups when additive structure (low doubling, high additive energy, duplicates, progressions) constrains U. The framework offers a unified, adaptable blueprint for solving NP-hard problems by targeting problem structure and enabling incremental, resilience-enabled computation, with potential extensions to Knapsack and related domains.
Abstract
The Subset Sum problem, which asks whether a set of $n$ integers has a subset summing to a target $t$, is a fundamental NP-complete problem in cryptography and combinatorial optimization. The classical meet-in-the-middle (MIM) algorithm of Horowitz--Sahni runs in $\mathcal{O}^*(2^{n/2})$, which remains the best-known deterministic bound. Yet in practice, many instances exhibit abundant collisions in partial sums, so the true difficulty is often governed by $U = |Σ(S)|$, the number of unique subset sums. We present a structure-aware, adaptive solver that enumerates only the distinct subset sums, pruning duplicates on the fly and achieving deterministic runtime $\mathcal{O}(U \cdot n^2)$ and expected randomized runtime $\mathcal{O}(U \cdot n)$. Its core is a canonical unique-subset-sums enumerator combined with a double meet-in-the-middle strategy, supporting anytime and online modes. To ensure worst-case gains even on unstructured inputs, we introduce a Controlled Aliasing technique that provably reduces the enumeration space by a fixed constant factor. This yields a guaranteed global runtime of $\mathcal{O}^*(2^{n/2 - \varepsilon})$ for some $\varepsilon > 0$, strictly improving upon classical bounds. Empirical results show that the solver adapts efficiently to structured inputs with low entropy (e.g., instances with small doubling constants, duplicates, or additive progressions) often approaching near-dynamic programming performance. We conclude by outlining how this adaptive framework can be extended to other NP-complete problems.
