nesting-tasks-2d / README.md
clallier's picture
Upload README.md with huggingface_hub
c948530 verified
---
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}
}
```