NP-Complete and approximate algorithms
Before understanding the NP-completeness, I would like to introduce the definition of science and pseudoscience. Where the practice can be tested, can be confirmed and be positive for the science, contrary to non-science, and pseudoscience is a subset of science, and science, and found that non-scientific science is pseudoscience. The three relations can be simplified as follows: Science is opposite to non-science, opposite to unscientific subset pseudoscience. The operations of the set are described below, scientifically defined as s, non-scientific defined as NS, and pseudoscience defined as FS.
The algorithm is used to solve the problem, whether a problem can be completed in polynomial time is the criterion to measure the complexity of the problem and the effectiveness of the algorithm. Polynomial time means that time complexity is a polynomial. For the problem solving algorithm, at its input scale, its worst run time is, where k is constant, then the problem is solvable in polynomial time. Obviously, many of the problems in reality are temporarily unable to find the polynomial time algorithm to solve, so, whether there is a polynomial time algorithm to define the complexity of the problem, the existence is solvable, and vice versa. In the study of the non-deterministic problem of polynomial complexity, NP concentration belongs to science, which can be confirmed and no positive.
The problem of judging and optimization is explained again. A decision problem is a method or a program or an algorithm that seeks to determine whether a particular property is found in a poor step, and the answer to that question can be answered by "whether" or not; the optimization problem is a feasible solution to obtain the best value under certain constraints and the input of certain parameter values. The value of the optimization problem is set to a bounds, which can be transformed into the related judgment problem.
A deterministic algorithm, such as a multi-item output, is a non-deterministic algorithm under a specific state input, such as an output that is uniquely determined. The non-deterministic algorithm decomposes the problem into two stages of guessing and validating, the guessing phase of the algorithm is nondeterministic, and the verification phase of the algorithm is deterministic, and it verifies the correctness of the solution during the guessing phase.
P-Class Problem (Polynomialproblem): The determinant problem of solvable in polynomial time.
NP class problem (nondeterministic polynomial): The problem of determining the time solvable of non-deterministic polynomial.
NPC class Problem (Npcomplete): It belongs to the NP problem, its complexity is consistent with the complexity of the whole class, one algorithm with polynomial time, all of which can be solved in polynomial time.
In layman's terms, the P-class problem is a problem that can be solved in many time, and the problems of solving it quickly are composed of: NP-type problem is the non-deterministic solvable in polynomial time, under the constraint input, the solution of polynomial time can be verified and the problem composition of the solution can be verified quickly. NPC problem is a set of NP problems that cannot find a solution in polynomial time. Obviously, p and NPC are subsets of NP, and P and NPC have no intersection, such as the following set relationship.
NPC problem of the qualitative more inclined to solve the problem or the complexity of the algorithm can not be quantified in the polynomial time, so the collection of such problems in the logical height of the formation of a sense of all, all is one of the thinking, a problem has solutions, all problems have solutions. For the non-deterministic algorithm of NP problem, there are many possibility guesses, but the result is correct or not, it can be proved that the problem of whether a solution is correct in polynomial time is NP problem, easy to verify the problem class.
From the problem of NP class, the most complex sub-class, NP-complete class, its theoretical significance lies in proving that P=np, as long as the intersection of the two, it proves that all the problems in NP class are P class, which is of practical significance for solving NPC problem. In the process of algorithm design and analysis, if it proves that a problem is NP-complete, it means to face hard problem, so for NP complete problem, find the best approximate algorithm, or define the specific requirements to find the polynomial time algorithm.
In fact, the combination of P, NP and NPC has proved that P=NP has not been established effectively with the solution of various problems and new problems. There is solution, no certainty, no solution, is the classification of the problem, the solution is P, if it can prove the solution of the NPC without solution, then the uncertainty has the solution of the NP is deterministic. What is undefined has a solution, can not prove that there is a solution, but if a solution could be quickly verified whether it is valid, where no solution is found in the NPC, and the NPC as long as there is a problem exists solution, all such problems have a solution, which is the definition of the attribution.
A2 is a polynomial time algorithm for judging the problem L2, and F is a polynomial time specification algorithm for calculating the statute function F.
Polynomial time algorithm A1 for determining problem L1. X belongs to the L1 problem, the X through F to the F (x), F (x) belongs to the L2 problem, if f (x) can be solved by the algorithm of polynomial time A2, then the decision problem X can be solved by polynomial time algorithm A1.
Conversely, the attribution is also used to prove that a problem is as difficult as any other problem within a polynomial time factor. The theorem is derived by attribution: If the problem of any NPC is to be solved in polynomial time, then P=NP. Equivalently, if any problem in NP is not polynomial time solver, then all NPC problems are not solved in polynomial. At present, the progress of theoretical research, the tendency p is not equal to NP, three sets of relations such as.
Since NPC problem exists, so that P=NP is not established, then the study of the problem of NPC has become the key to the problem of complex class. The general strategy is to solve the problem by solving the special case, using the dynamic programming method or the branch-bound method, solving by probabilistic algorithm, only approximate solution, and solving by heuristic method. The approximate algorithm is defined as follows:
If any input of size n, the cost of the solution generated by the approximate algorithm C and the cost of the optimal solution c* only one factor ρ (n) (approximate ratio, approximation ratio), then the algorithm is the ρ (n) approximation algorithm.
If the input size of the problem is N, there is a function ε (n), which is called ε (n) as the relative error bounds of the approximation algorithm. The performance of the approximate algorithm is obviously the following relationship between ρ (n) and the relative error bounded ε (n):.
To understand NPC and approximate algorithm, it is necessary to study the algorithm of the specific problem, such as traveling quotient problem, collection coverage problem, etc. The logic of the Turing stop problem is to understand.
Description of Turing stop problem: There is no program (or algorithm) that can calculate whether any program will end (down) on a given input. Use contradiction to prove:
1) Assuming that there is a universal program God_algo, you can determine whether any part of the program and its given input will end.
Boolgod_algo (char* program, char* input) {
if (<program> halts on <input>)
return true;
return false;
}
Obviously this program can know the result of any program ending, and if it can end it returns true, it cannot end to return false.
2) Now we add a program Satan_algo to invoke the Universal program God_algo:
Boolsatan_algo (char* program) {
if (God_algo (program, input)) {
while (1); Loop forever!
return false; can never get here!
}else returntrue;
}
The program returns the result output based on God_algo. Assuming that the input program A,god_algo determines that a program and its given input inputs can be stopped, the entry loop cannot exit and returns True if there is no downtime.
3) Satan_algo calls itself:
Satan_algo (Satan_algo) The result of the implementation is obviously the left and right contradiction.
Assuming Satan_algo can stop, GOD_ALGO returns to Ture, enters while loop, cannot stop;
Assuming the Satan_algo cannot be stopped, GOD_ALGO returns false and returns True, which can be halted.
4) Conclusion:
Satan_algo can stop =>satan_algo (SATAN_ALGO) It can't stop
Satan_algo can not stop =>satan_algo (SATAN_ALGO) it can stop
It is deduced that there is no such a universal program that can determine if any program can stop at a given input.
The greatness of science lies in the constant proof and proof that the greatness of scientists lies in the affirmation and negation of constant exploration, while thought and logic clearly play a fascinating role in this midst. Without thinking there is no logic, and no logical thinking does not exist the meaning of thinking, immersed in the sea of theoretical science, forget the trivial of technical engineering, is a kind of enjoyment, and the application of the search theory is a process of self-sublimation and proof. The foundation of modern information Science building is undoubtedly mathematics, but the computer science also enriches the mathematics theory, cannot forget the summary, the inference in the procedure embodies the shining spot, the Turing engine creation time, has now the shocking shaking, today the intelligence and the quantum Age's arrival, the Turing theory Foundation still applies. To continue to progress, perhaps only the theory of innovation, there are two times Turing theory, each theory of innovation has a long history of the application of empirical exploration, and then quantitative change, I believe this theoretical revolution is not far. Beyond Turing, breakthrough von Neumann system, is to give today's computer science theory researcher's mission, and as the forefront of technical engineering, is undoubtedly looking forward to participate, but the theoretical need for the mathematical foundation of non-specialization can not.
NP-Complete and approximate algorithms for the introduction of algorithms