简体   繁体   中英

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

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.

Now, using this oracle, a greedy algorithm can be as follows:

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 . (Choosing the best answer of M and assigning it to each vertex and color, where set of answers is false or 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.

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).

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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