English 中文(简体)
A. 动态方案拟订
原标题:Dynamic Programming In Case Of Non Integral Bound

You are given as input n items, where item i has a positive real-valued weight wi and a positive integral value vi. You are also given a positive real-valued capacity W. Note that the weights need not be integral. Give a dynamic programming algorithm that returns the value of the subset of items with maximum total value subject to the total weight of the subset being at most W. (You do not have to construct the actual subset of items.) the running time of your algorithm, should be polynomial in the largest item value vmax = max vi and the number of items n.

最佳回答

这样做的另一个方式是计算至少达到T总价值所需的最低总权重,直至未来最低权重显然大于W。 然后回头来寻找与加权相关的最高价值;=W.,我认为,每连续的T级分类账值所需的最低权重,可以通过动态的方案拟订来设计,利用已经为T级较低值所做的工作。

问题回答

我认为不可能这样做。 如果你把所有重量乘以低于一个数值,则你希望算法比以前更快。 但这是不可能的,因为问题实际上并没有改变。

0-1千纳普克问题的算法在O(nW)时间运行,当时,N为物体,W为最大重量。 这不是投入规模的多功能解决办法。 这里提出的问题是,从零到最高算法,而不是投入规模的聚合法。 如果我们考虑所有重量的固定点数,问题基本上是零至1千兆克的整体权重问题,因为以恒定因素乘以所有权重。





相关问题
How to add/merge several Big O s into one

If I have an algorithm which is comprised of (let s say) three sub-algorithms, all with different O() characteristics, e.g.: algorithm A: O(n) algorithm B: O(log(n)) algorithm C: O(n log(n)) How do ...

Grokking Timsort

There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Enumerating All Minimal Directed Cycles Of A Directed Graph

I have a directed graph and my problem is to enumerate all the minimal (cycles that cannot be constructed as the union of other cycles) directed cycles of this graph. This is different from what the ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签