What makes a problem computationally NP?

  • Thread starter 2sin54
  • Start date
  • Featured
In summary: up with...a...solution...to...the...4-color...problem...would...require...4...polynomial...time...computations,...but...you...can...just...look...at...the...map...and...see...which...colors...don't... clash...with...others.
  • #1
2sin54
109
1
As the title says, what makes a decision problem NP complex? Is it application of the definition (as in: solvable in polynomial time by a non-deterministic Turing machine)? Also, if P does not equal NP, does it mean that NP problems can only be solved in O(exp(n)) time/steps?
 
Last edited by a moderator:
Technology news on Phys.org
  • #2
2sin54 said:
As the title says, what makes a decision problem NP complex? Is it application of the definition (as in: solvable in polynomial time by a non-deterministic Turing machine)?
Yes. If you can solve a problem in polynomial time only if a random tape is available, then it's in NP.
Also, if P does not equal NP, does it mean that NP problems can only be solved ...
deterministic
... in O(exp(n)) time/steps?
Yes, except it is already in P. It does not mean that a single instance of a problem couldn't be solved in P, only the problem in general can't.
 
  • #3
2sin54 said:
As the title says, what makes a decision problem NP complex? Is it application of the definition (as in: solvable in polynomial time by a non-deterministic Turing machine)? Also, if P does not equal NP, does it mean that NP problems can only be solved in O(exp(n)) time/steps?

NP is the set of decision problems where the yes answers can be verified in polynomial time. P is a subset of NP. Note that every problem with time complexity less than polynomial is also in P.

NP may contain more than just P. This is the case if there are problems whose solutions can be verified in polynomial time, yet cannot be solved in polynomial time (that is finding the solution is more difficult than checking that it is correct ).

The answer to the first question you asked is yes, but I think it's better to think of it the way I explained it (yes answers can be verified in polynomial time). The answer to the second is no, like I said, P is subset of NP. NP-Complete problems are those that are in NP and NP-Hard (as hard as the hardest problems in NP). Those problems, if P is not equal to NP, are not solvable in Polynomial time.
 
  • #4
Jarvis323 said:
The answer to the second is no, like I said, P is subset of NP. NP-Complete problems are those that are in NP and NP-Hard (as hard as the hardest problems in NP). Those problems, if P is not equal to NP, are not solvable in Polynomial time.

But I did not claim that if P equals NP, then NP problems are solvable in Polynomial time. O(exp(n)) is exponential time and I was wondering if (given P is not equal to NP) the NP problems are only solvable in exp(n) time.
 
  • #5
2sin54 said:
But I did not claim that if P equals NP, then NP problems are solvable in Polynomial time.

If P and NP are the same set, then of course all problems in NP are in P.

2sin54 said:
O(exp(n)) is exponential time and I was wondering if (given P is not equal to NP) the NP problems are only solvable in exp(n) time.

NP is a superset of all problems easily verified, this includes O(1) problems, O(n) problems etc. If NP is not P, then it just means that P is strictly a subset of NP, not all of NP (it would mean there are at least some NP problems that are not in P).
 
Last edited:
  • #6
Jarvis323 said:
NP is a superset of all problems easily verified, this includes O(1) problems, O(n) problems etc. If NP is not P, then it just means that P is strictly a subset of NP, not all of NP (it would mean there are at least some NP problems that are not in P).

What about if P is not equal to NP? Would the problems that are in NP but not in P be of exponential complexity?
 
  • #7
2sin54 said:
What about if P is not equal to NP? Would the problems that are in NP but not in P be of exponential complexity?
This article should answer the question pretty well. If P is not NP, then there are problems in-between P and NP-Complete.
https://en.wikipedia.org/wiki/NP-intermediate
 
  • #8
2sin54 said:
What about if P is not equal to NP? Would the problems that are in NP but not in P be of exponential complexity?

Well, NP is its own complexity classification.

Here's the way I understand it:

If a problem is in P, that means that you can find a solution in polynomial time.
If a problem is in NP but not in P, that means that you can check whether a solution is actually a solution in polynomial time, but it would take you longer than polynomial to find it.

The distinction between checking a solution and finding one is illustrated by the 4-color problem. You have some map of countries, and you want to pick colors from the choices Red, Yellow, Blue, Green, so that no two countries that share an edge have the same color. Coming up with a choice of colors might be very difficult: You might have to try every possible combination, and that's ##4^N## possibilities, where ##N## is the number of countries. So finding a solution might be exponential. But if somebody just handed you a colored map, you could check that no countries with a shared edge are the same color in at worst ##N^2## steps (go through every possible pair of countries, see if they share a border, and then check if they are the same color).

That might not be an example of an NP problem, though, because there might be some clever way to cut down the number of possibilities, but it shows you the idea.
 
  • Like
Likes Klystron
  • #9
stevendaryl said:
That might not be an example of an NP problem, though, because there might be some clever way to cut down the number of possibilities, but it shows you the idea.
Thank you for your answer. So is P - NP distinction unrelated to the algorithmic complexity of a problem? It should be though, shouldn't it? Because a problem in P is solvable in polynomial time (think O(t^N)). But what about NP, if it is not equal to P?
 
  • #10
2sin54 said:
Thank you for your answer. So is P - NP distinction unrelated to the algorithmic complexity of a problem? It should be though, shouldn't it?
Why that? A distinction means you have a problem, which is in NP but not in P. For being in NP you'll need an algorithm, for not being in P you'll need a proof. But be aware that the problem is unsolved for decades now, and it is notoriously hard to prove non existence. We basically have to show, that it's not our incapability, but hard by nature.
Because a problem in P is solvable in polynomial time (think O(t^N)). But what about NP, if it is not equal to P?
A problem in NP means it can be solved in exponential time and verified in polynomial. A famous example is whether Boolean expressions are true for some setting of the variables or not. To test all possibilities is exponential in time, and to check whether a setting yields true or false is polynomial. We do not know a polynomial time algorithm to find a general solution, yet. So a proof NP = P is easier than a proof P ##\subsetneq## NP, because for the former we needed only a smart algorithm to solve this Boolean problem. However, one cannot prove both. Until now, nobody has found a smart algorithm, and nobody could prove, that it's impossible.
 
  • #11
I just want to add some things to all the well-said things so far.

2sin54 said:
As the title says, what makes a decision problem NP complex? Is it application of the definition (as in: solvable in polynomial time by a non-deterministic Turing machine)?

A time-bounded TM is one that, given an input of length n, always halts in ##T(n)## moves and it is said to be ##T(n)## time bounded. The TM can be multi-tape and sometimes it can be deterministic. Now, if a DTM is ##T(n)## time bounded for some polynomial ##T(n)## then we say that this TM is polynomial time bounded. Then, its language ##L(m)## is said to be in the class P - it's the same thing to talk about the class P of problems or languages. The class NP is problems that can be solved by a TM that is non-deterministic but has a time bound along each branch. Now, as already noted, if for a NTM its time bound i.e. its running time (= maximum number of steps taken along any branch) is polynomial then this NTM is said to be polynomial - time bounded and its language is said to be in NP.

2sin54 said:
Also, if P does not equal NP, does it mean that NP problems can only be solved in O(exp(n)) time/steps?

Regarding the P = NP open question, there are various ways to address it. One such way is through NP - complete problems. An NP - complete problem (defined formally via poly-time reductions) has the property that it is in NP and if it is in P, then every problem in NP is also in P. It turns out that almost every problem that is known to be in NP but it is not known to be in P, is NP - complete. There is only one well known exception: graph isomorphism. Also, there are thousands of problems that are in NP but appear not to be in P. Unfortunately, no proof that they are not really in P.

Now, regarding problem reduction, an example of a problem definitely in NP is the Knapsack Problem. A dynamic-programming algorithm which maintains a table of all the differences that can be achieved by partitioning the first i integers, could seem to solve the problem in polynomial time but there is the subtlety of measuring the input size. But if we redefine the problem by representing integers in unary - that is pseudo-knapsack, then this problem is in P.
 

1. What is NP-completeness?

NP-completeness is a classification of computational problems that are believed to be very difficult to solve. These problems are in a class called NP, which stands for non-deterministic polynomial time. This means that the solutions to these problems can be verified in polynomial time, but it is not known if they can be solved in polynomial time.

2. How do you determine if a problem is NP?

To determine if a problem is NP, you need to check if its solutions can be verified in polynomial time. This means that given a potential solution, you can check if it is correct in a reasonable amount of time. This does not guarantee that the problem is NP, but it is a good indicator.

3. What are some examples of NP problems?

Some examples of NP problems include the traveling salesman problem, the knapsack problem, and the Boolean satisfiability problem. These problems are believed to be difficult to solve, but their solutions can be verified in polynomial time.

4. How do NP problems differ from P problems?

P problems are a subset of NP problems. P problems are ones that can be solved in polynomial time, while NP problems can only be verified in polynomial time. This means that all P problems are also NP problems, but not all NP problems are P problems.

5. What makes a problem NP-complete?

A problem is considered NP-complete if it is both NP and NP-hard. This means that the problem is difficult to solve and that any other NP problem can be reduced to it in polynomial time. In other words, if you can solve an NP-complete problem, you can solve any other NP problem.

Similar threads

  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Quantum Physics
Replies
4
Views
739
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
29
Views
3K
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
9
Views
3K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
Back
Top