简体   繁体   English

一种证明没有贪婪算法可以获得最优解的方法吗?

[英]A way to prove that there's no greedy algorithm that obtains optimal solution?

The question is pretty simple. 问题很简单。 I need to prove that there's no greedy algorithm that can obtain the optimal solution for a given problem. 我需要证明没有贪心算法能够为给定问题获得最优解。

It is unclear to me if there is any condition that a problem must meet so that exists a certain greedy algorithm to obtain the optimal solution. 我不清楚是否存在问题必须满足的任何条件,因此存在某种贪婪算法以获得最优解。 Or if there is any sufficient condition for the problem not to be solvable by a greedy algorithm. 或者,如果有足够的条件使问题无法通过贪婪算法解决。

I am precisely talking about the greedy coloring: 我正在谈论贪婪的色彩:

http://en.wikipedia.org/wiki/Greedy_coloring http://en.wikipedia.org/wiki/Greedy_coloring

I need to prove that there's no greedy algorithm that can obtain the optimal solution for a given problem. 我需要证明没有贪心算法能够为给定问题获得最优解。

Well, that's going to depend on the definition of the property you chose. 那么,这取决于您选择的属性的定义。

Have a look for example on the graph coloring problem, and assume you have an oracle M that given a partially colored graph, returns true if and only if there is a graph coloring for it. 看一下图形着色问题的例子,并假设你有一个给出部分彩色图形的oracle M ,当且仅当它有图形着色时才返回true。

Now, using this oracle, a greedy algorithm can be as follows: 现在,使用这个oracle,一个贪婪的算法可以如下:

for each vertex v:
   for each color c:
        temporarly color v with c
        run M on partially colored graph
        if M yields true, make c constant to v, and abort the inner loop

The above algorithm is coloring the graph in a greedy manner, chosing one vertex at a time, according to the answer of the oracle M . 上述算法根据oracle M的答案,以贪婪的方式对图形着色,一次选择一个顶点。 (Choosing the best answer of M and assigning it to each vertex and color, where set of answers is false or true) (选择M的最佳答案并将其分配给每个顶点和颜色,其中答案集为false或true)

Does it feel like cheating? 是不是觉得作弊? Probably, because there is no known such M that runs in polynomial time, but if you run an exponential algorithm that creates M , there is definetly a greedy algorithm for it. 可能,因为没有已知的M在多项式时间内运行,但是如果你运行一个创建M的指数算法,那么它肯定是一种贪婪的算法。

You can however prove that there is no KNOWN algorithm that greedily chooses in polynomial time (or any other polynomial algorithm for that matter) that yields an optimal answer for graph coloring, since graph coloring is NP-Complete, and we don't know any algorithm that solves NPC problems efficiently (and most believe such does not exist). 然而,您可以证明在多项式时间(或任何其他多项式算法)中贪婪选择的KNOWN算法不会产生图形着色的最佳答案,因为图形着色是NP完全的,我们不知道任何有效解决NPC问题的算法(并且大多数人认为这种问题不存在)。

However, if at some point we will prove P=NP, we can efficiently calculate M , and we will get an efficient greedy algorithm that solves graph coloring. 但是,如果在某些时候我们将证明P = NP,我们可以有效地计算M ,并且我们将得到一个有效的贪婪算法来解决图着色。

Greedy, on a philosophical level is the phenomenon, when the holder of the attribute thinks on short-term and ignores long-term incomes. 贪婪,在哲学层面上是这种现象,当属性的持有者在短期内思考并忽略长期收入时。 As we can see, this is not a well-defined concept. 我们可以看到,这不是一个定义明确的概念。 How is the algorithm greedy? 算法如何贪婪? If we do not know the essence of its greedyness, then we do not have the means to prove that it does not obtain the optimal solution. 如果我们不知道其贪婪的本质,那么我们就没有办法证明它没有获得最优解。 Also, the concept of obtaining the optimal solution is ambiguous. 而且,获得最优解的概念是模糊的。 It might mean that it will never obtain the optimal solution, or it might mean that there is at least a case when it cannot obtain the optimal solution. 这可能意味着它永远不会获得最优解,或者它可能意味着至少存在无法获得最优解的情况。 I suggest documenting the issue, understanding the problem and then starting to think how to prove this again. 我建议记录问题,理解问题,然后开始思考如何再次证明这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM