We are committed to continuously promoting the development of 3D packing technology.
The following are functions we developed:
- Online packing solver [1, 2, 3].
- Online packing with lookahead [1].
- Packing stability solution [2].
- Packing in continuous domain [2].
- Custom-constrained packing [2].
- Online packing with buffer [3].
- Irregular shape packing [3].
- Packing with physical constraints [3].
- Basic tools for rendering, packing shape processing, and simulation scenarios [4].
If you are interested in 3D packing, I strongly recommend you take a look. All kinds of questions and potential collaboration are welcome!
We propose to enhance the practical applicability of online 3D bin packing problem (BPP) via learning on a hierarchical packing configuration tree which makes the deep reinforcement learning (DRL) model easy to deal with practical constraints and well-performing even with continuous solution space. Compared to our previous work, the advantages of this repo are:
- Container (bin) size and item sizes can be set arbitrarily.
- Continuous online 3D-BPP is allowed and a continuous environment is provided.
- Algorithms to approximate stability are provided (see our other work).
- Better performance and the ability to account for more complex constraints.
- More adequate heuristic baselines for domain development.
- More stable training.
See these links for video demonstration: YouTube, bilibili
If you are interested, please star this repo!
For more details, please see our paper Learning Efficient Online 3D Bin Packing on Packing Configuration Trees which has been accepted at ICLR 2022. If this code is useful for your work, please cite our paper:
@inproceedings{
zhao2022learning,
title={Learning Efficient Online 3D Bin Packing on Packing Configuration Trees},
author={Hang Zhao and Yang Yu and Kai Xu},
booktitle={International Conference on Learning Representations},
year={2022},
url={https://openreview.net/forum?id=bfuGjlCwAq}
}
- NumPy
- gym
- Python>=3.7
- PyTorch >=1.7
- My suggestion: Python == 3.7, gym==0.13.0, torch == 1.10, OS: Ubuntu 16.04
For training online 3D-BPP on setting 2 (mentioned in our paper) with our PCT method and the default arguments:
python main.py
The training data is generated on the fly. The training logs (tensorboard) are saved in './logs/runs'. Related file backups are saved in './logs/experiment'.
Describe your 3D container size and 3D item size in 'givenData.py'
container_size: A vector of length 3 describing the size of the container in the x, y, z dimensions.
item_size_set: A list records the size of each item. The size of each item is also described by a vector of length 3.
You can download the prepared dataset from here. The dataset consists of 3000 randomly generated trajectories, each with 150 items. The item is a vector of length 3 or 4, the first three numbers of the item represent the size of the item, the fourth number (if any) represents the density of the item.
We provide pretrained models trained using the EMS scheme in a discrete environment, where the bin size is (10,10,10) and the item size range from 1 to 5.
For training online 3D BPP instances on setting 1 (80 internal nodes and 50 leaf nodes) nodes:
python main.py --setting 1 --internal-node-holder 80 --leaf-node-holder 50
If you want to train a model that works on the continuous domain, add '--continuous', and don't forget to change your problem in 'givenData.py':
python main.py --continuous --sample-from-distribution --setting 1 --internal-node-holder 80 --leaf-node-holder 50
You can initialize a run using a pre-trained model:
python main.py --load-model --model-path path/to/your/model
To evaluate a model, you can add the --evaluate
flag to evaluation.py
:
python evaluation.py --evaluate --load-model --model-path path/to/your/model --load-dataset --dataset-path path/to/your/dataset
Running heuristic.py for test heuristic baselines, the source of the heuristic algorithm has been marked in the code:
Running heuristic on setting 1 (discrete) with the LASH method:
python heuristic.py --setting 1 --heuristic LSAH --load-dataset --dataset-path setting123_discrete.pt
Running heuristic on setting 2 (continuous) with OnlineBPH method:
python heuristic.py --continuous --setting 2 --heuristic OnlineBPH --load-dataset --dataset-path setting2_continuous.pt
python main.py -h
python evaluation.py -h
python heuristic.py -h
This source code is released only for academic use. Please do not use it for commercial purposes without authorization of the author.