Simple python script that simulates the packaging of rectangular boxes of any size.
- General info
- Technologies
- Setup
- Purpose
- Examples of use
- PC Demonstration
- SmartPhone Demonstration
- Sources
This simple and intuitive script allows you to use the 3D bin-packing simulation in an easier way.
By writing the right keyword you can launch a certain action (like create bin, add item, pack items,..).
You can find the algorithm and objects (Bin, Item, Item_List) in _3dbp.py,
run text_based_script.py for a simple terminal UI and
check examples directory if you want to see some examples about how can you use the code in your projects.
The algorithm doesn't offer the optimal solution sometimes but the average wasted space is below 5% which is pretty good (given that it's a NP hard problem).
- Python 3.8.3
- Modules:
- copy
- math
- vpython
Bin and Items dimensions need to be positive integers.
python text_based_script.py - to run the terminal UI
This open source project is meant to provide an approximately optimal solution for the 3D bin packing problem.
It can be used for various things:
- deposit space management
- cargo vehicle space management (for now, there is no weight constraint)
You can see some example code in example scripts from examples directory.
But if you don't want to install the packages or to use the executable, you can represent the output data by yourself:
- Use pen and paper (kind of weird and not environmentally friendly:), we don't recommend)
- Use a 3D modeling web application (Example: SketchUp)
- Use some unusual ways (lego pieces, cubic shapes)
The strategy is based on Erick Dube and Leon Reeves Kanavathy research Optimizing Three-Dimensional Bin Packing Through Simulation