An intuitive understanding of np-hard and np-complete problems is the problem of finding polynomial-time algorithms that are difficult (and probably impossible) to find. So the general beginner of the algorithm will ask the question: what is the difference between Np-hard and np-complete? The simple answer is by definition, if all NP problems can be polynomial to problem a, then problem A is np-hard, and if problem A is both Np-hard and NP, then it is np-complete. From the definition we can easily see that the Np-hard problem class contains the Np-complete class. But further we will ask whether there is a problem which belongs to the Np-hard but does not belong to Np-complete. The answer is yes. For example, the problem of downtime is to give a program and input to determine whether its operation will terminate. Downtime is not a problem, and it is certainly not NP-related. But for np-complete problems such as the SAT, it can be polynomial-to-stop problem. Because we can construct program a, the program to the input of the formula is exhaustive its variable all assignment, if there is an assignment to make it true, then stop, otherwise enter an infinite loop. In this way, judging whether the formula can be satisfied will be converted to determine whether the formula for the input program A is down. So, the downtime problem is np-hard and not np-complete.
NP problem is a kind of problem that the correctness of its solution can be checked in polynomial time. For example, the array summation, get a solution, this solution is wrong, obviously can be in polynomial time validation. For example, the SAT, if you get a solution, you can verify the correctness of the polynomial time. So the SAT and summation are NP-on. Then, a part of the NP problem can be found in polynomial time, such as the sum of the array, this part of the problem is a relatively simple NP part, is named P-class problem. Then the NP problem beyond P is the problem that can not be solved in polynomial time at present. Will someday, Daniel invented the cow algorithm, these problems are solved in polynomial time? In other words, will all the NP problems, in fact, are P-type problems, but humans have not yet discovered it? Np=p?
It is conceivable that the road to prove np=p is difficult, because the NP problem is too many, to find a polynomial algorithm. Stephen A. Cook, who appeared, wrote an article about the complexity of theorem proving procedures, and proposed a np-complete concept. NPC refers to the most difficult part of NP problem, and all NP problems can be attributed to NPC in polynomial time. The so-called attribution means that if a to b,b is easy to solve, then a is easy to solve. Obviously, if any NPC problem is solved in polynomial time, then all NP problems will be P-type problem, and Np=p is proved, which greatly simplifies the proving process. So how to prove a problem C is a NP-complete problem? First of all, to prove that C is a NP problem, that is, the correctness of C's solution is easy to verify, and then to prove that there is a NP-complete problem B, can be in polynomial time to the C. This requires that at least one NPC problem must exist first. It was then that Cook Daniel proved in 1971 that the ancestor of the NP-complete problem was the SAT. The SAT question refers to a logical formula that contains n Boolean variables, asking if there is a combination of values that makes the formula satisfied. Cook proves that the SAT is an NPC problem and that if the SAT is easy to solve, then all NP is easy to solve. How did cook do it?
He did it through a non-deterministic Turing. Non-deterministic Turing machines are a special kind of Turing machine, which can guess in polynomial time as long as there is a solution to the problem. Cook proved that the SAT summarizes all the constraints that the machine must meet in the calculation process, and that any NP problem can be described as a SAT problem on this machine. So, if you can have a good algorithm to solve the SAT, you can solve the computational problem of non-deterministic Turing machine, because NP problem is a polynomial solution on the non-graph, so you solve the SAT, can solve all NP, so--sat is a NP complete problem. Thanks to cook, we've got a NPC problem, and the rest is good, and we can prove it with a return. At present, people have found thousands of NPC problems, to solve a, np=p, can get the Millennium Award (I think it can get the Turing award).
Then there must be someone to ask, then NP, there are some even the verification solution can not solve the problem of polynomial. This part of the problem, even if it is np=p, is not necessarily able to solve the polynomial, is named Np-hard problem. Np-hard is too difficult, how to find a perfect girlfriend is np-hard problem. A np-hard problem can be attributed to a NP-complete problem, that is, if a np-hard is resolved, then all NP will be solved.
Let me take the risk of making mistakes and being smashed into bricks to explain the p/np/np-complete/np-hard.
1, computational complexity
This is a measure of how much "time" is required to describe an algorithm. (There are also spatial complexities, but because they can be converted to each other, we often say time complexity.) For input of size n, we express it with a simplified formula containing n. (The so-called simplified formula, is to ignore the coefficients, constants, only the most "large" part)
For example, to find the largest of the n number, it is simple, is the first number and the second ratio, where the big one and the third ratio, and so on, in a total of more than n-1 times, we remember as O (n) (for n can be very large, the case, 1 can be negligible).
such as from small to large rows of n number, from which to find equals X of that. One way is to look in order from start to finish, preferably the first is X, the worst case is to compare n times straight The last one, so the worst case of computational complexity is O (n). There is another way: First take the middle that number and x comparison, such as large in the previous half of the search, such as small in the latter half of the search, each time is taken in the middle of the number to compare, then the worst case is LG (N)/lg2. Ignoring the coefficient lg2, the algorithm complexity is O (LGN).
2, the sort of computational complexity:
Depending on the growth rate of N-based expressions, you can sort them: 1 < LG (n) < n < NLG (n) < N^2 < ... < N^k (k is constant) < ... < 2^n. The last 2 of the n is the progression, and the people who read the wheat on the board know how fast this is growing. And the previous ones are the complexity of the polynomial time of N. Why do we ignore all coefficients and constants here, such as 2*n^3+9*n^2 can be simplified to n^3? I can explain it with a set or something, I forget the exact word. If you remember calculus, imagine the derivative of (2*n^3+9*n^2)/(n^3), the result is 0, no difference, right?
2,p problem: For a problem, all can find the computational complexity can be expressed as a polynomial determination algorithm, this problem belongs to the P (polynomial) problem.
3,NP questions:
N in NP refers to the non-deterministic (non-deterministic) algorithm, which is an algorithm: (1) Guess an answer. (2) Verify that the answer is correct. (3) As long as there is a validation, the answer is correct, then the algorithm is solved.
NP (non-deterministic polynomial) problem is that, with such a non-deterministic algorithm, the Verification Step (2) has polynomial-time computational complexity algorithm.
4, the problem of the attribution:
This...... What terminology should I use to explain it? Collection? It's too hard to tell ... It's easier to imagine if you remember the mapping of functions.
This is roughly the case: find all input from problem 1 to the corresponding of all input of question 2, if corresponding, can also have problem 2 all output to problem 1 of all output correspondence, then if we find the solution of problem 2, we can through the input, output of the corresponding relationship, the solution of problem 1. Thus we say that question 1 can be attributed to question 2.
6,NP complete Problem (np-complete):
There is such a problem that all NP problems can be attributed to this problem, then it is a np-complete problem. The satisfying problem is a NP complete problem, besides, the famous graph dyeing, Hamilton Ring, knapsack, peddler problem are NP complete problems.
5,np-hard:
Intuitively, P<=np<=np-complete<=np-hard, the difficulty of the problem increases. But at present can only prove that p belongs to NP, whether P=NP or P is really contained in NP is unknown.
Np-hard problems and Np-complete problems