Attend2Pack: Bin Packing through Deep Reinforcement Learning with Attention

Jingwei Zhang, Bin Zi, Xiaoyu GearXiv 2021

Abstract

The 3D Bin Packing Problem (BPP) is a critical challenge in logistics, requiring the efficient arrangement of items to maximize space utilization. We present Attend2Pack, a deep reinforcement learning framework that leverages self-attention and action space decomposition to achieve state-of-the-art results. By introducing Prioritized Oversampling (PO), we significantly enhance the efficiency of on-policy learning, outperforming existing heuristics and RL baselines in both offline and online packing scenarios.

Introduction

The 3D Bin Packing Problem (BPP) is a classic NP-hard combinatorial optimization task. In industrial settings like e-commerce fulfillment and container shipping, even marginal improvements in packing density can lead to substantial cost savings and reduced environmental impact. The complexity of BPP arises from its vast action space, where an agent must simultaneously decide the packing sequence, item orientation, and precise spatial coordinates.

Traditional approaches typically rely on hand-crafted heuristics that may not generalize well across diverse item distributions. Recent deep reinforcement learning (DRL) methods have shown promise but often struggle with the high-dimensional state-action space and the intricate spatial dependencies between items.

Methodology

Attend2Pack addresses these challenges through three primary architectural innovations:

1. Action Space Decomposition

Rather than attempting to predict all packing parameters at once, Attend2Pack decomposes the problem into two specialized, cooperative policies:

  • Sequence Policy ($\pi^s$): A Pointer Network that selects the next item to be packed from the available pool.
  • Placement Policy ($\pi^p$): A policy that determines the optimal orientation (from 6 possibilities) and $(x, y, z)$ coordinates for the selected item.

2. Attention-Based Encoding

The model utilizes a Transformer-style self-attention mechanism to generate robust box embeddings. This allows the agent to consider the dimensions of all items in the current set relative to one another, capturing global context.

3. Frontier Embedding

To represent the state of the bin, Attend2Pack uses a Convolutional Neural Network (CNN) to encode a "frontier"—a 2D height map of the current packing surface. This provides the agent with a clear spatial context of available volume.

Prioritized Oversampling (PO)

A significant bottleneck in on-policy DRL for combinatorial problems is the "easy sample" problem, where agents spend excessive training time on trivial configurations. We introduce Prioritized Oversampling (PO) to mitigate this. PO identifies "hard" samples—instances where the agent's performance falls below a threshold—and re-presents them to the agent for additional learning steps using a separate optimizer. This focused training regime accelerates convergence and helps the model navigate the most challenging packing sequences.

Experimental Results

We evaluated Attend2Pack on several benchmarks, including the "Cut" dataset (where a 100% utilization solution is guaranteed) and random item datasets.

Training performance and visual comparison of packing strategies.

As illustrated in the figure above, Attend2Pack demonstrates superior learning efficiency and final utility compared to baselines. On the 3D "Cut" dataset with 50 items, Attend2Pack achieved a 92.6% reward, significantly outperforming the previous state-of-the-art (83.8%). In the "online" setting, where items are revealed one-by-one, the model achieved 67.0% utility, a marked improvement over the 54.7% achieved by prior methods.

Conclusion

Attend2Pack represents a significant step forward in applying DRL to 3D bin packing. By combining attention mechanisms with strategic action decomposition and prioritized training, the model achieves high-density packing across various scenarios. Future research will focus on extending this framework to multi-bin environments and incorporating physical constraints such as load stability and weight distribution.

Summary updated

BibTeX
@misc{zhang2021attend,
  author = {Jingwei Zhang and Bin Zi and Xiaoyu Ge},
  title = {{Attend2Pack: Bin Packing through Deep Reinforcement Learning with Attention}},
  year = {2021},
  eprint = {2107.04333},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.04333},
}
Figure