Code Monkey home page Code Monkey logo

crack521 / online-3d-bpp-pct Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexfrom0815/online-3d-bpp-pct

0.0 1.0 0.0 381 KB

Code implementation of "Learning Efficient Online 3D Bin Packing on Packing Configuration Trees". We propose to enhance the practical applicability of online 3D-BPP (Bin Packing Problem) via learning on a hierarchical packing configuration tree which makes the DRL model easy to deal with practical constraints and well-performing even with continuous solution space.

Python 100.00%

online-3d-bpp-pct's Introduction

Learning Efficient Online 3D Bin Packing on Packing Configuration Trees

This repository is fully published now, all kinds of feedback and any contribution is welcome!

We propose to enhance the practical applicability of online 3D-BPP via learning on a hierarchical packing configuration tree which makes the 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 the 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.

If you are interested, please star this repo!

PCT

Paper

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}
}

Dependencies

  • NumPy
  • gym
  • Python>=3.7
  • PyTorch >=1.7
  • My suggestion: Python == 3.7, torch == 1.10, OS: Ubuntu 16.04

Quick start

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'.

Usage

Data description

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 dimension.
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.

Dataset

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.

Model

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.

Training

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', don't forget to change your problem in 'givenData.py':

python main.py --continuous --setting 1 --internal-node-holder 80 --leaf-node-holder 50

Warm start

You can initialize a run using a pretrained model:

python main.py --load-model --model-path path/to/your/model

Evaluation

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

Heuristic

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 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

Help

python main.py -h
python evaluation.py -h
python heuristic.py -h

License

This source code is released only for academic use. Please do not use it for commercial purpose without authorization of the author.

online-3d-bpp-pct's People

Contributors

alexfrom0815 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.