Are there problem classes that have no good algorithms? How can ew prove it?
These are questions for complexity researchers.
Graph input size against computation time; if it can be bounded above by a polynomial (any polynomial will do), the algorithm is good.
^
| _ _
| _ a polynomial _
| _ _
| _ _-~
time | _ _- algorithm
req'd | _ - performance
| _ -
| _~ __-~
|__-~ _------~~~
|__---------~
+----------------------------------------------------->
bits required for input -->
A problem class is easy if a good algorithm exists for it. The set of easy problem classes is called P.
There is a much larger set of problem classes called NP.
+-----------------------------------------------------------------+
| ___________________________________________________________ |
| / ________________ \ |
| | / \ NP | |
| | | P | | |
| | | | . | |
| | | .ADDITION | PRIMALITY | |
| | | | | |
| | | | | |
| | | . | . | |
| | | ALL-PAIRS-PATHS| HAM-PATH | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | \________________/ | |
| \___________________________________________________________/ |
| |
+-----------------------------------------------------------------+
Problem class topology
Does P=NP?
Are there problem classes in NP which are not in P?
(We know P is a subset of NP.)
This is the biggest open question is computer science (and probably mathematics too).
We think not: P != NP. No proof yet, but we have evidence.
We do know this:
If HAM-PATH is in P, then P = NP.Problem classes with this property are called NP-hard. NP-hard problems in NP are called NP-complete.
+-----------------------------------------------------------------+
| ________________________________________________________ |
| / ________________ \ |
| | / \ NP | |
| | | P | _______________|___ |
| | | | . / | \ |
| | | .ADDITION | PRIMALITY | NP-hard | |
| | | | | | | |
| | | | | | | |
| | | . | | . | | |
| | | ALL-PAIRS-PATHS| | HAM-PATH | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | \_______________|___/ |
| | \________________/ | |
| \________________________________________________________/ |
| |
+-----------------------------------------------------------------+
Revised problem class topology
Many very important problem classes are NP-complete, so people have nonetheless worken on them very hard.
After 30 years, we haven't found that any are in P. Hence our confidence in the P != NP conjecture.
To show A is NP-hard, we reduce a known NP-hard problem class B to A. That is, we show taht a good algorithm for A implies a good algorithm for B. Since this would imply P = NP, it follows that A is NP-hard.
(This only works when we know of other NP-hard problems. Take my word they exist.)
We begin with the known NP-hard problem class VERTEX-COVER.
example:
*---o---o---*---o
\_ \_ | _/| _/
\ \|/ |/
o---o---o
\_____/
* represents the output set
We show that SET-COVER is NP-hard.
example:
______ / \ | ____|_______ | / o | o \ | \____|_______/ <---\ | ____|_______ > The optimal set cover | / o | o \ <---/ | \____|_______/ \______/
The NP-hardness proof:
a---b---c---d---e
\_ \_ | _/| _/
\ \|/ |/
f---g---h
\_____/
S = { a, b, c, d, e, f, g, h }
C = { {a, b, f}, {b, a, c, g}, {c, b, d, g}, {d, c, e, g, h},
{e, d, h}, {f, a, g, h}, {g, b, c, d, f, h}, {h, d, e, g} }
Problem class FACILITY-LOCATION
example:
x--1--o--1--o--1--x--1--*--2--x
\___ \_1_ |
1 \ \ | 1
o--1--*--1--o
\1
\
x
x represents the houses (elements of H)
* represents the optimal facility placement (the output)
The proof:
______ / C \ | ____|_______ | / b | A a \ | \____|_______/ <---\ | ____|_______ > The optimal set cover | / c | B d \ <---/ | \____|_______/ \______/
A C B
/ \ / \ / \
a b c d
All edges have length 1.
H = {a, b, c, d}
r = 1
Any solution can be changed to a SET-COVER solution (just covering the
set-vertices) by removing any house in the optimal cover and selecting
a non-house adjacent to it. A facility only covers that house, and that
house remains covered.