Solution and Verification
Consider two
related problems:
● Given an instance of the traveling
salesperson problem, find a tour with a length of less than k
● Given an actual traveling salesperson, with
an actual route that he/she uses regularly, find out if it is a valid tour with a length less than k
An algorithm for
the first version is said to solve the TSP
An algorithm for
the second is said to verify a solution to TSP given a witness
(in this case, the tour provided by the actual salesperson).
The first problem involves finding a solution to the
traveling salesperson problem, given a set of locations and a maximum allowed
length for the tour. This problem is known as the traveling salesperson problem
(TSP), and an algorithm that can solve this problem is said to be able to find
a tour with a length less than k.
The second problem involves verifying a solution to the
traveling salesperson problem, given an actual tour provided by a salesperson.
In this case, the tour itself serves as a witness that can be used to verify
that it is a valid solution to the TSP (i.e., that it visits all locations
exactly once and has a length of less than k). An algorithm that can verify a
solution to the TSP given a witness is said to be able to verify a solution to
the TSP.
Solving the TSP involves finding a tour that satisfies the
conditions of the problem, while verifying a solution to the TSP involves
checking that a given tour satisfies the conditions of the problem. These are two
different tasks, and different algorithms may be used to perform each of them.
Solving the TSP may be more computationally expensive than verifying a solution
to the TSP, because it may require searching for a tour that satisfies the
conditions rather than simply checking a given tour to see if it satisfies the
conditions.
P, NP and Co-NP
We already know
about the class P. P is the class of problems that can be solved in polynomial
time.
The class P consists of problems that can be solved in
polynomial time, which means that the time complexity of the algorithm for
solving the problem is a polynomial function of the size of the input. This
means that the running time of the algorithm increases at most polynomially
with the size of the input, which makes these algorithms efficient and
well-suited for handling large inputs. Examples of problems in P include
sorting, searching, and matrix multiplication.
NP is the class of
problems whose yes instances can be verified in polynomial time, given a
suitable witness. The N in NP stands for nondeterministic and we shall
cover its meaning later.
The class NP consists of problems whose "yes"
instances can be verified in polynomial time, given a suitable witness. This
means that, for a "yes" instance of an NP problem, there exists a
proof or solution that can be used to verify that the instance is indeed a
"yes" instance, and this verification can be done in polynomial time.
However, it is not known whether a solution to an NP problem can be found in
polynomial time, so these problems are considered to be difficult to solve.
Examples of problems in NP include the traveling salesman problem and the
knapsack problem.
Co-NP is the class
of problems whose no instances can be verified in polynomial time, given
a suitable witness. Co just means the complement (or opposite, if you prefer).
The class co-NP consists of problems
whose "no" instances can be verified in polynomial time, given a
suitable witness. This means that, for a "no" instance of a co-NP
problem, there exists a proof or counterexample that can be used to verify that
the instance is indeed a "no" instance, and this verification can be
done in polynomial time. It is not known whether every "yes" instance
of a problem in co-NP has a polynomial time solution. co-NP is the class of
problems that are complementary to NP, meaning that a problem is in co-NP if
and only if its complement is in NP. For example, the problem of determining
whether a Boolean expression in conjunctive normal form (CNF) is a
contradiction is in co-NP, because its complement (determining whether a CNF
expression is satisfiable) is in NP.

No comments:
Post a Comment