Unofficial implementation of DeepPack in PyTorch. DeepPack is a deep reinforcement learning based algorithm dealing with 2D online bin packing problem.
Because the dimension of the proposed concatenated state (W×2H) inputted to the model doesn't satisfyied the dimension requirements of the CNN architecture mentioned in the paper, thus, this repository use the modified CNN architecture to train.
⬇️ CNN architecture for 4x4 bin size
⬇️ CNN architecture for 5x5 bin size
Dataset
The all training and testing dataset are generated from generate_train.py with random seed 777 and generate_test.py with random seed 666.
To reduce the size of this repository, we don't upload the training and testing data except for 4x4 bin size with retangular item.
If you want to see the training and testing data, you can run generate_train.py and generate_test.py to generate it.
Task type
Bin size
3x3
4x4
5x5
Items type
Unit square (1x1)
Only square
Rectangular and square
Environments
OS: Window 10
Visual Studio Code
Anaconda3
Python: 3.9.15
PyTorch: 2.X.X+cu118
Installation
If you want to use your own env, then run:
pip install -r install/requirements.txt
If you want to create new env, then run:
conda env create -f install/environment.yml
or run:
.\install\install.bat
Usage example
run.bat
Modify this command call D:\anaconda3\Scripts\activate.bat in run.bat, if your anaconda3 path is not in D drive.
Modify this command call conda activate deeppack in run.bat, if your anaconda3 env name D is not deeppack.
Execute the command in the .bat file, including training and testing parts.
Execute to test the result of the trained doubleDQN model.
Result Folder
The all training and testing result and log will be placed in (items_name)_(bin_w)x(bin_h)_result folder.
To reduce the size of this repository, we don't upload the result folders.
If you want to see the traing log and testing result and dynamic demo gifs, you can run run.bat or other command lines, describes in Usage example section, then you will get the whole information.
We only show the result of 4x4 and 5x5 bin size, just like the original paper. If you want to see the result of 3x3 bin size, you can generate 3x3 training data and then train it with suitable hyper-parameters and CNN settings.
We plot the training curves with moving average (window size 50).
Training result of 4x4 bin size
loss
reward
PE
Training result of 5x5 bin size
loss
reward
PE
Test
In test section, we only show the result of 4x4 and 5x5 bin size, just like the original paper, but we have modified some wrong sequence types of the original paper.
Because the training data which are randomly generated may not contain the specific test sequence types, leading to the model doesn't see that pattern, therefore, the result of the test may not perform as good as the training do.
We guess the the training data in the original paper contain the specific test sequence types, thus, the test result of the the original paper is awesome, not like our experiments.
Dynamic Demo Example
The red dot indicates the placement location of the item.
Unofficial implementation of DeepPack in PyTorch. DeepPack is a deep reinforcement learning based algorithm dealing with 2D online bin packing problem.