Algo VC Lecture30
Algo VC Lecture30
1
Recap
2
Optimization & Decision Problems
Decision problems
– Given an input and a question regarding a problem, determine if the
answer is yes or no
Optimization problems
– Find a solution with the “best” value
Optimization problems can be cast as decision problems that are
easier to study
– E.g.: Shortest path: G = unweighted directed graph
Find a path between u and v that uses the fewest edges
5
Complexity Classes
A complexity class is the set of all of the computational problems which
can be solved using a certain amount of a certain computational resource.
The complexity class P is the set of decision problems that can be solved
by a deterministic machine in polynomial time. This class corresponds to
an intuitive idea of the problems which can be effectively solved in the
worst cases.
The complexity class NP is the set of decision problems that can be solved
by a non-deterministic machine in polynomial time. This class contains
many problems that people would like to be able to solve effectively. All
the problems in this class have the property that their solutions can be
checked effectively.
6
Complexity Classes (taxonomy)
Decision Problem
Decidable
PSPACE
PSPACE-Complete
Type 1 (context sensitive) NP
Co-NP
NP-Complete
P
P-Complete
Type 2 (context free)
7
Deterministic (Turing) Machine
Deterministic or Turing machines are extremely basic symbol-manipulating
devices which — despite their simplicity — can be adapted to simulate the logic of
any computer that could possibly be constructed.
They were described in 1936 by Alan Turing. Though they were intended to be
technically feasible, Turing machines were not meant to be a practical computing
technology, but a thought experiment about the limits of mechanical computation;
thus they were not actually constructed.
Studying their abstract properties yields many insights into computer science and
complexity theory.
Turing machines capture the informal notion of effective method in logic and
mathematics, and provide a precise definition of an algorithm or 'mechanical
procedure'.
8
Nondeterministic (Turing) Machine
11
Complexity Class NP-Complete
In complexity theory, the NP-complete problems are the most difficult
problems in NP ("non-deterministic polynomial time") in the sense that they
are the ones most likely not to be in P.
If one could find a way to solve any NP-complete problem quickly (in
polynomial time), then they could use that algorithm to solve all NP problems
quickly.
At present, all known algorithms for NP-complete problems require time that
is super polynomial in the input size.
To solve an NP-complete problem for any nontrivial problem size, generally
one of the following approaches is used:
– Approximation
– Probabilistic
– Special cases
– Heuristic
12
Complexity Class NP-Complete (cont)
14
Class of “P” Problems
15
Tractable/Intractable Problems
17
Examples of Intractable Problems
18
Intractable Problems
19
Nondeterministic and NP Algorithms
21
Hamiltonian Cycle
not
hamiltonian
22
Is P = NP?
P
P NP
The big (and open question) is whether NP P or P = NP
– i.e., if it is always easy to check a solution, should it also be easy to
find a solution?
problems in NP
Most practical problems turn out to be either P or NP-
complete.
Study NP-complete problems …
24
Summary
Decision problems
– Given an input and a question regarding a problem, determine if the answer is yes or no
Optimization problems
– Find a solution with the “best” value
NP-complete - means problems that are 'complete' in NP, i.e. the most difficult
to solve in NP
NP-hard - stands for 'at least' as hard as NP (but not necessarily in NP);
NP-easy - stands for 'at most' as hard as NP (but not necessarily in NP);
NP-equivalent - means equally difficult as NP, (but not necessarily in NP);
25
In next Lecture
26