Anda di halaman 1dari 27

Debasis Mitra, 2005

NP-COMPLETE PROBLEMS
Computers and Intractability: A Guide to the Theory of NP-Completeness, ichael !" Garey
and #a$id %" &onson, '"(" )reeman and Company, Ne* +or,, -./., I%0N: 1-/-2/--134-4"
0efore *e start: be reminded of our model of computation: all basic
operations ta,e unit time, *e ha$e infinite memory at the re5ister le$el, and
e$ery step is deterministic as described in the al5orithm"
A polynomial algorithm is faster than an exponential algorithm. As n
grows a
n
(exponential always grows faster than n
,
(polynomial,
i.e. for any !al"es of a an# ,, after n$ %ertain integer n
1
, it is tr"e that a
n
$ n
,
.
&!en 2
n
grows faster than n
'000
at some large !al"e of n. (he former
f"n%tions are exponential an# the later f"n%tions are polynomial.
)t seems that for some problems we *"st may not ha!e any polynomial
algorithm at all (as in the information theoretic bo"n#+ (he theory of ,-.
%ompleteness is abo"t this iss"e, an# in general the %omp"tational
%omplexity theory a##resses it.
Solvable Problems
/ome problems are e!en "nsol!able0 "n#e%i#able algorithmi%ally, so yo"
%annot write a %omp"ter program for them.
&xample. (altin5 problem1 2i!en an algorithm as inp"t, #etermine if it has
an infinite loop.
(here #oes not exist any general.p"rpose algorithm for this problem.
/"ppose (%ontra#i%tion there is an algorithm 3 that %an tell if any algorithm
4 halts or not, i.e., 3(4 s%ans 4 an# ret"rns (r"e iff 4 #oes halt.
(hen, write
P678: 99 7 is any input al5orithm to P
*hile 6(6788 : ;< 99 condition is true only *hen 7 terminates
return< 99 P terminates
=nd"
(hen, pro!i#e - itself as the inp"t 4 to the algorithm 5i.e., -(- 61 what
happens7+
3 %annot ret"rn (08 for inp"t -, there %annot exist s"%h 3.
)t is e9"i!alent to the tr"th !al"e of the senten%e This sentence is a lie.
Note 6-8, we are %onsi#ering Problems (i.e., for all instan%es of the problem
as oppose# to some instances of the problem. 8or some s"b.%ases yo" may
be able to sol!e the haltin5 problem, b"t yo" %annot ha!e an algorithm,
whi%h wo"l# sol!e the halting problem for A:: inp"t.
Different types of problems1 #e%ision problems, optimi;ation problems, <
De%ision problems1 ="tp"t is True9)alse.
De%ision -roblem >.$ %orrespon#ing optimi;ation problem.
&xample of 0.' >napsac, #ecision (?/D problem1
Input: ?/ problem @ a profit !al"e p
?utput: Answer the 9"estion A#oes there exist a Bnapsa%B with profit p7A
Algorithms are also inter.operable between a problem an# its %orrespon#ing
#e%ision problem.
/ol!e a ?/D problem >, "sing an optimi;ing algorithm1
Algorithm.=ptimi;ation.?/ (first part of > witho"t gi!en profit p ret"rn
optimal profit o
if po then ret"rn T!@= else ret"rn )AA%=.
/ol!e a ?/ problem N, "sing a #e%ision algorithm1
8or (o C /"m.of.all.ob*e%ts.profitD o$0D o C o . delta #o 00 #o a linear
sear%h, for a small delta
)f (Algorithm.De%ision.?/ (N, o then %ontin"e
&lse ret"rn (the last !al"e of o, before fail"re, in the abo!e stepD
&n#for. 00 a binary search wo"l# be faster++
Note 6B8, (he %omplexity theory is #e!elope# o!er #ecision problems, b"t
!ali# for other problems as well. Ee will often "se other types of problems
as examples.
NP-class of solvable problems
Deterministic alorithms are where no step is ran#om.
)f the program0algorithm %hooses a step non.#eterministi%ally (by some
extraneo"s infl"en%e to the algorithm+ s"%h that it is always the ri5ht
choice,
then s"%h an algorithm is %alle# non-!eterministic alorithm.
&xample, s"ppose a 0.' ?/ ba%Btra%B.algorithm always Bnows whi%h ob*e%t
to pi%B "p next in or#er to fin# an optimal profit.maBing Bnapsa%B+
)f one has a polynomial deterministic al5orithm for a problem (e.g., the
sorting problem, then the problem is %alle# a P-class problem.
An#, the set of all s"%h problems %onstit"te the P-class.
)f one has a polynomial non-deterministic al5orithm for a problem, then the
problem is %alle# a NP-class problem.
An#, the set of all s"%h problems %onstit"te the NP-class.
)t is impossible to %he%B for a problemFs being in ,-.%lass this way, be%a"se
non.#eterministi% algorithms are impossible to #e!elop, as #efine# abo!e.
/o, how %an one %he%B for polynomial %omplexity of s"%h non.existent
algorithms7
3owe!er, an e9"i!alent way of #e!eloping non.#eterministi% polynomial
algorithm is1
when a sol"tion to the problem is pro!i#e# (as if someone Bnows what the
sol"tion %o"l# be+,
then that proposed solution is %he%Be# by that algorithm in polynomial time.
/"%h a proposed solution is %alle# a %ertifi%ate to the inp"t problem.instan%e.
8or example1 in a ?/D problem, gi!en a %ertifi%ate ,napsac, content %he%B
if the total profit is p or not.
Gomplexity1 %al%"lation of total profit of the gi!en Bnapsa%B %ontent is worst
%ase =(n, for n ob*e%ts.
8or example1 for a 3amiltonian %ir%"it problem instan%e (find a cycle in a
5raph o$er all nodes but *ithout any node bein5 repeated in the cycle,
a path is gi!en as a %ertifi%ate.
An algorithm wo"l# go o!er the %ertifi%ate path an# %he%B if the first an# the
last no#es are same,
an# the rest of the path is simple (no no#e is %o!ere# twi%e,
then it will %he%B if all no#es in the graph are co$ered in the path,
an# then, %he%B if all the arcs in the path #o a%t"ally from the inp"t graph.
(his taBes polynomial time with respe%t to N an# =. 3en%e 3G is a ,-.%lass
problem.
(wo important points to note1
(' ,-.%lass problems are s"b.set of the %ol$able problems,
(2 -.%lass problems are s"b.set of ,-.%lass problems (be%a"se if yo" ha!e a
#eterministi% algorithm to sol!e any problem instan%e,
then that algorithm %an be "se# to %he%B any %ertifi%ate in polynomial
time also.
5DHAE /&(/6
-roblems belonging to the ,-.%lass ha!e at least exponential algorithms.
A relate# 9"estion is1 #oes there exist any sol!able problem that is not ,-7
Answer1 yes.
&xample1 non.3G problem (is there no (C in a gi!en inp"t graph #oes not
ha!e any polynomial non.#eterministi% algorithm.
)f a problem is in ,-.%lass its %omplement (negati!e problem as the non.3G
problem is is in Co-NP.
All Go.,- problems %onstit"te the Go.,- %lass of problems.
-.%lass is a s"bset of the interse%tion of ,- an# Go.,- sets.
An )M-=H(A,( 9"estion is1 %an we write a polynomial algorithm for
e$ery ,-.%lass problem7
(he answer is1 *e do not ,no*.
8rom a re!erse point of !iew, we wo"l# liBe to fin# an example problem that
is in the ,-.%lass an# whose information.theoreti% lower bo"n# is
exponential.
(hen, we wo"l# at least Bnow that - is a proper s"bset of ,-. Ee #o not yet
ha!e any s"%h example either.
All we Bnow now is that P NP.
I"estion remains1 (' - ,-7 or, - ,-7 5=ne sho"l# fin# %o"nter.
example(s6
=r, (2 ,- -, so that - C ,-7 5=ne sho"l# pro!e the
theorem6
NP-completeness
/"mmary1 Apparently some problems are har#er in a relati!e sense than
the other problems within the ,-.%lass of problems. )f yo" %an write
polynomial algorithm for any one problem in this gro"p of apparently har#
problems, then it %an be shown that e!ery ,-.%lass problem will ha!e a
polynomial algorithm for ea%h. (his gro"p of problems is %alle# NP-
complete problems.
(he se%ret lies in the fa%t that they are all %onne%te# to all NP-class
problems (+++ by #ire%te# %hains of polynomial transformations (explaine#
below.
Ee will explain polynomial transformations first an# then %ome ba%B to the
iss"e of ,-.%ompleteness.
Polynomial Transformation
Problem Transformation1 some algorithms whi%h taBe a #e%ision problem
4 (or rather A,J instan%e of the problem of type 4, an# o"tp"t a
%orrespon#ing instan%e of the #e%ision problem of type J, in s"%h a way that
if the inp"t has answer True, then the o"tp"t (of type + is also True an# !i%e
!ersa.
8or example, yo" %an write a problem transformation algorithm from C-%AT
problem to C#-atchin5 problem (will see later.
,ote that the problem transformations are #ire%te#.
Ehen a problem transformation algorithm is polynomial.time we %all it a
polynomial transformation"
&xisten%e of a polynomial transformation algorithm has a great sinificance
for the %omplexity iss"es.
/"ppose yo" ha!e (' a poly.transformation from a (so"r%e problem 4 to
another (target problem J,
an# (2 J has a poly algorithm, then
yo" %an sol!e any instan%e of the so"r%e problem 4 polynomially, by the
following metho#.
K"st transform any instan%e of 4 into another instan%e of J first, an# then
"se JLs poly.algorithm. Moth of these steps are polynomial, an# the o"tp"t
(T9) from JLs algorithm is !ali# for the so"r%e instan%e (of 4 as well.
3en%e, the True9)alse answer for the original instan%e of 4 wo"l# be
obtaine# in poly.time. (his %onstit"tes an in#ire%t poly.algorithm for 4, th"s
maBing 4 also belonging to the -.%lass.
=n%e again, note the !irection.
(+ou *ill be amaDed *ith ho* many practicin5 computer scientists 5et
confused *ith this direction+
Coo#$s theorem"
GooB mo#ele# all ,-.problems (an infinite set to an abstra%t ("ring
ma%hine. (hen he #e!elope# a poly.transformation from this ma%hine (i.e.,
all ,-.%lass problems to a parti%"lar #e%ision problem, namely, the
0oolean %atisfiability (%AT problem.
Sinificance of Coo#$s theorem1 if one %an fin# a poly.algorithm for /A(,
then by "sing GooBLs poly.transformation one %an sol!e all ,-.%lass
problems in poly.time (%onse9"ently, -.%lass C ,-.%lass wo"l# be pro!e#.
/A( is the first i#entifie# NP-hard problem+
%&rther sinificance of Coo#$s theorem1 if yo" fin# a poly.transformation
from /A( to another problem N, then N be%omes another ,-.har# problem.
(hat is, if anyone fin#s a poly algorithm for N, then by "sing yo"r poly.
transformation from /A(.to.N anyone wo"l# be able to sol!e any /A(
problem.instan%e in poly.time, an# hen%e wo"l# be able to sol!e all ,-.
%lass problems in poly.time (by GooBLs theorem.
(hese problems, whi%h ha!e a %hain of poly.transformation from /A(, are
%alle# NP-har! problems.
)f an ,-.har# problem also belongs to the ,-.%lass it is %alle# an ,-.
%omplete problem, an#
the gro"p of s"%h problems are %alle# NP-complete problems.
5DHAE /&(/6
Sinificance of NP-har! problems
As state# before, if one fin#s any poly.algorithm for any ,-.har# problem,
then
Ee wo"l# be able to write polynomial algorithm for ea%h of ,-.%lass
problems, or
,-.%lass C -.%lass will be pro!e# (in other wor#s, poly.algorithms wo"l# be
fo"n# for all ,-.%lass problems.
Onfort"nately, neither anyone %o"l# fin# any poly algorithm for any ,-.
har# problem (whi%h wo"l# signify that -.%lass C ,-.%lass,
nor anyone %o"l# pro!e an exponential information.theoreti% bo"n# for any
,-.%omplete problem, say : (whi%h wo"l# signify that : is in ,- b"t not in
-, or in other wor#s that wo"l# pro!e that -.%lass ,-.%lass. (he ,-.har#
problems are the best %an#i#ate for fin#ing s"%h %o"nter.examples. 5There is
a claim in %ummer B1-1 of a lo*er bound-proof of some NP-hard problem,
from I0 researchE6
As a res"lt, when we say a problem 4 (say, the ?/D problem is ,-.
%omplete all we mean is that
)8 one fin#s a poly.alg for 4, (3&, all the ,-.%lass problems wo"l# ha!e
poly algorithm.
Ee also mean, that it is O,:)?&:J that there wo"l# be any poly.algorithm
fo"n# for 4.
- ,- is a mathemati%al con'ect&re %"rrently (J&( to be pro!e# as a
theorem, see abo$e thou5h.
Mase# on this %on*e%t"re many new res"lts abo"t the %omplexity.str"%t"re of
%omp"tational problems ha!e been obtaine#.
,ote this !ery %aref"lly1 ,- (as yet in history #oes ,=( stan# for non.
polynomial.
5Also, note that ,-.%omplete problems #o ha!e sol"tions, b"t they are all
exponential algorithms, so far+ A %ommon st"#ent.mistaBe is to %onf"se ,-.
%omplete problems with "nsol!able problems.6
(here exist other hierar%hies. 8or example, all problems, whi%h nee#
polynomial memory.spa%e (rather than time form -/-AG& problems. -oly.
time algorithm will not nee# more than poly.spa%e, b"t the re!erse may not
be ne%essarily tr"e. Answer to this 9"estion is not Bnown. (here exists a
%hain of poly.transformations from all -/-AG& problems to the elements of
a s"bset of it. (hat s"bset is %alle# P%PAC=-complete. -/-AG&.%omplete
problems may lie o"tsi#e ,-.%lass, an# may be har#er than the ,-.%omplete
problems. &xample1 Fuantified 0oolean )ormula (first.or#er logi% is
-/-AG&.%omplete.
NP-completeness( %)*
(following 8AI may repeat information from abo!e
Why prove a problem to be NP-hard?
/o that, (a one #oes not ha!e to spen# reso"r%es on fin#ing o"t a
polynomial algorithm for the problem, an# (b other problems %o"l# be
pro!e# to be ,-.har# by "sing this problem.
When to attempt such a proof?
Ehen polynomial algorithms are not fo"n# after p"tting reasonable amo"nt
of efforts, or base# on other int"itions it appears that the problem in 9"estion
may be ,-.har#.
What are the steps in proving a problem to be NP-complete?
8irst, try to pro!e it to be ,-.har#, by (' fin#ing a relate# problem whi%h is
alrea#y fo"n# to be ,-.har# (%hoosing s"%h a s"itable Aso"r%eA problem
%lose to yo"r AtargetA problem, for the p"rpose of #e!eloping poly.trans, is
the most #iffi%"lt step, an# then (2 #e!eloping a tr"th.preser!ing
polynomial problem.transformation from that so"r%e problem to yo"r target
problem (yo" will ha!e to show the transformation.algorithmLs ('
%orre%tness an# (2 poly.time %omplexity.
/ignifi%an%e1 if anyone fin#s poly algorithm for yo"r target problem, then
by "sing yo"r poly.trans algorithm one wo"l# be able to sol!e that so"r%e
,-.har# problem in poly.time, or in other wor#s - wo"l# be C ,-.
5,ote, tr"th.preser!ation in poly.transformation worBs only for #e%ision
problems, for other type of problems yo" may ha!e to first #e!elop a
%orrespon#ing #e%ision problem, whose algorithm %o"l# be "se# for sol!ing
the original non.#e%ision problem (e.g., ?napsa%B has %orrespon#ing
?napsa%B.#e%ision problem.6
/e%on#, try to pro!e that the gi!en problem is in ,-.%lass1 by #e!eloping a
polynomial algorithm for %he%Bing any A%ertifi%ateA of any problem.
instan%e.
Does there exist any short-cut for proving NP-hardness?
Jes. A%t"ally, many.
&xample1 taBe a simpler (restri%te# !ersion of yo"r problem an# pro!e it to
be ,-.har#, then the har#er original problem is a"tomati%ally pro!e# to be
,-.har# (again, note the #ire%tion %aref"lly.
/ay, pro!e P./A( problem to be ,-.har#, then the generali;e# /A( problem
wo"l# be a"tomati%ally ,-.har#.
+hat is the sinificance of a poly-transformation from a problem X
,-here only e.ponential alorithm is available c&rrently/ to a P-class
problem Y ,polynomial alorithm is available/
(his intro#"%es a new in#ire%t polynomial algorithm for 7.

o! to react if someone claims to have a polynomial algorithm for an NP-
hard problem?
Jo" %o"l# go thro"gh a %he%Blist as follows1
(a 8irst %he%B the %orre%tness of the algorithm for any problem instance, it
may be a%t"ally maBing some ass"mption for the inp"t, th"s restri%ting inp"t
types Q in other wor#s, it is an approximate algorithm ()f the algorithm is
%orre%t, then
(b %he%B if its asymptoti% %omplexity is really polynomial or not, (if
polynomial an# not e!en pse"#o.polynomial, then
(% %he%B the ,-.har#ness proof of the problem, by !erifying the problem
transformationLs %orre%tness, that has been "se# in s"%h a proof,
(# %he%B if the abo!e transformation is really polynomial in %omplexity or
not, (if %orre%t, then
(e %he%B if the so"r%e problem that was originally %hosen for the abo!e
proof is really an ,-.har# problem or not, >>an# its ba%B.%hain of poly.
transformations to the /A( problem$$
6f8 if all the abo$e chec,s succeed, then accept that PGNP has been pro$ed
and recommend the claimant for the Turin5 a*ardEEE
o! to deal !ith a problem once it is proved to be NP-hard?
)t is unli"ely that there wo"l# be any polynomial algorithm for sol!ing the
problem in 9"estion. /o, yo" %o"l# taBe one of the following approa%hes
(TAP=1
,T/ 8in# if there exists a Atra%tableA s"b.problem, whi%h is realisti% eno"gh
for yo"r appli%ation, an# for whi%h one %an #e!elop a polynomial algorithm.
5&xample1 (he minim"m.tar#y tasB.s%he#"ling problem with ea%h tasB.
#"ration ass"me# to be one "nit of time, an# the gree#y polynomial
algorithm for it. Another example1 2./A(6
,)/ /ee if an approximate sol"tion to the problem is goo# eno"gh for the
appli%ation, when s"%h an approximate answer %o"l# be fo"n# o"t with a
polynomial algorithm. 5&xample1 (he m"lti.pro%essor s%he#"ling problemFs
gree#y polynomial algorithm with a bo"n#e# s"b.optimal sol"tion.6
,P/ /ee if a pse"#o.polynomial algorithm wo"l# worB (e.g., 0.' ?napsa%B
problemFs #ynami% programming algorithm, or see if one %o"l# impro!e
"pon an exponential.algorithm thro"gh some pr"ning or other he"risti%s
s"%h that the algorithm worBs fast eno"gh for pra%ti%al inp"t (as in the "se of
bo"n#ing f"n%tions in the ba%Btra%Bing algorithms, or the "se of bran%h an#
bo"n# te%hni9"es there.
,E/ )f yo" ha!e #e!elope# an exponential algorithm an# yo" thinB that it
worBs 9"ite effi%iently on AmostA of the inp"t instan%es of yo"r #omain, then
yo" may liBe to *"stify yo"r %laim by #oing some experiments with yo"r
algorithm. /ome ran#omi;e# algorithms fall into this %ategory of approa%h.
E0)MPLE O% ) POL1NOM2)L TR)NS%ORM)T2ON
(S)T to 3-S)T
S)T Problem4 or Boolean Satisfiability problem
&xample,
(' A set of Moolean !ariables, O C Ra, b, %S. (2 A (%on*"n%ti!e set of
clauses ea%h %onsisting of a (#is*"n%ti!e set of literals (a !ariable or its
negation, G C RRa, bS, RTa, TbS, Ra, %S, RTa, T%SS. (P I"estion1 #oes there
exist any set of assignments for the !ariables s"%h that the %la"se is (r"e. A
%la"se is (r"e if the assignment maBes at least one literal tr"e in the %la"se.
="tp"t1 An answer1 yes9no (#e%ision problem.
Answer to the abo!e problem instan%e1 +es (for aC(, bC8, an# %C8.
A ba%Btra%Bing algorithm for sol!ing /A( is easy to #e!ise. 5DHAE A
MAG?(HAG? (H&&61
Eorst.%ase %omplexity7
%AT is in NP-class1 gi!en a %ertifi%ate tr"th assignment yo" %an tri!ially
%he%B if it lea#s to the Jes answer or not, an# yo" %an #o that in linear
time =(n, m, for n n"mber of !ariables, m n"mber of %la"ses.
%AT is NP-hard1 GooBLs theorem.
#-S)T problem1 ,"mber of literals in ea%h %la"se in the /A( problem is
limite# to ,, where , is ob!io"sly an integer.
)t is not "nreasonable to expe%t that ,-%AT, for a %onstant integer ,, to be
possibly a -.%lass problem+ ?./A( is restri%te# !ersion of /A(.
B-%AT problem is in#ee# P-class1 Da!is.-"tnam algorithm %an fin# an
assignment of !ariables in polynomial time, always (for all problem
instan%es, when ,C2.
0@T,
3-S)T is NP-har!
(he %hosen so"r%e problem, whi%h is alrea#y pro!e# to be ,-.har#, is the
/A( problem itself. 5,ote, P./A( is an easier restri%te# !ersion of the /A(
problem.6
(ransformation from )N1 instan%e of /A( to a #eri!e# instan%e of P./A( is
gi!en below.
Glassify /A( %la"ses into U gro"ps1 '.%la"ses, 2.%la"ses, P.%la"ses, an# p.
%la"ses with p$P literals in these %la"ses.
Ee will (' show transformations (to the %orrespon#ing P.%la"ses for ea%h
of these U types of %la"sesD
(2 pro!e that the transformations are %orre%t, i.e., tr"th preser!ingD an# then
(P we will #is%"ss the polynomial nat"re of the aggregate.transformation at
the en#.
5-cla&ses1
/ay, R"S, where " is a literal (not *"st a !ariable, b"t a !ariable or its
negation.
(he %orrespon#ing P.%la"ses (for the target P./A( problem will nee# two
a##itional !ariables, say, ;', ;2.
(he #eri!e# P.%la"ses are1 R", ;', ;2S, R", T;', ;2S, R", ;', T;2S, R", T;',
T;2S.
All these P.%la"ses %an be (r"e only if u is (r"e an# !i%e !ersa (hen%e this is
a %orre%t transformation.
6-cal&ses(
/ay, R"', "2S.
(he %orrespon#ing P.%la"ses (for the target P./A( problem will nee# one
a##itional !ariable, say, ;.
(he #eri!e# P.%la"ses are1 R"', "2, ;S, R"', "2, T;S.
Moth the P.%la"ses %an be True only if either of "' or "2 is T (i.e., the so"r%e
%la"se in the so"r%e /A( problem instan%e, an# !i%e !ersa. 3en%e this is a
%orre%t transformation.
3-cal&ses(
/ay, R"', "2, "PS.
K"st %opy them to the target problem instan%e, they are alrea#y P.%la"ses.
p-cal&ses(
/ay, R"
'
, "
2
, <, "
B.'
, "
B
, "
B@'
, <, "
p
S, where 'Bp.
Greate the following P.%la"ses (for the target P./A( problem1
R"
'
, "
2
, ;
'
S, RT ;
'
, "
P
, ;
2
S, RT ;
2
, "
U
, ;
P
S, <,
RT;
B.P
, "
B.'
, ;
B.2
S, RT ;
B.2
, "
B
, ;
B.'
S, RT ;
B.'
, "
B@'
, ;
B
S, <, RT;
p.P
, "
p.'
, "
p
S.
(his nee#s %reation of a##itional (p.P !ariables1 ;
'
, ;
2
, <, ;
p.P
.
)n or#er for the source 6%AT8 p-clause to be True, at least one of the literals
u
-
, H, u
p
has to be tr"e. Eitho"t any loss of generality ass"me that the True
literal to be u
,
. Ee #o not %are if more literals are True, ass"me all the rest to
be )alse.
(hen the following assignment of new !ariables (DLs (along with u
,
C( will
maBe all the #eri!e# P.%la"ses True1
;
'
C(, ;
2
C(, <., ;
B.P
C(4 ;
B.2
C(, ;
B.'
C8, <, ;
p.P
C8. 5G3&G? )(6
3en%e, if the so"r%e p.%la"se has a True assignment, so #o all the #eri!e#
%orrespon#ing P.%la"ses.
,ote that the %onstr"%tion algorithm #oes not %are abo"t whi%h literal is
really True.
Assume the source p-clause to be )alse, i.e., none of the literals u
-
, H, u
p
is
True. (ry any set of assignments for the new !ariables (DLs, at least one
%la"se will always remain )alse, yo" %annot maBe all of them True *"st by
assigning the new !ariables.
(ry one s"%h assignment1 /"ppose, ;
-
C( (in or#er to maBe the first #eri!e#
P.%la"se True,
then D
B
sho"l# be C (, an# then ;
C
C(, <., D
p-C
C( (in or#er to maBe the last.
b"t.one #eri!e# P.%la"se True,
b"t that maBes the :A/( #eri!e# P.%la"se )alse.
(ry any other %ombination of assignments, yo" will always r"n into the
same problem Q at least one deri$ed clause *ill become false, be%a"se that is
how the #eri!e# P.%la"ses are %onstr"%te#+
3en%e, the transformation.s%heme for the p.%la"ses is truth-preser$in5, or
the algorithm is correct.
Comple.ity of the transformation alorithm(
/ay, the n"mber of so"r%e (/A( '.%la"ses is B
'
, 2.%la"ses is B
2
, P.%la"ses is
B
P
, an# p.%la"ses are B
p
(#epen#ing on the !al"es of p.
(hen, the n"mber of !ariables %reate# in the target P./A( problem instan%e
wo"l# be C n @ 2B
'
@ B
2
@
p
5(p.PB
p
6.
(he n"mber of #eri!e# P.%la"ses wo"l# be C UB
'
@ 2B
2
@ B
P
@
p
5(p.2B
p
6.
(he total n"mber of steps in %reating the new !ariables an# the new P.
%la"ses are the s"m of these two polynomials, hen%e a polynomial with
respe%t to the inp"t problem si;e (V!ariables an# V%la"ses in the so"r%e /A(
problem instan%e.
(h"s, we ha!e a %orre%t (tr"th preser!ing W polynomial problem
transformation algorithm from any /A( problem instan%e to a %orrespon#ing
P./A( problem instan%e C$ 3-S)T is NP-har! (gi!en the fa%t that /A( is
,-.har#.
/in%e we ha!e shown before that /A( is in ,-.%lass, P./A( is ob!io"sly in
,-.%lass. (his %on%l"#es the proof that 3-S)T is NP-complete.
Inter$al Temporal !easonin5 Problem is NP-hard
Masi% Helations between -airs of )nter!als (M1
Minary
operator
Helation type &xample Hepresentation
b before A(pM
Tb before in!erse A(TpM
o o!erlap A(oM
To o!erlap
in!erse
A(ToM
# #"ring A(#M
T# #"ring in!erse A(T#M
Minary
operator
Helation type &xample Hepresentation
m meet A(mM
Tm meet in!erse A(TmM
s start A(sM
Ts start in!erse A(TsM
f finish A(fM
Tf finish in!erse A(TfM
A
M
A
M
A
M
A
M
A
M
A
M
A
A
A
M
A
M
A
M
A
M
A
M
A
M
A
M A
A M
M A
A
A
M
A
M
M
M
A
M
A
A
M
A
M
M
M
A
Minary
operator
Helation type &xample Hepresentation
e9 e9"al M(e9A
I(G,1 A Iualitati$e temporal-constraint net*or, (I(G, is a graph GC(J, =, where ea%h no#e is an
inter!al, an# ea%h #ire%te# labele# e#ge ($- (! $B,= represents #is*"n%ti!e %onstraint ! from $- to $B J,
where ! 2
0
.
)(H -roblem1 2i!en a I(G, #oes there exist an assignment for ea%h no#e on the time.line s"%h that all the
%onstraints are satisfie#.
&xample1 I(G,5J C Ri', i2, iPS, = C R(i' (pXo i2, (i' (m iP, (i2 (oXa iPS6. Answer to )(H1 Jes. Draw
i', i2 an# iP on timeline in s"%h a way that i' o!erlaps i2 an# meets iP, while i2 o!erlaps iP.
)(H is ,-.har#1 transform arbitrary P./A( problem to the %orrespon#ing )(H problem.
:et, the inp"t P./A( problem is G C R(li', li2, liP X i C ', <, mS, i in#i%ates the %la"se, liB in#i%ates B.th
literal in the i.th %la"se.
Greate an inter!al %alle# spl. Greate an inter!al )i* for ea%h literal li*. )magine left of spl will ha!e the (r"e
literals (when the P./A( is assigne# an# right of spl will %ontain the 8alse literals. All three literals of a
%la"se %an be on the left of spl b"t not more than two %an be on the right, when the inp"t %la"se is satisfie#
by the assignment. (his is the tri%B in %reating inter!al relations.
8irst, fix the inter!als so that they %an be on either si#e of spl b"t not on both the si#e, with a %onstraine#
en# point1
8or all iC',..,m an# *C', 2, P
)i* (mXTm spl.
(hen the other %onstraint, for ea%h %la"se i C '..m,
)i' (f X Tf X s X p X Tp )i2
)i2 (f X Tf X s X p X Tp )iP
)iP (f X Tf X s X p X Tp )i'
8inally, we want to maBe s"re that when two literals appear with opposite sign in #ifferent %la"ses, their
%orrespon#ing inter!als go on #ifferent si#es of the inter!al spl.
8or ea%h li* C Tlgh, a %onstraint
)i* (p X Tp )gh
(his %onstr"%tion ens"res that if the so"r%e P./A( is satisfiable one %an easily satisfy the generate# )(H.
3owe!er, if the so"r%e P./A( is "nsatisfiable (at least on %la"se, say, GB is "nsatisfiable by any gi!en
assignment, then the %orrespon#ing inter!als in the )(H %annot be assigne# as all the three inter!als for
that %la"se will try to be on the 8alse si#e, whi%h is impossible as per the %onstr"%tion (YsL relationLs in!erse
is absent th"s, %reating a %y%le o!er the inter!als )B', )B2, an# )BP.
M
A
3D Matchin is NP-complete
6DM Problem1 (wo finite sets of in#i!i#"als of e9"al %ar#inality1 M C Rm',
m2, < mBS, 8 C Rf', f2, <, fBS. A set of a%%eptable pairs of in#i!i#"als
from the two gro"ps1 A C R(fi, m*, ' i,* BS C R(fP, m', (f5, m', (fP,
m2, (fZ, m2, <S.
Fuestion1 Does there exist a mat%hing set of t"ples AL within A (s"bset of A
s"%h that e!ery in#i!i#"al is in a t"ple in AL on%e an# only on%e. (he
%ar#inality of AL will be B, if it #oes exist.
3DM Problem1 P sets (or AtypesA of in#i!i#"als, 4, J, E, with same
%ar#inality. &a%h element in A is a P.t"ple, A C ((x
i
, y
*
, w
l
, ' i, *, l BS
from those three sets.
Fuestion1 similar as abo!e (#oes there exist a mat%hing s"bset AL within A.
3DM is NP-class1 2i!en a mat%hing set AL one has to %he%B1 (' &!ery
in#i!i#"al is %o!ere# or notD (2 Any in#i!i#"al is %o!ere# twi%e or not. )t
%an be #one in polynomial time 11 %he%B in a PD %oor#inate system.
3DM is NP-har!( Polynomial transformation from 3-S)T to 3DM
/o"r%e P./A( -roblem1 [ariables OCR"
'
, "
2
, <, "
n
S, P.Gla"ses GCR%
'
, %
2
,
<, %
m
S.
Ee ha!e to %onstr"%t P sets of in#i!i#"als 4, J, an# ED an# a set of triplets A
from them. Truthfulness property needs to be preser$ed. (ransformation
algorithm m"st be polynomial with respe%t to n"mber of !ariables an#
%la"ses in the inp"t P./A( problem.
P types of triplets in A1 Atr"th.setting an# fan.o"t,A Asatisfa%tion testingA (of
so"r%e P./A(, an# Agarbage %olle%tionA (to maBe s"re e!erybo#y is %o!ere#
in the target PDM instan%e.
(r"th.setting @ 8an.o"t %omponents of A1
In each clause each $ariable may appear only once 6as Positi$e or as
Ne5ati$e8
8or ea%h !ariable "
i
(' i n an# ea%h %la"se %
*
(' * m1 two sets of
triplets in A1
(
pos\i
C R ("
i
5*6, a
i
5*6, b
i
5*6 1 ' * mS
(
neg\i
C R ("
i
5*6, a
i
5*@'6, b
i
5*6 1 ' * > mS @ R ("
i
5m6, a
i
5'6, b
i
5m6S
aFs are in 4 (m, an# bFs are in J (m, "Fs an# "Ls are in E (2m.
8or e!ery !ariable "
i
, the mat%hing will ha!e to pi%B "p exa%tly m triplets
from A (o"t of 2m, for AL, #epen#ing on whether "
i
is assigne# True ((
pos\i

or )alse ((
neg\i
. 58)2OH& below from 2arey an# KohnsonLs booB6
Total n&mber of triplets 7 6mn
=ne s"%h %hain for ea%h !ariable.
/atisfa%tion.testing %omponents of A1
A triplet for ea%h literal in ea%h %la"se (3m in n&mber, this is where we
nee# P./A( (or a B./A(, for a fixe# integer B, as a so"r%e problem, as
oppose# to the general /A( problem . in the later %ase this n"mber may not
remain polynomial.
8or ea%h %la"se %
*
three triplets (%orrespon#ing to three literals in it1
G* C R either ("
i
5*6, s
a
5*6, s
b
5*6 if T"
i
is in %
*
, or ("
i
5*6, s
a
5*6, s
b
5*6 if "
i
is in
%
*
S.
G*Ls are %omponents within A.
Ehen the inp"t0so"r%e P./A( has a satisfying assignment, the !ariable " (or
" %orrespon#ing to the True literals will not ha!e mat%h as per pre!io"s
%onstr"%tion (with aLs an# bLs, an# hen%e this %onstr"%tion G* will get them
mat%he# with %orrespon#ing s56Ls. =n the other han# if a %la"se has all its
literals )alse, e!ery " (or " in the %orrespon#ing G* is mat%he# alrea#y in
the pre!io"s %onstr"%tion, b"t if yo" #o not pi%B "p from G*, then the
%orrespon#ing sLs remain "nmat%he#.
2arbage %olle%ting %omponents of A1
To 5et those indi$iduals *ho are still not matched in A: not all $ariables
occur in e$ery clause, but the correspondin5 uKs are created any*ay
(wo sets of triplets in A for ea%h !ariable "
i
an# ea%h %la"se %*1
2 C R("
i
5*6, g
a
5B6, g
b
5B6, ("
i
5*6, g
a
5B6, g
b
5B6 1 ' >C B >C m(n.', ' >C i >C n,
' >C * >C mS.
=ne set per B, B r"ns "p to m(n.'. Total triplets ,6mn/"m,n-5/"
8or the "Ls (or "Ls that are not in AL (or, not in A777.
/ets of in#i!i#"als1
E C R"
i
5*6, "
i
5*6 1 'in, '*mS, 6mn in n"mber
4 C Aa @ /' @ 2'
Aa C Ra
i
5*6 1 'in, '*mS, mn
/a C Rs
a
5*6 1 '*mS, m
2a C Rg
a
5B6 1 'Bm(n.'S, m(n.'
(otalC6mn
J C Mb @ /2 @ 22
Mb C Rb
i
5*6 1 'in, '*mS, mn
/b C Rs
b
5*6 1 '*mS, m
2b C Rg
b
5B6 1 'Bm(n.'S, m(n.'
(otalC6mn
Polynomial constr&ction1
Vin#i!i#"als @ Vtriplets C ]mn @ (2mn @ Pm @ 2(m
2
n(n.'
Correctness1
)f G is not satisfiable AL %annot be %onstr"%te#. )f AL is %onstr"%te#, then the
triplets in AL %orrespon#ing to the s'Ls an# s2Ls are the tr"th.setting
%omponents, maBe the %orrespon#ing literals " or "Ls from those triplets
True, there is no way the same !ariable will get m"ltiple %onfli%ting
assignments by this.
)f G is satisfiable1
/ay, there exists an assignment for ea%h "
i
(True, or )alse whi%h maBes G
True.
8or %onstr"%ting AL1
Ghoose a literal from ea%h %la"se that is True (one m"st exist, an# fin#
%orrespon#ing triplet from the /atisfa%tion.testing %omponents, for marrying
ea%h %orrespon#ing s' an# s2.
Depen#ing on if "
i
is True or )alse %hoose the set (
pos\i
or (
neg\i
, to marry
off aFs an# bFs.
-i%B "p appropriate triplets from 2 to taBe %are of g
a
Fs an# g
b
Fs, for those "
'
Fs
an# "
2
Fs who are still "nmarrie#.
(h"s, AL %an be %onstr"%te#, from the so"r%e P./A(Fs !ariable assignments.
An =Lample *ith %AT-MC# trans:
C-%AT1 !ar1 ("', "2, "P, %la"se1 R("', T"2, "PS
C#1
(r"th setting %onstr"%tion1
A triplets1 Onmat%he#
in#i!i#"als1
(pos'C(T"'', a'', b'' (neg'C("'', a'', b'' ECRT"'',
"'', T"2', "2', T"P', "P'S
(pos2C(T"2', a2', b2' (neg2C("2', a2', b2' 4CRa'',
a2', aP'S
(posPC(T"P', aP', bP' (negPC("P', aP', bP' JCRb'',
b2', bP'S
AL mat%h set for sat assignment (say, for "'C(, "2C( an# "PC8 in
so"r%e.P/A( problem1
R(T"'', a'', b'', (T"2', a2', b2', ("P', aP', bP'S
Onmat%he# in#i!i#"als left after this1
ECR"'', "2', T"P'S, 4CRnoneS, JCRnoneS
/atisfa%tion testing %onstr"%tion1
A triplets1 Onmat%he#
in#i!i#"als1
G'CR("'', sa', sb', (T"2', sa', sb', ("P', sa', sb'S ECR"'',
"2', T"P'S
4CRsa',
sa2S, JCRsb', sb2S
AL mat%h set for tr"th setting of the %la"se, say, by "'C(1
R("'', sa', sb'S
Onmat%he# in#i!i#"als left after this1
ECR"2', T"P'S, 4CRnoneS, JCRnoneS
2arbage %olle%tion0 %reate new in#i!i#"als to mat%h all1
A triplets1 Onmat%he#
in#i!i#"als1
2CR (T"'', ga', gb', ("'', ga', gb', ECR"2',
T"P'S
(T"2', ga', gb', ("2', ga', gb', 4CRga',
ga2S
(T"P', ga', gb', ("P', ga', gb', JCRgb',
gb2S
(T"'', ga2, gb2, ("'', ga2, gb2,
(T"2', ga2, gb2, ("2', ga2, gb2,
(T"P', ga2, gb2, ("P', ga2, gb2S
'>CB>C'(P.', '>Ci>CP, '>C*>C'D
AL mat%h set for tr"th setting of the %la"se, say, by "'C(1
R("2', ga', gb', (T"P', ga2, gb2S
Onmat%he# in#i!i#"als left after this1
ECR,oneS, 4CRnoneS, JCRnoneS
=nd eLample"
Jo" may liBe to try with a "nsatisfiable so"r%e P./A(1
R", !, wS, R", !, TwS,R", T!, wS,R", T!, TwS,
RT", !, wS, RT", !, TwS,RT", T!, wS,RT", T!, TwS.
(aBe "C!CwC( that maBes the last %la"se )alse. (ry to %reate triplets in A
for that %la"se an# see why yo" %annot %reate mat%h for %orrespon#ing saLs
an# sbLs %reate# in the (r"th.setting %omponent of the %onstr"%tion.
Reasonin -ith Car!inal-!irections alebra
Problem !efinition(
)np"t1 A set of points [, an#
a set & of binary relations between some pairs of points in [, !
i
H
i*
!
*
where
H
i*
is a #is*"n%ti!e s"bset of the set of nine basi% relations R&9, &ast, <S in
Gar#inal #ire%tions.%al%"l"s (8ig"re below.
I"estion1 Gan the points in [ be lo%ate# in a real spa%e of two.#imensions.
&xample inp"t ('1 [CR!', !2, !P, !US, an# & C R(!2 (,ortheast, ,orth !',
(!P (,ortheast !2, (!P (Eest, /o"thwest, /o"th !', (!U (,orth !PS.
Answer1 ,o satisfying pla%ement of !', !2, !P an# !U exists following these
%onstraints.
&xample inp"t (21 [CR!', !2, !P, !US, an# & C R(!2 (,ortheast, ,orth !',
(!P (,ortheast !2, (!P (,ortheast !', (!U (,orth !PS. Answer1 Jes. !'
C (0,0, !2C(',', !PC(P,P, an# !UC(P,U is s"%h a satisfying assignment.
&ast
,ortheast
,orth
,orthwest
Eest
/o"thwest /o"theast
&9
8ig"re '1 2D.Gar#inal #ire%tions %al%"l"s
Theorem: reasonin5 *ith B#-Cardinal directions al5ebra is NP-hard"
Proof (:igo;at, Knl. of [is"al :ang"ages an# Gonstraints, [ol Z, 'ZZ^1

-roof by %onstr"%ting a Gar#inal.#ire%tions algebra problem instan%e from
an arbitrary P./A( problem instan%e with a set of %la"ses liBe G
i
C R l
i,'
X l
i,2
X
l
i,P
S.
(' 8or e!ery literal l
i*
%reate two points -
i*
an# H
i*
s"%h that -
i*
Rnw, n, ne, e,
seS H
i*
, an# (2 for e!ery %la"se G
i
we ha!e -
i'
Rsw, w, nwS H
i2
an# -
i2
Rsw,
w, nwS H
iP
an# -
iP
Rsw, w, nwS H
i'
. Also, (P for e!ery literal l
i*
that has a
%omplementary literal l
gh
we ha!e two relations between their %orrespon#ing
points1 -
i*
Rsw, s, seS H
gh
an# -
gh
Rsw, s, seS H
i*.

Eriting - as (p, 9 an# H as (r, s we get three relations on x.axis an# y.axis,
(' (p
i*
$ r
i*
X (9
i*
$ s
i*
,
(2 (p
i'
> r
iP
W (p
i2
> r
i'
W (p
iP
> r
i2
,
(P )f l
i*
an# l
gh
are %omplementary literals, (9
gh
> s
i*
W (9
i*
> s
gh

Ee express (p
i*
$ r
i*
as false whene!er (if an# only if any literal l
i*
is true in
%la"se G
i
.
/o, for the six points %orrespon#ing to any "nsatisfiable %la"se where all
literals are false, generates three relations for their x.%oor#inates, (p
i'
$ r
i'

W (p
i2
$ r
i2
W (p
iP
$ r
iP
by %onstr"%tion ('. )n a##ition by %onstr"%tion (2
we get three more relations (p
i'
> r
iP
W (p
i2
> r
i'
W (p
iP
> r
i2
. Jo" %annot
assign these six points on the x.axis satisfying all these six relations. 3en%e,
if any %la"se is false (by any tr"th assignment of literals, then the
%orrespon#ing Gar#inal.#ire%tions algebra problem #oes not ha!e a sol"tion
(be%a"se these six points %annot be assigne# in spa%e.
=n the other han# s"ppose there exists a tr"th assignment that satisfies all
%la"ses. /o for e!ery %la"se G
i
there is at least one literal l
i*
true, or (p
i*
$ r
i*

is false, or ,8
i'
9 s
i'
/ is tr"e (by %onstr"%tion ('. (hen, a %omplementary
literal l
gh
in %la"se G
g
will %reate the following relations1 ,8
h
: s
i'
/ ; ,8
i'
:
s
h
/" (he three relations are not %onsistent with ,8
h
9 s
h
/ that sho"l# be tr"e
/o"th
if an# only if l
gh
is also true. 3en%e, l
i*
an# l
gh
%annot be true at the same
time, th"s, prohibiting any in%onsisten%y for the tr"th assignment of literals
a%ross the %la"ses. )n other wor#s, the %ross.linBing of the points a%ross the
%orrespon#ing literals will not prohibit from their being p"t in the spa%e.
,ote that as soon as a literal is true in a %la"se the %orrespon#ing six points
%an be assigne# as per %onstr"%tions ' an# 2, only %onstr"%tion P might ha!e
%reate# problem !ia the %omplementary literals.
Abo!e arg"ment pro!es the %orre%tness of the %onstr"%tions.
(he n"mber of steps in the %onstr"%tion algorithm in!ol!es1 %onstr"%ting ]
points per %la"se, ] relations per %la"se from %onstr"%tion (', P relations per
%la"se from (2, an# at the most P relations per pair of %la"ses. (otal n"mber
is polynomial with respe%t to the n"mbers of !ariables an# %la"ses. 3en%e,
the abo!e %onstr"%tion is a polynomial transformation from P./A( problem
to the 2D.Gar#inal algebra problem.
F=#"
OT<ER MODELS O% COMP=T)T2ON
,-.har#ness %ame as a big sho%B to the progress of %omp"ting. Many of the
important an# interesting problems t"rn o"t to be ,-.har#+
Areas where problems are not ,-.har# see s"%%ess in the marBet pla%e, e.g.,
most problems in #ata.management or linear programming. =ther areas
where problems are ,-.har# either bypass (see #is%"ssion abo!e on how to
ta%Ble ,-.har# problems or simply %ontin"e to exist as a resear%h topi% for
a long time (e.g., artifi%ial intelligen%e, or software engineering.
,ote that the mo#el of %omp"tation in whi%h some problems are ,-.har# is
the ("ring0Gh"r%h ((M mo#el of %omp"tation.
(he first hope was raise# with parallel comp&tin. Alas, that t"rne# o"t to
be not more powerf"l than the present mo#el+ /ignifi%an%e1 e!en if infinite
n"mber of G-OLs are pro!i#e# an# %omm"ni%ation time is 0 between them,
the ,-.har# problems may not still ha!e any #istrib"te# poly.algorithms.
)rtificial Ne&ral Net-or# pro!i#es a #ifferent mo#el of %omp"tation. )t
has the same power as the ("ring Ma%hine, b"t it sol!es some pattern
re%ognition problems !ery fast.
An esoteri% approa%h is the DN) comp&tin. (hey sol!e some graph.
theoreti% problems 5e.g. (/-6 in a !ery small n"mber of steps (b"t with a
h"ge time per step with the %"rrent bio.te%hnology. M"t D,A %omp"ting is
pro!e# to be as powerf"l as ("ring Ma%hine (i.e., ,-.h remains ,-.h e!en
with D,A %omp"ting. Hesear%hers are trying to #e!elop %omp"ters o"t of
D,ALs.
Another limitation to the %on!entional %omp"ting is s"rfa%ing from the
hard*are1 %ir%"it #ensities on %hips are be%oming too large1 a!oi#ing %ross.
fee#s between %ir%"it.elements will be%ome impossible soon, be%a"se of the
9"ant"m.t"nneling effe%ts.
A new te%hnology shaping "p on the hori;on is in the form of *&ant&m
comp&tin. M"ltiple #ata (an# instr"%tions %an be s"perimpose# in the
same 9"ant"m.register. Ehen nee#e#, a 9"ant"m operator will extra%t the
re9"ire# o"tp"t. An algorithm be%omes a I"ant"m operator in this
para#igm.
-hysi%al te%hnologi%al h"r#les are being o!er%ome gra#"ally. )t seems we
ha!e been #oing 9"ant"m %omp"ting "nBnowingly for the last few #e%a#es
in the form of ,MH (n"%lear magneti% resonan%e, as in MH) in me#i%ine,
where atomi% n"%lei pro!i#e the I"ant"m bits (I.bits.
I"ant"m %omp"ting (IG is a #ifferent mo#el than (M, has in.b"ilt non.
#eterminism. M"t, apparently ,-.har#ness remain ,-.har# their too 6find
out a rele$ant paper for a free lunch from me8E 3owe!er, spee#, spa%e
%omplexity, an# power %ons"mption of IG may be m"%h lower than those of
the ele%troni% %omp"ters.
Algorithms for IG are 9"ite #ifferent than those for %on!entional %omp"ters
(base# on ("ring ma%hine. IG may also pro!i#e a better mo#el for se%"rity,
whi%h attra%ts %ryptographers an# the %omm"ni%ations in#"stry. IG has also
generate# topi% %alle# %pintronics where ele%tronsL spin is "se# instea# of
%harge for b"il#ing #igital %ir%"itry (see )MM resear%h.

Anda mungkin juga menyukai