A modified dynamic programming algorithm rapidly and accurately solves large 0/1 knapsack problems. It has computational O(nlogn), space O(nlogn) and predictable maximum error. Experimentally it's accuracy increases faster than linearly with the solution size k. Problems with k=1e3 are solved with an average maximum fractional error of 1e-4 and problems with k=1e5 with an average maximum fractional error of 1e-7. The algorithm runs in constant time for all problems with a given n. On a common desktop computer the algorithm processes n=1e3 problems in 1e-3 seconds and n=1e6 problems in 2 seconds.
翻译:改进后的动态规划算法能够快速精确地求解大规模0/1背包问题。该算法具有O(nlogn)计算复杂度、O(nlogn)空间复杂度及可预测的最大误差。实验表明其精度随解规模k的增长速度优于线性增长。当k=1e3时,算法求解的平均最大相对误差为1e-4;当k=1e5时,平均最大相对误差可达1e-7。对于给定n值的问题,算法运行时间保持恒定。在普通台式计算机上,该算法处理n=1e3规模问题仅需1e-3秒,处理n=1e6规模问题仅需2秒。