简体   繁体   English

仅使用权重作为递归变量的背包公式

[英]Knapsack formula using only weights as the recursion variable

I have developed a recursive formula for knapsack problem on my own without any knowledge of present solutions. 我自己开发了一个背包问题的递归公式,而对当前的解决方案一无所知。 Please tell me whether it is right or wrong and correct it.Thanks in advance. 请告诉我是对是错,并进行更正。谢谢。

B(S) = max (B (s-w(i)) + b(w(i)) )

for all i belonging to n ; 因为i属于n ; notations are as usual . 记法照常。 S is capacity, B is the answer to knapsack. S是容量, B是背包的答案。

I do not want to give you straight answer, but to direct you on the flaws of your formula, and let you figure out how to solve them. 我不想给您直接的答案,而是要引导您了解公式的缺陷,并让您找出解决方法。

  1. Well, if you do not address the value, something must be wrong - otherwise, you just simply lose information. 好吧,如果您不解决价值问题,那肯定是有问题的-否则,您只会丢失信息。 If you chose to "take" the item ( B(sw(i)) ) what happens to the current value? 如果您选择“获取”项目( B(sw(i)) ),那么当前值会怎样?
  2. In addition, what is i ? 此外,什么是i How do you change i over time? 你如何随着时间改变i
  3. When talking about recursive formula, you must also mention a stop clause for it. 在讨论递归公式时,还必须提及它的stop子句。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM