Introduction
The 0-1 Knapsack Problem (KP) is a fundamental challenge in combinatorial optimization. Given a set of items, each with a specific value and weight, the goal is to select a subset that maximizes total value without exceeding a predefined weight capacity. While the fractional version of this problem is trivial, the 0-1 version—where items must be taken in their entirety or not at all—is NP-hard. This paper, presented at ACML 2020, introduces a novel Deep Reinforcement Learning (DRL) framework that leverages state aggregation to solve the 0-1 KP more efficiently and accurately than traditional heuristics or standard DRL methods.
The Challenges of DRL in Combinatorial Optimization
Traditional "handcrafted" heuristics, such as the greedy approach (selecting items based on the highest value-to-weight ratio), are computationally fast but often yield sub-optimal results. Recent attempts to apply DRL, such as Pointer Networks, have aimed to "learn" better heuristics. However, these models frequently encounter two major hurdles:
- Scalability: As the number of items increases, the state space expands exponentially, making it difficult for neural networks to converge.
- Generality: Many existing models are "brittle," meaning a network trained on a problem of size $N$ cannot easily generalize to solve a problem of size $M$.
Proposed Methodology: State Aggregation and A2C
The authors address these challenges by introducing a two-stage solver that incorporates a unique preprocessing step called state aggregation. This step essentially compresses the problem's complexity before it is processed by the main neural network.
1. State Aggregation (Algorithm 2)
Before training the primary DRL agent, the framework uses a tabular Q-learning algorithm to identify "split points" for item features, such as normalized values and weights. This process discretizes the continuous feature space into a small set of integers. By aggregating the state space in this manner, the subsequent learning task becomes significantly less noisy and more manageable for the deep learning model.
2. DRL Solver (Algorithm 1)
The knapsack problem is modeled as a sequential decision process. An Advantage Actor Critic (A2C) agent observes the current aggregated state of the knapsack and the remaining items, then selects one item to add at each step. This constructive approach treats the problem as a subset selection task rather than a sequence-to-sequence task, which the authors argue is more natural for KP.
3. Feature Normalization
To ensure the model generalizes across different problem scales, the authors utilize ratios—specifically $v_i / (w_i \times W)$ and $w_i / W$—rather than raw values. This allows a model trained on one set of items to understand the relative worth of items in entirely different instances.
Experimental Evaluation
The researchers evaluated their method on three distinct datasets, each containing 1,000 instances with 50, 300, and 500 items:
- Random Instances (RI): Values and weights are randomly generated integers.
- Fixed Capacity Instances (FI): Standard benchmarks where the knapsack capacity remains constant.
- Hard Instances (HI): Designed specifically to challenge solvers, these instances feature a strong correlation between value and weight, making greedy heuristics highly misleading.
Key Results and Insights
The inclusion of state aggregation proved to be a powerful regularizer, helping the agent focus on the underlying logic of the problem rather than high-precision float noise. Key findings include:
- Near-Optimality: The DRL agent with state aggregation achieved over 99.9% optimality across nearly all tested instances.
- Superiority over Vanilla DRL: In 500-item Random Instances, the proposed method solved 786 instances optimally, compared to 701 for DRL without aggregation and only 345 for the greedy algorithm.
- Efficiency Gains: Models utilizing state aggregation reached high-quality solutions approximately 10,000 timesteps faster than those without it.
- Robustness: On "Hard Instances," the method maintained a 99.95% optimality ratio, whereas the greedy approach's performance dropped significantly to 96.2% on smaller sets.
Conclusion
By combining tabular Q-learning for state discretization with an A2C agent for item selection, the authors have developed a robust and scalable solver for the 0-1 Knapsack Problem. While the method requires a two-stage training process, the gains in solution quality and training speed are substantial. Future work may involve automating the derivation of states and rewards to apply this aggregation framework to other complex combinatorial problems.
Summary updated