Beruflich Dokumente
Kultur Dokumente
Complexity
Algorithm performance and difficulty of problems
So far we have seen problems admitting fast
algorithms
flow problems, shortest path, spanning tree...
and other problems for which we could not do
better than solving with less efficient algorithms
knapsack, TSP, integer programming...
Computing time
Why polynomial algorithms are better
O(f(n)) notation
Pseudopolynomial algorithms
Example: algorithm that solves the knapsack reducing
the problem to a shortest (longest) path on an acyclic
graph
O(nb) complexity
Polynomial in the input but not in the input size
(unless unary encoding is considered)
Classification of the problems
Problems in decision form: the expected answer is yes or no
Examples
connectivity problem
scheduling problem
SAT
How to deal with optimization problems?
Decision version of the problem: fix an additional
parameter k. Does there exist a solution with value ≤ k?
(for min problems)
If we are able to solve the decision version of the problem we
can solve efficiently also the optimization version by binary
search over k
Class NP
A problem P belongs to the class NP if
it is in decision form
it is certifiable in polynomial time
P ⊆ NP
Polynomial reduction
Let P and Q ∈ NP
Q ∈NP
thus P = NP
How can we prove that a problem is NP-complete?
Making the reductions from all NP problems
(even those which have not been conceived yet)
seems impractical