NP is short for non-deterministic polynomial. In general, the correctness of its solution can be easily checked. Here, "Easy to check" refers to the existence of a polynomial check algorithm.
For example, the famous salesman traveling problem (Travel saleman problem or TSP): Suppose a salesman needs to depart from Hong Kong and pass through Guangzhou, Beijing, Shanghai ,....., and then return to Hong Kong. There is a direct flight between any two cities, but the fare is not equal. Now, let's assume that the company only pays $ C for reimbursement and ask if there is a schedule so that he can traverse all cities and the total fare is less
$ C?
The traveling problem of the salesman is obviously NP. because if you give a schedule at will, you can easily calculate the total travel expenses. however, if you want to know whether a trip with a total fare less than $ C exists, you must check all possible travel arrangements in the worst case! This will be an astronomical number.
NP-complete is the most difficult problem in all NP problems. It defines that if you can find a polynomial algorithm to solve a NP-complete problem,
All NP problems can be easily solved.
It is usually proved that a problem A is NP-complete and requires two steps,
The first step is to prove that a is NP, that is, satisfying the property that is easily checked. The second step is to construct a polynomial transformation from a known NP-complete Problem B to A, so that if
B can be easily solved, and a can also be easily solved. In this way, we need to know at least one NP-complete problem.
The first NP complete problem was the SAT problem, which was proved by Cook in 1971. the SAT problem refers to the fact that the given one contains N Boolean variables (only true or false) x1, x2 ,.., does the logical analysis paradigm of XN have a combination of values to satisfy the Analytical Paradigm? You can use a specific example to illustrate this problem. Suppose you want to arrange a dinner for 1000 people, with 10 people at each table and a total of 100 tables. the host gave you a piece of paper, which of the following are written:
People are not allowed to sit on the same table because of complaints from the rivers and lakes. Are there any banquet arrangements meeting all these constraints? This problem is obviously NP, because if someone suggests an arrangement, you can easily check whether it meets all constraints. Cook proves that this problem is NP-complete,
That is, if you have a good solution to the dinner arrangement problem, you can solve all NP problems.
This sounds very difficult, because you have to deal with all the NP problems, and now you don't know that any NP-complete problems can be exploited by. Cook.
Non-deterministic Turing Machine cleverly solves this problem.
Formally, NP problems are defined by non-deterministic Turing machines, that is, all problems that can be solved by non-deterministic Turing machines in polynomial time. A non-deterministic Turing machine is a special Turing Machine. Its definition captures the "easy to be checked" feature. the uncertain Turing machine has a magic conjecture component. As long as there is a solution to the problem, it can guess. for example, as long as there is even a way to meet the constraints of the dinner schedule, or a travel schedule that meets the travel budget, it can not escape its eyes, it can be instantly guessed. after guessing this solution, check that the validation part is exactly the same as a General deterministic Turing machine, that is, equivalent to any actual computer program.
Cook proved that any non-deterministic Turing Machine's computing process, that is, the process of first conjecture and then verification, can be described as a SAT problem, this SAT problem actually sums up the sum of all the constraints that the non-deterministic Turing machine must meet in the computing process (including the State transfer, data read/write methods, and so on, if you have a good algorithm that can solve the SAT problem, you can solve the non-deterministic Turing Machine computing problem, because every NP problem is just a non-deterministic Turing Machine computing problem, so, if you can solve this problem
Sat, you can solve all NP problems. Therefore, sat is a NP-complete problem.
With a NP-complete problem, the rest is easy to handle,
We don't have to deal with non-deterministic Turing machines every time, but we can use the two steps described above to prove other NP-complete problems. so far, thousands of NP-complete problems have been discovered,
They all have a property that is easy to check, including the salesman Travel problem described earlier. Of course, more importantly, whether they are easy to solve is the famous p vs np problem.