3D Bin Packing
====
3D Bin Packing implementation based on [this paper](erick_dube_507-034.pdf). The code is based on [gedex](https://github.com/gedex/bp3d) implementation in Go.
## Features
1. Sorting Bins and Items:
```[bigger_first=False/True]``` By default all the bins and items are sorted from the smallest to the biggest, also it can be vice versa, to make the packing in such ordering.
2. Item Distribution:
- ```[distribute_items=True]``` From a list of bins and items, put the items in the bins that at least one item be in one bin that can be fitted. That is, distribute all the items in all the bins so that they can be contained.
- ```[distribute_items=False]``` From a list of bins and items, try to put all the items in each bin and in the end it show per bin all the items that was fitted and the items that was not.
3. Number of decimals:
```[number_of_decimals=X]``` Define the limits of decimals of the inputs and the outputs. By default is 3.
## Install
```
pip install py3dbp
```
## Basic Explanation
Bin and Items have the same creation params:
```
my_bin = Bin(name, width, height, depth, max_weight)
my_item = Item(name, width, height, depth, weight)
```
Packer have three main functions:
```
packer = Packer() # PACKER DEFINITION
packer.add_bin(my_bin) # ADDING BINS TO PACKER
packer.add_item(my_item) # ADDING ITEMS TO PACKER
packer.pack() # PACKING - by default (bigger_first=False, distribute_items=False, number_of_decimals=3)
```
After packing:
```
packer.bins # GET ALL BINS OF PACKER
my_bin.items # GET ALL FITTED ITEMS IN EACH BIN
my_bin.unfitted_items # GET ALL UNFITTED ITEMS IN EACH BIN
```
## Usage
```
from py3dbp import Packer, Bin, Item
packer = Packer()
packer.add_bin(Bin('small-envelope', 11.5, 6.125, 0.25, 10))
packer.add_bin(Bin('large-envelope', 15.0, 12.0, 0.75, 15))
packer.add_bin(Bin('small-box', 8.625, 5.375, 1.625, 70.0))
packer.add_bin(Bin('medium-box', 11.0, 8.5, 5.5, 70.0))
packer.add_bin(Bin('medium-2-box', 13.625, 11.875, 3.375, 70.0))
packer.add_bin(Bin('large-box', 12.0, 12.0, 5.5, 70.0))
packer.add_bin(Bin('large-2-box', 23.6875, 11.75, 3.0, 70.0))
packer.add_item(Item('50g [powder 1]', 3.9370, 1.9685, 1.9685, 1))
packer.add_item(Item('50g [powder 2]', 3.9370, 1.9685, 1.9685, 2))
packer.add_item(Item('50g [powder 3]', 3.9370, 1.9685, 1.9685, 3))
packer.add_item(Item('250g [powder 4]', 7.8740, 3.9370, 1.9685, 4))
packer.add_item(Item('250g [powder 5]', 7.8740, 3.9370, 1.9685, 5))
packer.add_item(Item('250g [powder 6]', 7.8740, 3.9370, 1.9685, 6))
packer.add_item(Item('250g [powder 7]', 7.8740, 3.9370, 1.9685, 7))
packer.add_item(Item('250g [powder 8]', 7.8740, 3.9370, 1.9685, 8))
packer.add_item(Item('250g [powder 9]', 7.8740, 3.9370, 1.9685, 9))
packer.pack()
for b in packer.bins:
print(":::::::::::", b.string())
print("FITTED ITEMS:")
for item in b.items:
print("====> ", item.string())
print("UNFITTED ITEMS:")
for item in b.unfitted_items:
print("====> ", item.string())
print("***************************************************")
print("***************************************************")
```
## Latest Stable Version
py3dbp==1.1.2
## Versioning
- **1.x**
- Two ways to distribute items (all items in all bins - all items in each bin).
- Get per bin the fitted and unfitted items.
- Set the limit of decimals of inputs and outputs.
- **0.x**
- Try to put all items in the first bin that can fit at least one.
## Credit
* https://github.com/bom-d-van/binpacking
* https://github.com/gedex/bp3d
* [Optimizing three-dimensional bin packing through simulation](erick_dube_507-034.pdf)
## License
[MIT](./LICENSE)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
3D箱包装 基于3D Bin Packing实现。 该代码基于Go中的实现。 特征 对垃圾箱和物品进行排序: [bigger_first=False/True]默认情况下,所有垃圾箱和物品从最小到最大排序,反之亦然,以这种顺序进行包装。 物品分配: [distribute_items=True]从垃圾箱和物品的列表中,将物品放入垃圾箱,至少一个物品位于一个可以容纳的垃圾箱中。 即,将所有物品分配到所有箱柜中,以便将它们包含在内。 [distribute_items=False]从垃圾箱和物品的列表中,尝试将所有物品放入每个垃圾箱,最后,它在每个垃圾箱中显示所有适合的物品和不适合的物品。 小数位数: [number_of_decimals=X]定义输入和输出的小数位数限制。 默认为3。 安装 pip install py3dbp 基本说明 Bin和Items具有相同的创建参数:
资源详情
资源评论
资源推荐
收起资源包目录
3dbinpacking-master.zip (10个子文件)
3dbinpacking-master
.gitignore 49B
README.md 4KB
erick_dube_507-034.pdf 2.57MB
py3dbp
constants.py 261B
auxiliary_methods.py 988B
main.py 7KB
__init__.py 36B
example.py 1KB
LICENSE 1KB
setup.py 605B
共 10 条
- 1
大白兔奶棠
- 粉丝: 29
- 资源: 4660
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0