登录
首页 » 算法 » 贪心算法解决部分背包问题

贪心算法解决部分背包问题

于 2022-01-30 发布 文件大小:1.01 kB
0 309
下载积分: 2 下载次数: 1

代码说明:

本程序研究了贪心算法,并把此算法用于部分背包问题上,基于C语言实现,达到最优解。所谓贪心算法是指,在对问题求解时,总是做出在当前看来是最好的选择。也就是说,不从整体最优上加以考虑,所做出的仅是在某种意义上的局部最优解。贪心算法不是对所有问题都能得到整体最优解,但对范围相当广泛的许多问题他能产生整体最优解或者是整体最优解的近似解。部分背包问题:     给定一个最大载重量为M的卡车和N种食品,有食盐,白糖,大米等。已知第 i 种食品的最多拥有Wi 公斤,其商品价值为Vi元/公斤,编程确定一个装货方案,使得装入卡车中的所有物品总价值最大。

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Hough 变换
    这是代码 Hough 变换,其中 detecs 盘旋而通过定义的半径、 阈和三角洲的图像。它可以被用于带圆圈或非盘旋的功能,通过设置正确的阈限。当你降低门槛时,圈子,你正在寻找光流。我希望,它会对你有用
    2022-05-25 03:25:29下载
    积分:1
  • c语言程序练习
    编程,输入正整数n,求n的阶乘。 编程,统计字符串中数字字符的个数。 打印出水仙花数。 编程,判断字符串是否为回文。 编程,判断正整数n是否为完数。
    2022-02-28 22:39:29下载
    积分:1
  • 有限元的分析程序,对于初学有限元在结构中的应用很好用
    有限元的分析程序,对于初学有限元在结构中的应用很好用-Finite element analysis program for learning the structure of finite element in the application of good use
    2023-07-10 09:20:03下载
    积分:1
  • 这opennl,图书馆很容易构造和求解稀疏线性系统。
    This OpenNL, a library to easily construct and solve sparse linear systems. * OpenNL is supplied with a set of built-in iterative solvers (Conjugate gradient,BICGSTAB, GMRes) and preconditioners (Jacobi, SSOR). * OpenNL can also use other solvers (SuperLU 3.0 is supported as an OpenNL extension,MUMPS will be supported in a future version)-This is OpenNL. a library to easily construct and solve sparse l inear systems.* OpenNL is supplied with a set of built-in iterative solvers (Conjugate gradie nt, Application of BICGSTAB. GMRes) and preconditioners (Jacobi, SSOR).* OpenNL can also use other solvers (Super rLU 3.0 is supported as an OpenNL extension, MUMPS will be supported in a future version)
    2023-07-05 19:45:04下载
    积分:1
  • 差分进化算法
    Differential evolution: A simple and efficient heuristic for global optimization over continuous spaces. This code implements a basic multi-objective optimization algorithm based on Diferential Evolution (DE) algorithm. When one objective is optimized, the standard DE runs; if two or more objectives are optimized, the greedy selection step in DE algorithm is performed using a dominance relation.
    2022-07-08 18:06:29下载
    积分:1
  • c语言职工信息管理系统
    这是老师布置的工程实践的作业, 有很好的参考价值, 代码都有注释。值得分享。
    2022-08-12 18:19:37下载
    积分:1
  • Cognitive femto
    函数
    2023-01-04 14:15:04下载
    积分:1
  • sift算法
    这是基于MFC的sift算法,在VC上运行通过,代码注释比较详细,分块比较清晰,通过按键可以生成高斯金字塔,差分金字塔特征点和方向,已经特征点的文档
    2022-04-19 07:31:01下载
    积分:1
  • solving nonlinear equations in a way : by using a method of optimizing initial G...
    解非线性方程组的一种方法:先用一种优化方法将给定初值(它有可能会使得后续的牛顿法发散)通过一条比较快的途径收敛到精确解附近,得到一个新的初始点,然后再通过牛顿法将新的初始点迭代到精确解(一定的误差范围内)。这种方法的优点在于:它可以将牛顿法快速收敛的优势发挥出来,同时又避免了该方法收敛域比较窄的缺点。-solving nonlinear equations in a way : by using a method of optimizing initial Givens (it might make follow-up to Newton"s law divergence) adopted a relatively fast convergence to the channel near the exact solution, to be a new starting point, and then Newton"s law of the new iteration of the initial point of the exact solution ( some of error). This method has the advantage : it can be rapid convergence of Newton"s method to exploit the advantages while avoiding convergence of the method is relatively narrow domain shortcomings.
    2022-03-20 10:21:18下载
    积分:1
  • 有限元算法。平面绗架结构的有限元分析,包括计算每个节点的作用力。可以实现不同位置,不同载荷力的有限元分析。文件中的word文档,包括有具体实例计算。请阅读后使用...
    有限元算法。平面绗架结构的有限元分析,包括计算每个节点的作用力。可以实现不同位置,不同载荷力的有限元分析。文件中的word文档,包括有具体实例计算。请阅读后使用。-Finite element method. Planar lattice structure of finite element analysis, including the calculation of the force on each node. Can be achieved at different locations, different power load finite element analysis. Document word document, including specific examples of the calculation. Please read before use.
    2022-01-25 21:40:38下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载