Introduction to Algorithms (Computational Complexity)

Def:

  • P = {problems solvable in polynomial time}
  • Exp = {problems solvable in exponential time}
  • R = {problems solvable in finite time}

Halting Problem:

Given a computer program, does it ever halt (stop)?

  • uncomputable (∈/ R): no algorithm solves it (correctly in finite time on all inputs)
  • decision problem: answer is YES or NO

Most Decision Problems are Uncomputable

  • program ≈ binary string ≈ nonneg. integer ∈ N
  • decision problem = a function from binary strings (≈ non-neg. integers) to {YES (1), NO (0)}
  • ≈ infinite sequence of bits ≈ real number ∈ R, |N| << |R|: no assignment of unique non-neg. integers to real numbers (R uncountable)
  • each program solves only one problem

NP

NP = {decision problems solvable in polynomial time via a "lucky" algorithm} The “lucky” algorithm can make lucky guesses, always “right” without trying all options.

  • nondeterministic model: algorithm makes guesses & then says YES or NO
  • guesses guaranteed to lead to YES outcome if possible (no otherwise)

In other words, NP = {decision problems with solutions that can be “checked” in polynomial time}. This means that when answer = YES, can “prove” it & polynomial-time algorithm can check proof

P != NP

Big conjecture (worth $1,000,000)

  • ≈ cannot engineer luck
  • ≈ generating (proofs of) solutions can be harder than checking them

Hardness and Completeness

Claim:

If P = NP, then Tetris ∈ NP - P

Why:

Tetris is NP-hard = “as hard as” every problem ∈ NP. In fact NP-complete = NP ∩ NP-hard

Similarly:

Chess is EXP-complete = EXP ∩ EXP-hard. EXP-hard is as hard as every problem in EXP. If NP != EXP, then Chess ∈/ EXP \ NP. Whether NP != EXP is also an open problem but less famous/“important”.

Reductions

Convert your problem into a problem you already know how to solve (instead of solving from scratch)

All the above are One-call reductions: A problem → B problem → B solution → A solution Multicall reductions: solve A using free calls to B — in this sense, every algorithm reduces problem → model of computation

NP-complete problems are all interreducible using polynomial-time reductions (same difficulty). This implies that we can use reductions to prove NP-hardness — such as in 3-Partition → Tetris

猜你喜欢

转载自blog.csdn.net/Da_tianye/article/details/81383185