Abstract
Constraint Programming (CP) relies heavily on efficient filtering algorithms to prune search spaces. For the knapsack constraint, traditional filtering methods operate in linear time $O(n)$. This paper presents a novel incremental algorithm that achieves expected sublinear time complexity by exploiting a mathematical dominance property and utilizing binary finger-tree data structures. Experimental results demonstrate speedups of up to two orders of magnitude on large-scale instances.
Introduction
In CP, the knapsack constraint—maximizing profit within a weight capacity—is a fundamental building block. Filtering this constraint involves identifying and removing values from variable domains that cannot participate in any feasible solution. Because filtering occurs repeatedly during search, even linear-time algorithms ($O(n)$) can become significant bottlenecks as problem sizes grow. This research introduces an incremental approach designed to perform only the necessary updates, aiming for sublinear average-case performance.
Methodology
The proposed algorithm is built on two core innovations:
1. The Dominance Property
The authors prove a key dominance relationship: if an item $x_i$ is not mandatory for a solution, then any other item $x_j$ with both lower efficiency (profit/weight ratio) and lower weight is also not mandatory. This property allows the algorithm to prune entire groups of items from consideration without explicit checks.
2. Binary Finger-Trees
To operationalize the dominance property, the algorithm employs two specialized tree structures:
- Item-Finding Search Tree ($T_f$): Items are sorted by efficiency. Nodes store the maximum weight of their subtrees, enabling the algorithm to "jump" over non-mandatory items.
- Computation Tree ($T_c$): This tree stores prefix sums of weights and profits, allowing the "critical item" (where the knapsack capacity is reached) to be located in $O(\log n)$ time.
Experimental Evaluation
The algorithm was tested against Pisinger’s standard knapsack benchmarks, covering various distributions: Uncorrelated, Weakly Correlated, Strongly Correlated, Almost Strongly Correlated, and Subset Sum.
Performance and Speedups
The primary metric for success was the reduction in total execution time compared to the standard linear-time filtering algorithm (Lin).
As shown in the results, the "strong skipping" variant (SL-SS) provides the most significant gains. For instances with 100,000 items, SL-SS is often over 100 times faster than the linear baseline.
Workload Reduction
The sublinear performance is a direct result of the algorithm visiting far fewer items than the linear scan.
In many cases, particularly in strongly correlated instances, the algorithm processes less than 1% of the total items. Theoretical analysis confirms this behavior, with expected complexities of $O(n^{2/3} \log n)$ for uncorrelated data and $O(\sqrt{n} \log n)$ for weakly correlated data.
Conclusion
By moving beyond linear-time scans, this work sets a new standard for knapsack constraint propagation. While the implementation of finger-trees adds complexity, the dramatic performance improvements—especially on large-scale datasets—justify the overhead. Future work may explore tighter theoretical bounds for the "strong skipping" heuristic, which currently outperforms its own theoretical predictions.
Summary updated