给定一组对象,如何计算有多少适合在一个给定的量? [英] Given a set of objects, how to calculate how many fit in a given volume?

查看:111
本文介绍了给定一组对象,如何计算有多少适合在一个给定的量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这更是一个算法的问题不是编程,但我在编程实现的,所以我要问在这里。

我有一组不同的已知尺寸给出的对象,需要弄清楚,可以已知尺寸的另一个卷里面放对象的最大。什么算法存在探讨这个问题,而不是一个组合蛮力方法等?

另外,如果我认为他们都没有安排,有多少适合?

另一种方式来看待它:

  1. 什么是一套乐高块我可以组装放的最大 在一个盒子里,我如何计算呢?
  2. 什么是一套乐高块的最大值,我可以在一个盒子里跌落不安排他们 以及如何计算的呢?
解决方案

这是一个经典的CS的问题 - 阅读的背包问题

This is more an algorithm question than programming, but it's implemented in programming so I'm asking it here.

I have a set of given objects with different known dimensions and need to figure out the max of objects that can be put inside another volume of known dimensions. What algorithms exist to explore this problem other than a combinatorial brute-force approach?

Also, if I assume they are not arranged, how many will fit?

Another way to look at it:

  1. What's the max of a set of LEGO blocks I can assemble to put inside a box and how do I calculate it?
  2. What's the max of a set of LEGO blocks I can drop inside a box without arranging them and how do I calculate it?

解决方案

This is a classic CS problem - read the wiki entry on Knapsack problem.

这篇关于给定一组对象,如何计算有多少适合在一个给定的量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆