文件名称:myknapsack
- 所属分类:
- 控制台(字符窗口)编程
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2008-10-13
- 文件大小:
- 1.57kb
- 下载次数:
- 1次
- 提 供 者:
- 林*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
a) 0-1背包问题采用的是动态规划法,该算法思想简介如下:
有些问题常常没有办法把它们分成较小数目的子问题,在这种情况下,可以试着把问题分成必要多的子问题,每个子问题又可以分成数目不确定的必要多的子子问题,这样就会产生大量的子问题。如果分得的子问题界限不清,互相交叉,则在大量的子问题中会存在一些完全相同的子问题,因而在解这类问题时,将可能重复多次解同一个子问题。这种重复当然是不必要的,避免的方法可以在解决一个子问题后把它的解(包括其子子问题的解)保留下来,若遇到求解与之相同的子问题的时候,就可以把它找出来直接使用。为解问题而将它的子问题的解填入表中以待需要时直接查除了使用,这样的方法就是动态规划法。
b) 分数背包问题采用的是贪心选择法,该算法思想简介如下:
贪心算法总是作出在当前看来是最好的选择。也就是说,不从整体最优上加以考虑,它所做出的仅是在某种意义上的局部最优解。
-a) 0-1 knapsack problem is the use of dynamic programming method, the algorithm Thought as follows : some of the problems often no way to put them into a smaller number of sub-issues, in such circumstances, it attempts problem into the necessary number of sub - problems, every child that the problem can be divided into a number of uncertainties over the need for the children, this will have a lot of the problem. If the share of the sub - problems ill-defined, overlapping, in a large number of sub-issues there will be some identical son, thus the solution of such problems, it will be possible to repeat the same number of sub - problems solution. Such duplication is unnecessary. avoid the method can solve a problem for it to the solution (including his son, son of FNL) remain, if faced with
有些问题常常没有办法把它们分成较小数目的子问题,在这种情况下,可以试着把问题分成必要多的子问题,每个子问题又可以分成数目不确定的必要多的子子问题,这样就会产生大量的子问题。如果分得的子问题界限不清,互相交叉,则在大量的子问题中会存在一些完全相同的子问题,因而在解这类问题时,将可能重复多次解同一个子问题。这种重复当然是不必要的,避免的方法可以在解决一个子问题后把它的解(包括其子子问题的解)保留下来,若遇到求解与之相同的子问题的时候,就可以把它找出来直接使用。为解问题而将它的子问题的解填入表中以待需要时直接查除了使用,这样的方法就是动态规划法。
b) 分数背包问题采用的是贪心选择法,该算法思想简介如下:
贪心算法总是作出在当前看来是最好的选择。也就是说,不从整体最优上加以考虑,它所做出的仅是在某种意义上的局部最优解。
-a) 0-1 knapsack problem is the use of dynamic programming method, the algorithm Thought as follows : some of the problems often no way to put them into a smaller number of sub-issues, in such circumstances, it attempts problem into the necessary number of sub - problems, every child that the problem can be divided into a number of uncertainties over the need for the children, this will have a lot of the problem. If the share of the sub - problems ill-defined, overlapping, in a large number of sub-issues there will be some identical son, thus the solution of such problems, it will be possible to repeat the same number of sub - problems solution. Such duplication is unnecessary. avoid the method can solve a problem for it to the solution (including his son, son of FNL) remain, if faced with
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : 121114139myknapsack.rar 列表 knapsack.cpp fracknapsack.cpp