如何在打字稿中将产品放入不同的垃圾箱

问题描述

三维箱包装问题-有些产品需要装入给定的容器中,所有产品和容器的长、宽和高尺寸都不同。

产品

P1 - 10X10X30 -->(数量 12)

P2 - 10X20X10 -->(数量 15)

容器

C1 - 30X30X30

C2 - 10X20X20

我正在探索以下算法来解决这个问题:

  1. 下一次拟合
def next_fit(items,assignment,free_space):
    for item in items:
        if item <= free space of current bin:
            assign the item to the current bin
            update the free space of the current bin
        else:
            create a new bin
            assign the item to the new bin
            update the free space of the current bin
  1. 首次匹配
def next_fit(items,free_space): for item in items: if item <= free space of current bin: assign the item to the current bin update the free space of the current bin else: create a new bin assign the item to the new bin update the free space of the current bin

什么是更好的方法,我还需要生成记录,显示哪些产品适合哪个容器。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)