L22-23 (Simplex Example, Search Problems, P and NP) Flashcards
Describe the complexity classes of:
- P problems
- NP problems
Is one of them a subset of the other?
- P is the class of decision problems (problems with a yes or no answer) that can be solved by a deterministic Turing machine in polynomial time.
In other words, P is the class of all search problems that can be solved in polynomial time
- NP is the class of decision problems for which a proposed solution can be verified as correct or incorrect by a deterministic Turing machine in polynomial time.
In other words, NP is the class of all well-defined search problems
- P is a subset of NP, as problems solvable in polynomial time can also be verified in polynomial time. The open question is whether P equals NP or not.
A problem is NP-complete if it satisfies two conditions. What are they?
- It is in NP, meaning a proposed solution can be verified as correct or incorrect in polynomial time.
- Any problem in NP can be reduced to it in polynomial time, meaning it is at least as hard as the hardest problems in NP.
Under what case does P = NP?
If a problem takes polynomial time to be verified on a non-deterministic TM (problem is in NP) implies that one can build a deterministic TM which would solve the same problem also in polynomial time (problem is in P).
What does it mean for a problem to be NP-hard?
A problem is NP-hard if it is at least as hard as the hardest problems in NP.
It’s essential to note that NP-hard problems are not necessarily in NP themselves and may not have a polynomial-time verification algorithm.
What is a polynomial-time reduction?
A polynomial-time reduction is a transformation of one problem (A) into another problem (B) such that the transformation and its inverse both take polynomial time.
If problem A can be reduced to problem B in polynomial time, it implies that any solution for problem B can be used to solve problem A in polynomial time. Polynomial-time reductions are crucial in proving NP-completeness.
What’s the definition of a Search Problem?
What is the Decision Problem?
Search Problem: Given a problem instance “I”, find a solution “S” or determine that no such solution exists
Decision Problem: Given a solution “S”, verify that it is a valid solution to “I”
What does it mean for a search problem to be “Well-defined”?
Two things:
- S has a length (size) that is bounded by a polynomial relative to the input size
n
- There is a polynomial-time algorithm that takes as input “I” and “S” and can verify whether or not “S” is a solution to “I”
What is the traveling salesman problem? (TSP)
Given an undirected graph G = (V,E) along with edge lengths l,
find a tour (a cycle that visits each vertex) in G exactly once and that has the minimum length
What is the traveling salesman problem? (TSP)
Given an undirected graph G = (V,E) along with edge lengths l,
find a tour (a cycle that visits each vertex) in G exactly once and that has the minimum length
With TSP, there is a “optimization” problem variant and a “search” problem variant. What are they?
Optimization problem variant:
Find an optimized tour in G that visits each vertex exactly once and minimizes the length
Search problem variant:
Given a budget b > 0, find a tour that visits each vertex exactly once and has length <= b, or determine that no such tour exists
How does one prove that problem X is in NP-Complete?
- Show that X is in NP by demonstrating a polynomial-time verification algorithm for proposed solutions.
- Choose a known NP-complete problem Y.
- Demonstrate a polynomial-time reduction from problem Y to problem X, meaning any instance of problem Y can be transformed into an equivalent instance of problem X in polynomial time.
What’s the Hamiltonian cycle problem?
What category of NP completeness does it fall under?
Given an undirected graph (not necessarily complete), find a tour that visits each vertex exactly once - or determine that no such tour exists
This problem is NP-complete (no known polynomial-time algorithm can solve it)
What is a reduction?
A reduction is a transformation of one problem (A) into another problem (B) in such a way that a solution for problem B can be used to solve problem A.
Using reductions we can show that two problems are exactly the same, just stated in different ways - and can group together problems in NP
How would you define a reduction as a polynomial-time algorithm?
- A polynomial-time algorithm
f
that transforms any instancei
ofA
into instancef(i)
ofB
- A polynomial-time algorithm
h
that maps any solutionS
off(i)
back into a solutionh(S)
ofi
What are Hamiltonian cycle path reductions?
What is an example?
- Hamiltonian cycle path reductions are transformations of other problems into the Hamiltonian cycle problem.
- These reductions are instrumental in proving the NP-completeness of other problems.
- If a problem can be reduced to the Hamiltonian cycle problem in polynomial time, it is at least as hard as the Hamiltonian cycle problem.
- An example of a problem that’s reducible to the Hamiltonian cycle problem is the traveling salesman problem