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

退火算法 贪婪算法

介绍 (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

退火算法 贪婪算法

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值