寻找最佳组合的算法

标签 algorithm math

假设我有一个包含 100 种产品的 list ,每一种都有一个价格。每个也有一个能量 (kJ) 测量值。

是否有可能使用编程找到 15 种产品的最佳组合,其中能量总和 (kJ) 最大,价格低于 10 美元?

我知道 C#,但任何语言都可以。干杯。

更新:在寻找背包问题的示例源代码时遇到了一些麻烦。有没有人有或知道在哪里可以找到一些。在谷歌上搜索了几个小时,如果可能的话,需要在明天之前解决这个问题。塔。

最佳答案

http://en.wikipedia.org/wiki/Knapsack_problem

The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. It derives its name from the problem faced by someone who is constrained by a fixed-size knapsack and must fill it with the most valuable items...

关于寻找最佳组合的算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/680524/

相关文章:

math - 如何从一个角度与2D中的另一个矢量计算一个矢量?

c++ - 找出数的最后一位数的某次幂

java - BigDecimal 对大于 7 或 0 小数的数字给出意想不到的结果

regex - 匹配关于同一主题的句子的算法

以特定变量的特定顺序排列列表的算法

mysql - 如何在 MySQL 数据库中维护递归不变量?

algorithm - 对多边形的点进行排序以进行绘制

algorithm - 硬件中的多个独立伪随机数生成(Verilog 或 VHDL)

algorithm - 图像识别的起点?

c# - 获取数字的因子