退火算法 贪婪算法_算法贪婪策略简介

退火算法 贪婪算法

介绍 (Introduction)

The solution is determined by a sequence of steps each step has given a particular solution and later a complete solution to given the problem can be achieved. In short, while making a choice there should be a greed for the optimum solution. Some points about Greedy strategy:

该解决方案由一系列步骤确定,每个步骤都给出了特定的解决方案,随后可以实现针对给定问题的完整解决方案。 简而言之,在做出选择时,应该有一个贪婪的最佳解决方案。 有关贪婪策略的一些要点

  • Look for the optimal solution and assumes it as best.

    寻找最佳解决方案,并假定它是最佳解决方案。

  • Solves the sub-problems in Top-down manner.

    以自上而下的方式解决子问题。

  • This approach is less powerful programming techniques.

    这种方法是功能较弱的编程技术。

  • It is not applicable to a wider area like dynamic programming approach.

    它不适用于动态编程方法等更广泛的领域。

  • It is useful for solving optimization problems.

    这对于解决优化问题很有用。

  • It generates only one solution sequences.

    它仅生成一个解决方案序列。

In greedy Strategy following activities are performed,

在贪婪策略中,执行以下活动,

  1. First, select some solutions from input domain.

    首先,从输入域中选择一些解决方案。

  2. Then check whether the solution is feasible or not.

    然后检查该解决方案是否可行。

  3. In this, we find an optimum solution which satisfies the objective of the function and it can be obtained from a particular solution out of the set of feasible solution.

    在此,我们找到了一个满足函数目标的最优解,并且可以从可行解集中的特定解中获得。

  4. As greedy method works in stages only one stage is considered at a time. Based on this input it is decided whether a particular input is given the optimal solution or not.

    由于贪婪方法分阶段进行,因此一次只考虑一个阶段。 基于此输入,确定是否为特定输入提供了最佳解决方案。

贪婪策略算法 (Algorithm for Greedy Strategy)

In greedy approach D is domain, from which solution is to be obtained of size n...

在贪婪方法中, D是域,将从中获得大小为n的解 。

    Initially assume
Solution  ← 0
For i ← 1 to n do
{
S ← select(D) // section of solution from D
If (Feasible (solution) then
Solution ← Union (solution, s);
}
Return solution

贪婪策略的要素 (Elements of Greedy Strategy)

Greedy Choice property

贪婪选择酒店

  • A global optimal solution can be arrived by local optimal choice.

    全局最优解可以通过局部最优选择来获得。

  • For finding the solutions to the problem the subproblems are solved and best from these sub-problems is considered.

    为了找到问题的解决方案,解决了子问题,并考虑了这些子问题中的最佳问题。

  • This choice may depend upon the previously made choices but it does not depend on any future choice.

    该选择可能取决于先前做出的选择,但并不取决于任何将来的选择。

  • Thus in the greedy method, greedy choices are made one after the another, reducing each given problem instances to smaller one.

    因此,在贪婪方法中,贪婪的选择是一个接一个地做出的,从而将每个给定的问题实例减少为较小的一个。

Optimal sub-structure

最佳子结构

  • If an optimal solution to the problem containing the optimal solution to the subproblem then the problem shows an optimal substructure.

    如果问题的最优解包含子问题的最优解,那么问题将显示最优子结构。

  • A problem has optimal substructure if has been next choices always leads to an optimal solution.

    如果问题一直存在,则问题具有最佳的子结构,这通常会导致最佳解决方案。

贪心法的应用 (Applications of greedy method)

Problems that can be solved by greedy approach,

贪婪方法可以解决的问题,

  1. Knapsack problem

    背包问题

  2. Prim’s algorithm for minimum spanning tree.

    Prim的最小生成树算法。

  3. Kruskal’s algorithm for minimum spanning tree.

    最小生成树的Kruskal算法。

  4. Finding shortest job

    寻找最短的工作

  5. Job sequencing with deadlines

    有期限的工作排序

  6. Optimal storage on taps

    水龙头的最佳存储

  7. Huffman coding

    霍夫曼编码

Feasible solution

可行的解决方案

The set of values for the decision problem which satisfies all of the constraints of an optimization problem then the solution is called feasible solution. Feasible solution satisfy all linear and non-linear constraints. The set of all feasible solution defines the feasible region of the problem. To solve a problem first find anyone feasible solution and then try to find another feasible solution which satisfies the values of the objective functions. The whole process is repeated until when no further improvement is achieved or other criteria are met.

满足优化问题所有约束的决策问题的值集,然后将该解决方案称为可行解。 可行的解决方案满足所有线性和非线性约束。 所有可行解的集合定义了问题的可行区域。 为了解决问题,首先找到任何可行的解决方案,然后尝试找到另一种满足目标函数值的可行解决方案。 重复整个过程,直到没有进一步的改善或满足其他标准为止。

翻译自: https://www.includehelp.com/algorithms/introduction-to-greedy-strategy-in-algorithms.aspx

退火算法 贪婪算法

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/542103.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

windows 2008 R2系统安装拨号v p n详细配置

windows 2008 R2系统单网卡安装拨号v p n系统环境:windows 2008 R2操作步骤首先设置服务端在服务器管理器中添加角色“网络策略和访问服务”,并安装以下角色服务右击路由与远程访问,选择“配置并启用路由和远程访问”右击路由与远程访问&…

python—函数

1. 函数的定义: 1 . 含义:我们把实现某一功能的代码定义为一个函数,在需要使用时,随时调用,十分方便。对于函数,简单理解就是可以完成某功能的代码块,可反复使用。 Python提供了许多内建函数&a…

word打开老是配置进度_小白教程 | office出现配置进度框,怎么办?

最近很多同学在备考二级时候,自己的电脑上office软件Word或者Excel出问题了,每次打开都会出现配置进度框。这种情况怎么办呢?这种情况都是注册表的问题,马上安排解决之前在 右键菜单没有office新建怎么办(点击即可阅读)也是用注册…

【踩坑速记】开源日历控件,顺便全面解析开源库打包发布到Bintray/Jcenter全过程(新),让开源更简单~...

一、写在前面 自使用android studio开始,就被它独特的依赖方式:compile com.android.support:appcompat-v7:25.0.1所深深吸引,自从有了它,麻麻再也不用担心依赖第三方jar包繁琐无趣啦。而,如果自己写一个开源库是一种怎…

scala集合中添加元素_如何在Scala中获得列表的第一个元素?

scala集合中添加元素清单 (List) A list is a linear data structure. It is a collection of elements of the same data types. 列表是线性数据结构。 它是相同数据类型的元素的集合。 Scala libraries have many functions to support the functioning of lists. Methods l…

python—列表、字典生成式

1 列表生成式 Python内置的一种极其强大的生成列表 list 的表达式。返回结果必须是列表。 示例: 需求1:接收变量 k a b s 51 5000 10000 a s.split() li [] for item in s.split():li.append(int(item)) k,a,b li print(k,a,b)运行结果:…

excel数据平均分配给多人_excel表格 怎样均分数据-用Excel怎么才能将组数据平均分配给几个人...

怎样在Excel表格中求平均数?在excel中怎样自动生成各班各科的平均成绩可以调用Excel函数库的函实现。步骤如下:1. 在单元格内点击上公式-平均值”。2. 点击需要参与计算的单元格数据,符号用键盘输入,最后回车即可。百度百科-Excel函数exce…

Java中List和Map接口之间的区别

列表与地图界面 (List vs Map interface) Here, we will see how List differs from Map interface in Java and we will see the points given below, 在这里,我们将看到List与Java中的Map接口有何不同,并且我们将看到以下几点, 列表界面 (…

python—高阶函数

什么是内置高阶函数: 一个函数可以作为参数传给另外一个函数,或者一个函数的返回值为另外一个函数(若返回值为该函数本身,则为递归),满足其一则为高阶函数。 Python中内置了几个常用的高阶函数,…

功能区不显示工具条_【新老客户必知】软件支持超高清屏显示器了

随着计算机硬件的不断更新换代显示设备的不断更新从原来的分辨率640 X 480啥原来分辨这么低呀?还记得DOS吗?或者Win95,win98吗当时显示器分辨率能调到800X 600很好了2000年左右随着纯平显示器的推出也有了高清显示器的概念那么一般我们说的高清显示器分辨…

nginx1.10.2源码安装配置参数参考

[rootlocalhost nginx-1.10.2]# ./configure --help--help print this message--prefixPATH set installation prefix #Nginx安装的根路径,默认为 /usr/local/nginx。--sbin-pathPATH set nginx binary pathname #指定nginx二进制文件的路径,默认为PATH/sbin/n…

c ++查找字符串_C ++朋友功能| 查找输出程序| 套装1

c 查找字符串Program 1: 程序1&#xff1a; #include <iostream>using namespace std;class Sample {int A, B;friend void fun();};void fun(){Sample S;S.A 10;S.B 20;cout << S.A << " " << S.B << endl;}int main(){fun();retu…

Spring定时器的运用

为什么80%的码农都做不了架构师&#xff1f;>>> 一、spring4定时器任务配置如下&#xff1a; <bean id"jsapiTask" class"chan.ye.dai.wexin.JsapiTicketTimeTask" /><bean id"jobDetail"class"org.springframework.s…

python—装饰器

装饰器概念&#xff1a; 把一个函数当作参数传递给一个函数&#xff0c;返回一个替代版的函数 本质上就是一个返回函数的函数 在不改变原函数的基础上&#xff0c;给函数增加功能 python 中装饰器做的事情&#xff01;它们封装一个函数&#xff0c;并且用这样或者那样的方式来修…

ad18原理图器件批量修改_Altium Designer 15原理图设计基础

Altium Designer 15成为越来越多电子设计开发工程师EDA电路设计软件的首选&#xff0c;在学校学习Altium Designer的也越来较多&#xff0c;像单片机开发学习一样&#xff0c;EDA设计只要学会了&#xff0c;再学其他的设计软件就容易多了。上一节分享了《Altium Designer 15集成…

c++freopen函数_使用示例的C语言中的freopen()函数

cfreopen函数C语言中的freopen()函数 (freopen() function in C) Prototype: 原型&#xff1a; FILE* freopen(const char *str, const char *mode, FILE *stream);Parameters: 参数&#xff1a; const char *str, const char *mode, FILE *streamReturn type: FILE* 返回类型…

python—文件

1 . 文件的基本操作&#xff1a; 文件读取三部曲&#xff1a; 打开操作关闭&#xff08;如果不关闭会占用文件描述符&#xff09; 打开文件&#xff1a; f open(/tmp/passwdd,w)操作文件&#xff1a; 1 . 读操作&#xff1a; f.read()content f.read()print(content) 2 …

基本概念学习(7000)--P2P对等网络

对等网络&#xff0c;即对等计算机网络&#xff0c;是一种在对等者&#xff08;Peer&#xff09;之间分配任务和工作负载的分布式应用架构[1] &#xff0c;是对等计算模型在应用层形成的一种组网或网络形式。“Peer”在英语里有“对等者、伙伴、对端”的意义。因此&#xff0c;…

c语言for循环++_C ++程序使用循环查找数字的幂

c语言for循环Here, we are going to calculate the value of Nth power of a number without using pow function. 在这里&#xff0c;我们将不使用pow函数来计算数字的N 次幂的值 。 The idea is using loop. We will be multiplying a number (initially with value 1) by t…

厦门one_理想ONE真是“500万内最好的车”?

提起罗永浩&#xff0c;不少人还停留在“砸冰箱、造手机”等早期事件。随着网络直播的兴起&#xff0c;罗永浩转战直播带货行业&#xff0c;但老罗毕竟是老罗&#xff0c;雷人语录一点没比以前少。前一段时间&#xff0c;罗永浩在微博中称&#xff1a;“理想ONE是你能在这个价位…