Pergunta

Professor Tim Roughgarden from Stanford University while teaching a MOOC said that solutions to problems in the class NP must be polynomial in length. But the wikipedia article says that NP problems are decision problems. So what type of problems are basically in the class NP ? And is it unnecessary to say that solutions to such problems have a polynomial length output(as decision problems necessarily output either 0 or 1) ?

Foi útil?

Solução

He was probably talking about witnesses and verifiers.

For every problem in NP, there is a verifier—read algorithm/turing machine—that can verify "yes"-claims in polynomial time.

The idea is, that you have some kind of information—the witness—to help you do this given the time constraints.

For instance, in the travelling salesman problem:

TSP = {(G, k) if G has a hamiltonian cycle of cost <= k}

For a given input (G, k), you only need to determine whether or not the problem instance is in TSP. That's a yes/no answer.

Now, if someone comes along and says: This problem instance is in TSP, you will demand a proof. The other person will then probably give you a sequence of cities. You can then simply check whether the cities in that order form a Hamiltonian cycle and whether the total cost of the cycle is ≤ k.

You can perform this procedure in polynomial time—given that the witness is polynomial in length.

Using this sequence of cities, you were thus able to correctly determine that the problem instance was indeed in TSP.

That's the idea of verifiers: They take a proof object/witness that is polynomial in length to check in polynomial time, that a certain problem instance is in the language.

Outras dicas

The standard definition of NP is that it is a class of decision problems only. Decision problems always produce a yes/no answer and thus have constant-sized output.

sDidn't watch the video/course, but I am guessing he was talking about certificates/verification and not solutions. Big difference.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top