NP 问题初识
2015-02-20 19:30
141 查看
为了正确理解P, NP, NP-complete和NP-hard,我特意准备中文和英文的解释,感觉读完以后,对NP的认识还是非常清晰的!
P: A decision problem that can be solved in polynomial time. That is, given an instance of the problem, the answer yes or no can be decided
in polynomial time.
NP 是 Non-deterministic Polynomial 的缩写(意思就是非确定性的多项式时间),NP 问题通俗来说是其解的正确性能够被很容易检查的问题,这里"很容易检查"指的是存在一个多项式检查算法。
NP: A decision problem where instances of the problem for which the answer is yes have proofs that can be verified in polynomial time.
This means that if someone gives us an instance of the problem and a certificate (sometimes called a witness) to the answer being yes, we can check that it is correct in polynomial time.
NP-complete 问题是所有 NP 问题中最难的问题。它的定义是,如果你可以找到一个解决某个 NP-complete 问题的多项式算法,那么所有的 NP 问题都将可以很容易地解决。
NP-complete: An NP problem
other NP problem
if we know how to solve
there is a polynomial time algorithm
instances
yes if and only if the answer to
NP-hard: Intuitively these are the problems that are even harder than the NP-complete problems. Note that NP-hard problems do not have
to be in NP (they do not have to be decision problems). The precise definition here is that a problem
that
problem in polynomial time, all NP-complete problems can be reduced to any NP-hard problem in polynomial time. Then if there is a solution to one NP-hard problem in polynomial time, there is a solution to all NP problems in polynomial time.
有了这些基本的认识以后,我们经常需要证明NP-complete问题,主要分为以下两步骤:
证明A 是NP, 即满足容易被检查这个性质
构造一个从某个已知的 NP-complete 问题 B 到 A 的多项式变换,使得如果 B 能够被容易地求解,A 也能被容易地解决。(即证明NP-hard)
对于证明一个问题是NP-hard,我们经常用到的一个technique是归约(reduction),
P<=Q,这个就表示P is reducible to Q or Q is the reduction from P or P is reduced to Q. P问题可以归约到Q问题。可以把P归约到Q。
这里的reduction的符号可以当成是 比较难易程度的小于等于号,意味着问题Q至少和问题P一样难。
当我们要证明一个问题是NP-hard的时候,我们通常要做的是找到一个NPC问题(就用这个代替NP-complete问题),把这个
NPC问题归约到NP-hard上去,即NPC<=NP-hard。
这里我们归约要做的主要步骤就是:
1.把NPC的input转化到NP-hard的input,即每一个NPC的input,实际上都是一个NP-hard的input。
2.把NP-hard的output转化到NPC的output上来,说明给我一个NP-hard的output,我就能给你一个NPC的output。
P: A decision problem that can be solved in polynomial time. That is, given an instance of the problem, the answer yes or no can be decided
in polynomial time.
NP 是 Non-deterministic Polynomial 的缩写(意思就是非确定性的多项式时间),NP 问题通俗来说是其解的正确性能够被很容易检查的问题,这里"很容易检查"指的是存在一个多项式检查算法。
NP: A decision problem where instances of the problem for which the answer is yes have proofs that can be verified in polynomial time.
This means that if someone gives us an instance of the problem and a certificate (sometimes called a witness) to the answer being yes, we can check that it is correct in polynomial time.
NP-complete 问题是所有 NP 问题中最难的问题。它的定义是,如果你可以找到一个解决某个 NP-complete 问题的多项式算法,那么所有的 NP 问题都将可以很容易地解决。
NP-complete: An NP problem
Xfor which it is possible to reduce any
other NP problem
Yto
Xin polynomial time. Intuitively this means that we can solve
Yquickly
if we know how to solve
Xquickly. Precisely,
Yis reducible to
Xif
there is a polynomial time algorithm
fto transform instances
yof
Yto
instances
x = f(y)of
Xin polynomial time with the property that the answer to
yis
yes if and only if the answer to
f(y)is yes.
NP-hard: Intuitively these are the problems that are even harder than the NP-complete problems. Note that NP-hard problems do not have
to be in NP (they do not have to be decision problems). The precise definition here is that a problem
Xis NP-hard if there is an NP-complete problem
Ysuch
that
Yis reducible to
Xin polynomial time. But since any NP-complete problem can be reduced to any other NP-complete
problem in polynomial time, all NP-complete problems can be reduced to any NP-hard problem in polynomial time. Then if there is a solution to one NP-hard problem in polynomial time, there is a solution to all NP problems in polynomial time.
有了这些基本的认识以后,我们经常需要证明NP-complete问题,主要分为以下两步骤:
证明A 是NP, 即满足容易被检查这个性质
构造一个从某个已知的 NP-complete 问题 B 到 A 的多项式变换,使得如果 B 能够被容易地求解,A 也能被容易地解决。(即证明NP-hard)
对于证明一个问题是NP-hard,我们经常用到的一个technique是归约(reduction),
P<=Q,这个就表示P is reducible to Q or Q is the reduction from P or P is reduced to Q. P问题可以归约到Q问题。可以把P归约到Q。
这里的reduction的符号可以当成是 比较难易程度的小于等于号,意味着问题Q至少和问题P一样难。
当我们要证明一个问题是NP-hard的时候,我们通常要做的是找到一个NPC问题(就用这个代替NP-complete问题),把这个
NPC问题归约到NP-hard上去,即NPC<=NP-hard。
这里我们归约要做的主要步骤就是:
1.把NPC的input转化到NP-hard的input,即每一个NPC的input,实际上都是一个NP-hard的input。
2.把NP-hard的output转化到NPC的output上来,说明给我一个NP-hard的output,我就能给你一个NPC的output。
相关文章推荐
- np问题初识
- 第一个 NP-complete 问题
- NP问题和NPC问题
- 初识SVN(六):“目标机器拒绝连接”的问题
- NP问题,最小顶点覆盖;主要是编程技巧;用了set,效率高,空间小,图用邻接表存储;
- 精通HADOOP(六) - 初识Hadoop - 解决问题/总结
- 寻NP难解问题的实例
- P P-C NP NP-C 以及图灵机问题
- 初识java遇到的问题!(解决)
- NP问题 笔记
- P=NP?问题简介
- NP问题
- 初识Symbian遇见的问题
- 初识SVN(五):使用SVN插件遇到的第一个问题
- NP完全问题
- NP问题和NPC问题
- 也谈NP问题
- 初识ExtJS---之使用Extjs框架引用的路径问题
- 东野圭吾小说中的P/NP问题
- 计算机调度算法 - NP-Hard问题 的 “背包问题” 的简单总结