2D irregular packing is a classic combinatorial optimization problem with various applications, such as material utilization and texture atlas generation. Due to its NP-hard nature, conventional numerical approaches typically encounter slow convergence and high computational costs. Previous research (GFPack) introduced a generative method for gradient-based packing, providing early evidence of its feasibility but faced limitations such as insufficient rotation support, poor boundary adaptability, and high overlap ratios. In this paper, we propose GFPack++, a deeply investigated framework that adopts attention-based geometry and relation encoding, enabling more comprehensive modeling of complex packing relationships. We further design a constrained gradient and a weighting function to enhance both the feasibility of the produced solutions and the learning effectiveness. Experimental results on multiple datasets demonstrate that GFPack++ achieves higher space utilization, supports continuous rotation, generalizes well to arbitrary boundaries, and infers orders of magnitude faster than previous approaches. Codes for this paper are at https://github.com/TimHsue/GFPack-pp.
Figures & tables
Figure 1 : The proposed attention-driven diffusion model for 2D irregular packing, GFPack++, supports continuous rotation and accommodating arbitrary boundaries.
Figure 2 : (a) Our approach is a diffusion-based generation method. (b) We use a sequence-to-sequence model to encode and decode the state and velocities at each time step and generate the next state accordingly. Our model consists of two components: an attention-based relationship encoder (c) and an attention-based geometry encoder (d). The former encodes the geometric feature, spatial, and boundary relationships among the input variables using the attention mechanism. The latter computes the geometric features εg using a multi-level GCN feature aggregation network and Attention Pooling.
Figure 3 : Local Feature Representation. Our method leverages the information aggregation capability of GCNs combined with the multi-scale abilities of residual connections. It aggregates the geometric features of each point and its neighboring area with Eq. 1 .
Figure 4 : Attention pooling for local features. For the local features of each point, we aggregate them into the shape features of the polygon using an attention mechanism.
Dataset
XAtlas
NFP
SVGnest
GFPack++ ( b=128 )
GFPack++ ( b=512 )
Garment
62.26 | 69.53 | 74.70 | 1.01 s
61.49 | 65.49 | 67.94 | 6.13 s
69.38 | 72.75 | 75.13 | 80.21 s
69.37 | 74.22 | 77.83 | 3.25 s
74.15 | 77.04 | 80.62 | 10.5 s
Dental
63.18 | 70.86 | 73.59 | 1.25 s
60.42 | 66.30 | 68.13 | 8.22 s
67.22 | 73.64 | 76.49 | 96.73 s
70.57 | 75.21 | 78.67 | 4.28 s
74.06 | 77.53 | 79.79 | 14.5 s
Puzzle (square)
56.16 | 66.48 | 76.15 | 1.21 s
56.90 | 62.53 | 68.13 | 4.52 s
61.00 | 67.22 | 73.21 | 42.55 s
82.22 | 93.99 | 98.64 | 6.23 s
84.80 | 95.12 | 98.74 | 32.1 s
Atlas (building)
50.56 | 71.21 | 87.62 | 0.96 s
41.97 | 67.32 | 83.31 | 2.76 s
44.97 | 74.51 | 90.54 | 52.43 s
58.96 | 78.78 | 98.47 | 8.12 s
66.03 | 80.16 | 98.88 | 25.3 s
Atlas (object)
38.58 | 60.98 | 76.09 | 1.43 s
32.18 | 57.75 | 83.12 | 45.3 s
41.53 | 63.87 | 83.12 | 402.2 s
31.76 | 65.11 | 86.08 | 15.5 s
41.95 | 67.47 | 86.81 | 65.4 s
Table 1 : Statistics of packing ratios (Min|Avg|Max) and time consumption for the average packing results. All of these results were optimized with enhancement algorithm.
Figure 5 : Samples from the teacher datasets.
Figure 6 : Utilization distribution shift for the dental data. The figure plots the histogram of utilization ratios of 1000 random data.
Figure 7 : Visualization of the attention intensity of the 7th-layer decoder at t=0.2 using data from the Puzzle (arbitrary) dataset. Attention intensity of each polygon is normalized by amax−aminai−amin .
Dataset
Algo.
Util.(%)
Over.(%)
Time(s)
Garment
GFPack
69.82
0.85
81.2
GFPack (E)
72.17
0.23
124.0
GFPack++
74.25
0.08
7.9
GFPack++ (E)
77.04
0.00
10.5
Dental
GFPack
66.59
1.43
80.4
GFPack++
69.31
0.06
8.0
Table 2 : Comparison of GFPack and GFPack++ on Garment and Dental. ’E’ indicates enhancement of model outputs, ’R’ denotes training with arbitrary rotations. ’Util.’ refers to the average spatial utilization, ’Over.’ is the average overlap of generated outcomes as a percentage of total polygon area, and ’Time’ represents the average generation time.
Geometric Enc.
Relation Enc.
Over.
Util.
GFPack
GFPack
13.2%
-
GFPack++
GFPack
8.38%
-
GFPack
GFPack++
1.89%
72.84%
GFPack++ (AvgPool)
GFPack++
0.85%
73.11%
GFPack++
GFPack++
0.08%
74.25%
Table 3 : Performance comparison of GFPack++ and GFPack using different geometric encoders (first column) and relational encoders (second column) on the dental dataset. The results do not include enhancement.
Figure 8 : Polygon number scalability of GFPack++ (16 to 128).
Batch Size
Valid Solutions
Time
GFPack++ ( b=128 )
38.53%
4.21 s
GFPack++ ( b=512 )
67.54%
7.95 s
Table 4 : Generalization test on Dental (alphabet).
Batch Size
IoU (Min ∣ Avg ∣ Max)
Time
GFPack++ ( b=128 )
80.39 % ∣ 93.75 % ∣ 96.80 %
3.27 s
GFPack++ ( b=512 )
82.43 % ∣ 94.91 % ∣ 98.86 %
4.23 s
Table 5 : Generalization test on Puzzle (arbitrary).
Algo.
Building
Object
[ 40 ]
68.3 ∣ 82.7 ∣ 98.0
37.7 ∣ 68.7 ∣ 86.2
GFPack++
66.0 ∣ 80.2 ∣ 98.9
42.0 ∣ 67.5 ∣ 86.8
GFPack++*
61.5 ∣ 78.4 ∣ 97.4
36.2 ∣ 66.2 ∣ 83.9
Table 6 : Comparison of packing ratios (Min—Avg—Max) between GFPack++ and [ 40 ] . GFPack++* means our method trained on the general dataset.
Figure S1 : The statistics of polygon vertex counts. The horizontal axis represents the number of vertices in a polygon, while the vertical axis indicates the frequency of these vertex counts. Due to the wide distribution of vertex counts in the Atlas dataset, we have divided it into two parts: the main distribution and the outliers.
Dataset
Min
Avg
Max
Std
Garment
5
81.57
284
76.83
Dental
17
34.47
123
14.50
Puzzle
4
8.25
29
2.86
Atlas (building)
4
6.52
70
3.87
Atlas (object)
4
67.41
1120
102.38
Table S2 : Polygon vertex counts.
Dataset
Polygon Count
Garment
313
Dental
440
Atlas (building)
3262
Atlas (object)
6764
Table S3 : Polygon counts in each dataset.
Dataset
GFPack++
XAtlas
SVGnest
Bef.
Aft.
Bef.
Aft.
Bef.
Aft.
Garment
74.25%
77.04%
68.90%
69.53%
70.98%
72.75%
Dental
75.11%
77.53%
69.88%
70.86%
72.55%
73.64%
Table S4 : Average improvements achieved through enhancement.
Figure S2 : Some results from GFPack++ across different datasets. Note that the utilization enhancement only applies to regular boundaries, so small overlaps may be observed in the puzzle (arbitrary) results.
Figure S3 : Comparative results from GFPack++, SVGnest, and XAtlas applied to Garment, Dental, Puzzle, and Atlas datasets. In the lower left corner of the Garment dataset, a shared similar local layout pattern between GFPack++ and SVGnest can be observed. For the Puzzle dataset, GFPack++ outperforms the others, nearly achieving a global optimum due to its continuous rotation solving.
Figure S4 : Comparative results from GFPack++, [ 40 ] , SVGnest, and XAtlas applied to Atlas datasets.
The two-dimensional irregular knapsack problem in a fixed circular container is an important combinatorial optimization problem for maximizing material utilization in manufacturing. Conventional geometric packing solvers can produce tightly packed layouts, yet they often partition the residual space into isolated small pockets that cannot fit valuable unplaced polygons. To overcome this late-stage packing bottleneck, we propose a failure-aware large neighborhood search framework named GeoNest, driven by a graph policy trained via reinforcement learning. Specifically, we first construct neighborhoods by pairing failed target polygons with residual pockets. We then use explanatory poses to identify the placed polygons that block candidate insertions. These diagnosed blocking relations define bounded, fixed-item repair subproblems for the underlying geometric solver. Finally, the graph policy selects the most promising subproblem for execution. For evaluation, we introduce CircleNest-Bench, a benchmark comprising 2,391 load-controlled instances from four contour sources, including a held-out industrial CAD source. Experimental results demonstrate that, under the same total time budget, GeoNest improves mean utilization over a state-of-the-art standalone packing solver by about 0.9% on average across the three main test sets and by about 0.6% on the held-out industrial set.
Zhongman Du, Huiming Zhang, Linlin Yang +2
Beihang University, Beijing, China · Communication University of China, Beijing, China · Hangzhou Innovation Institute of Beihang University, Hangzhou, China
Most existing approaches either fix the container in advance or optimize only a single container dimension through an outer search loop, leaving the remaining dimensions as a manual tuning problem. We present a differentiable packing framework that jointly optimizes all 6N object pose parameters and all three container side lengths inside a single gradient-based loop. The formulation combines six physics-inspired, differentiable loss terms computed directly on triangle meshes through axis-aligned bounding-box proxies. An adaptive squeezing mechanism periodically tightens the container whenever the overlap loss falls below a pair-count-scaled threshold, producing a large initial drop in container volume, followed by small refinements. All pairwise computations are written in tensor-broadcasting form, giving a 3.4 to 54 times speedup over a reference loop-based implementation. The pipeline is implemented in Python and PyTorch, with no physics engine, FFT library, or convex decomposition. On multiple object categories, the method produces containers that are 11 to 32 percent smaller than time-matched DBLF and simulated-annealing baselines at N =100, while running in under 4 minutes per instance on a single consumer GPU.
Traditional heuristic solvers for the 2D irregular nesting problem share a fundamental limitation: they are blind to polygon geometry, relying on guided brute-force to navigate the continuous placement space with minimal geometrical guidance. In this paper, we argue that Reinforcement Learning is uniquely positioned to overcome this bottleneck. By pairing an optimization policy with a geometry-aware neural encoder, an agent can automatically discover rich geometric priors directly from data, utilizing these learned intuitions to strategically guide exploration. To realize this, we introduce the Polygons Transformer (PoT), a novel architecture that encodes 2D continuous vector geometries while allowing cross-polygons attention. We couple this novel architecture with a Combinatorial Optimization Reinforcement Learning (CORL) training framework to find optimal solutions. To support this paradigm, we release an open-source training dataset derived from complex geographic contours alongside a dedicated evaluation benchmark. Our empirical validation demonstrates that our trained agent achieves area utilization performance highly competitive with Sparrow, the state-of-the-art heuristic solver, proving that reinforcement learning can successfully discover and exploit geometric awareness for precise spatial tasks.