Giter Club home page Giter Club logo

3d-bin-packing's Introduction

3D Bin Packing Optimization

Repository for the Capstone Project 3D Packing Optimization of the Fourthbrain Machine Learning Engineer program.

This repository contains an environment compatible with OpenAI Gym's API to solve the 3D bin packing problem with reinforcement learning (RL).

Alt text

Problem definition and assumptions:

The environment consists of a list of 3D boxes of varying sizes and a single container of fixed size. The goal is to pack as many boxes as possible in the container minimizing the empty volume. We assume that rotation of the boxes is not possible.

Problem instances:

The function boxes_generator in the file utils.py generates instances of the 3D Bin Packing problem using the algorithm described in Ranked Reward: Enabling Self-Play Reinforcement Learning for Combinatorial Optimization (Algorithm 2, Appendix).

Documentation

The documentation for this project is located in the doc folder, with a complete description of the state and action space as well as the rewards to be used for RL training.

Installation instructions

We recommend that you create a virtual environment with Python 3.8 (for example, using conda environments). In your terminal window, activate your environment and clone the repository:

git clone https://github.com/luisgarciar/3D-bin-packing.git

To run the code, you need to install a few dependencies. Go to the cloned directory and install the required packages:

cd 3D-bin-packing
pip install -r requirements.txt

Packing engine

The module packing_engine (located in src/packing_engine.py) implements the Container and Box objects that are used in the Gym environment. To add custom features (for example, to allow rotations), see the documentation of this module.

Environment

The Gym environment is implemented in the module src/packing_env.py.

Demo notebooks

A demo notebook demo_ffd implementing the heuristic-based method 'First Fit Decreasing' is available in the nb folder.

Unit tests

The folder tests contains unit tests to be run with pytest.

Update: 22/08/2022

The following updates have been made to the repository:

  • Added the packing_env.py file with the Gym environment.
  • Added unit tests for the Gym environment.
  • Updated the documentation with the full description of the state and action space.
  • Updated the demo notebooks.

Update: 13/09/2022

The following updates have been made to the repository:

  • Added functionality for saving rollouts of a policy in a .gif file and
  • Added a demo notebook for the random policy.
  • Updated the requirements.txt file with the required packages.
  • Added a demo script for training agents with Maskable PPO.

Update: 7/1/2023

The following updates have been made to the repository:

  • Updated the demo notebook for training agents with Maskable PPO in Google colab.
  • Fixed issues with the tests.

3d-bin-packing's People

Contributors

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