File size: 9,576 Bytes
5400759
 
 
b69c6b8
 
5400759
 
 
 
 
 
 
 
983cb36
 
 
 
 
 
 
 
 
 
 
 
 
5400759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97cd772
 
 
 
 
 
 
 
 
 
 
 
c948530
97cd772
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5400759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97cd772
 
 
983cb36
 
5400759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
---
license: cc-by-4.0
task_categories:
- tabular-regression
- graph-ml
tags:
- operations-research
- 2d-nesting
- irregular-strip-packing
- geometry
- graph-neural-networks
- surrogate-modeling
pretty_name: Nesting Tasks Dataset for 2D Nesting Efficiency Estimation
configs:
- config_name: tasks
  data_files:
  - tasks.parquet
- config_name: parts
  data_files:
  - parts.parquet
- config_name: shapes
  data_files:
  - shapes.parquet
- config_name: constraints
  data_files:
  - constraints.parquet
---

# Nesting Tasks Dataset for 2D Nesting Efficiency Estimation

This is the official Hugging Face Hub version of the **2D Nesting Tasks Dataset** originally published on Zenodo ([DOI: 10.5281/zenodo.7030786](https://doi.org/10.5281/zenodo.7030786)), in 2022, during the my PhD research.

## πŸ‘₯ Authors & Affiliations

*   **Corentin Lallier** (University of Bordeaux / @ Lectra) β€” [πŸŽ“ Google Scholar](https://scholar.google.com/citations?user=73Tg-wkAAAAJ) | [πŸ’Ό LinkedIn](https://www.linkedin.com/in/corentin-lallier/) | [πŸ’» GitHub](https://github.com/clallier) | [πŸ†” ORCID](https://orcid.org/0000-0003-0518-8308)
*   **Laurent VΓ©zard** (Data Science Manager @ Lectra) β€” [πŸŽ“ Google Scholar](https://scholar.google.com/citations?hl=fr&user=gQv0TgMAAAAJ) | [πŸ’Ό LinkedIn](https://www.linkedin.com/in/laurent-v%C3%A9zard-36822280/)
*   **Bruno Pinaud** (Associate Professor @ University of Bordeaux / LaBRI) β€” [🏫 LaBRI Page](http://www.labri.fr/~bpinaud/) | [πŸ†” ORCID](https://orcid.org/0000-0003-4814-3273)
*   **Guillaume Blin** (Professor @ University of Bordeaux / LaBRI) β€” [🏫 LaBRI Page](http://www.labri.fr/~gblin/) | [πŸ†” ORCID](https://orcid.org/0000-0002-0708-0838)

---

This dataset is designed for training **machine learning surrogate models** (such as Graph Neural Networks) to estimate 2D irregular nesting efficiency (material utilization) without running computationally expensive operations research packing heuristics.

---

## πŸ“‚ Dataset Summary

2D irregular cutting and packing (nesting) is a critical optimization problem in industries like textiles, apparel, and sheet-metal manufacturing. Traditionally, calculating the layout and material utilization of a set of irregular polygons requires running complex nesting heuristics, which can take seconds to minutes per run.

This dataset provides **100,000 unique nesting tasks** containing high-level task descriptions, irregular polygon shapes, constraints, and target nesting efficiencies. This enables the training of neural networks to predict material utilization instantly, facilitating rapid layout evaluations.

---

## 🧬 Data Schema & Description

The dataset is divided into four modern, secure, and highly optimized **Apache Parquet** files:

### 1. `tasks.parquet` (Nesting high-level descriptors)
Contains global metrics and metadata for each nesting task.

| Column | Type | Description |
| :--- | :--- | :--- |
| `efficiency` | `float` | **The target label to predict.** Given in percentage (`%`). |
| `duration` | `integer` | Nesting algorithm convergence time in seconds (`s`). |
| `sheet_width` | `integer` | Width of the nesting area (unit: $m^{-4}$). |
| `sheet_length`| `integer` | Length of the nesting area (unit: $m^{-4}$). |
| `sheet_type`  | `integer` | Specific nesting classification category. |
| `tasks_index` | `integer` | **Join key** connecting tables across files. |
| `is_train` / `is_val` / `is_test` | `boolean` | Masks indicating standard partitions for training, validation, and testing. |

---

### 2. `parts.parquet` (Description of parts to be nested)
Describes the specific instances of parts allocated to each nesting task.

| Column | Type | Description |
| :--- | :--- | :--- |
| `tasks_index` | `integer` | Reference to `tasks_index` in the `tasks` file. |
| `parts_id` | `integer` | Unique identifier for the part within its specific nesting task. |
| `shape_hash` | `integer` | Hash of the part's shape, serving as the **join key** to the `shapes` file. |

---

### 3. `shapes.parquet` (Coordinate shapes of irregular polygons)
Detailed geometry coordinate boundaries for all irregular parts.

| Column | Type | Description |
| :--- | :--- | :--- |
| `shape_hash` | `integer` | Unique hash identifier of the shape geometry. |
| `raw` | `list of integers` | Alternating sequence of $(x, y)$ coordinates defining the shape outline. |
| `sizes` | `list of integers` | Vertex sizes of any sub-shapes or inner boundaries. |

---

### 4. `constraints.parquet` (Spacing, rotation, and alignment parameters)
Geometric spacing boundaries and physical placement constraints.

| Column | Type | Description |
| :--- | :--- | :--- |
| `type` | `string` | Specific constraint category type identifier. |
| `tasks_index` | `integer` | Reference to the nesting task `tasks_index`. |
| `parts_1`, `parts_2` | `list of integers` | Part IDs involved in the constraint. |
| `p1_x, p1_y / p2_x, p2_y` | `list of floats` | Spacing anchors and offset coordinates on each part. |
| `r1_start, r1_end, r1_flip_x`| `list of floats` | Allowed rotation range and flip settings. |
| `y_min, y_max` | `list of floats` | Allowed positioning range on the $y$-axis. |

---

## πŸš€ How to Load and Explore the Dataset

### πŸ” Exploring Directly on Hugging Face Data Studio / SQL Explorer

You can run SQL queries directly on your browser using DuckDB over the hosted Parquet tables:

* **Query the train dataset split from tasks table**
    ```sql
    SELECT 
        tasks_index,
        duration,
        efficiency,
        sheet_width,
        sheet_length,
        sheet_type
    FROM tasks 
    WHERE is_train = true 
    LIMIT 500;
    ```
    
*   **Query parts and shapes geometry for a specific task:**
    ```sql
    SELECT 
        p.tasks_index,
        p.part_id,
        p.shape_hash,
        s.raw AS shape_vertices,
        s.sizes AS vertex_sizes
    FROM 
        parts p
    JOIN 
        shapes s ON p.shape_hash = s.shape_hash
    WHERE 
        p.tasks_index = 228
    ORDER BY 
        p.part_id ASC;
    ```

*   **Query constraints parameters for a specific task:**
    ```sql
    SELECT 
        tasks_index,
        type AS constraint_type,
        parts_1,
        parts_2,
        y_min,
        y_max,
        r1_start,
        r1_end,
        is_frozen
    FROM 
        constraints
    WHERE 
        tasks_index = 228;
    ```

### πŸš€ Loading via the Hugging Face Datasets Library

You can also download or stream these relational tables directly from the Hugging Face Hub using their specific dataset configuration names:

```python
from datasets import load_dataset

# Load individual tables using configuration subsets
tasks_ds = load_dataset("clallier/nesting-tasks-2d", name="tasks")
parts_ds = load_dataset("clallier/nesting-tasks-2d", name="parts")
shapes_ds = load_dataset("clallier/nesting-tasks-2d", name="shapes")
constraints_ds = load_dataset("clallier/nesting-tasks-2d", name="constraints")

print(tasks_ds)
```

### πŸš€ Loading via Pandas

Since the dataset is stored in standard Apache Parquet format, loading takes a single line of python code:

```python
import pandas as pd

# Load the high-level nesting tasks and labels
tasks_df = pd.read_parquet('tasks.parquet')

# Load corresponding geometric parts
parts_df = pd.read_parquet('parts.parquet')

# Load irregular polygon shape definitions
shapes_df = pd.read_parquet('shapes.parquet')

# Load spacing and alignment constraints
constraints_df = pd.read_parquet('constraints.parquet')

# Filter splits using the pre-defined boolean masks in tasks.parquet
train_df = tasks_df[tasks_df['is_train']]
val_df = tasks_df[tasks_df['is_val']]
test_df = tasks_df[tasks_df['is_test']]

print(f"Loaded {len(tasks_df)} irregular nesting tasks:")
print(f"   Train instances      : {len(train_df)}")
print(f"   Validation instances : {len(val_df)}")
print(f"   Test instances       : {len(test_df)}")
```

---

## πŸ› οΈ Handling Missing Values (Nulls)

In the binary Apache Parquet format, missing optional parameters (such as unassigned `x_offset` or `y_min` values in `constraints.parquet`) are stored natively as **`NULL`** slots using Parquet's definition levels. 

Different programming languages and frameworks load these binary `NULL`s into their own native type-safe representations:

*   **Python (Pandas):** 
    *   Native numerical columns (like `x_offset` of type `float64`) represent missing values as **`NaN`** (float representation).
    *   Object or list columns (like `y_min` of type `object`) represent missing values as **`None`**.
    *   *Tip:* You can check for both formats simultaneously using a single call to `df.isna()` or `df.isnull()`.
*   **Rust (Polars / Arrow):** 
    *   Parsed directly into native, type-safe optional wrappers: **`Option<f64>`** for float parameters and **`Option<Vec<f64>>`** for geometric coordinate lists.
*   **C++ (Arrow):** 
    *   Represented as null slots in the Arrow array validity bitmap (`IsValid(index) == false`).


---

## πŸ“œ Citation & Credits

If you use this dataset in your research or industrial applications, please cite the original Zenodo record:

```bibtex
@dataset{lallier2022nesting,
  author       = {Lallier, Corentin and V{\'e}zard, Laurent and Pinaud, Bruno and Blin, Guillaume},
  title        = {Nesting tasks dataset for 2d-nesting efficiency estimation},
  month        = aug,
  year         = 2022,
  publisher    = {Zenodo},
  version      = {1.1.0},
  doi          = {10.5281/zenodo.7030786},
  url          = {https://doi.org/10.5281/zenodo.7030786}
}
```