微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

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

产品

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 举报,一经查实,本站将立刻删除。