Indep enden t Set Problem Input: a graph and a lo w er b ound . G k Output: \y es" i� there are at least k indep endent no des of G ; i.e., no des with no edges in terconnecting. Reduction from: 3SA T. � Clearly , this problem is in N P ; just guess no des and c hec k that they ha v e no edges k among them. The Reduction T ak e a 3-SA T instance suc h as ( x + y + z )( x � + z � + w ). � Create no de [ i; j ] for the j th literal in the i th clause. ✦ ranges from 1 to the n um b er of i clauses | certainly ( n ), where = the O n input length. ✦ = 1 ; 2, or 3. j � Edges among the three no des with a common i prev en t more than one of them b eing c hosen in an indep enden t set. � Edges b et w een no des for an y literal and its complemen t. ✦ In our little example: [1 ; 1] and [2 ; 1] are connected ( x and x ); � [1 ; 3] and [2 ; 2] are also connected ( z and � ). z � Pic k = n um b er of clauses. k Pro of the Reduction is Correct � First, supp ose w e ha v e a satisfying truth assignmen t for the v ariables. ✦ Pic k one true literal from eac h clause (there could b e more, but not few er). ✦ The no des corresp onding to these literals form an indep enden t set of size k . ✦ Wh y? The only edges among them w ould connect no des for di�eren t clauses, and these w ould ha v e to go b et w een a literal and its complemen t, b oth of whic h could not ha v e b een selected. 1
� No w, supp ose w e ha v e an indep enden t set of size k . ✦ This set cannot ha v e more than one no de from an y one clause. ✦ This set cannot c ho ose no des corresp onding to a literal and its complemen t. ✦ Th us, it tells us a truth assignmen t for enough of the v ariables that ev ery clause is made true. Coping With Complexit y When faced with an NP-complete problem, there are three things w e can do: 1. Appr oximate . F or example, do w e need an absolutely maxim um -size indep enden t set? ✦ P erhaps a greedy heuristic (grab an y no de w e see as long as it has no edges connected it to those w e'v e selected already) will get an indep enden t set that is big enough? 2. R estrict . Do w e really need to solv e the problem in all its generalit y? Or could a sp ecial case that has a p olynomial algorithm serv e our needs? ✦ Example, while 3SA T is NP-complete, the 2SA T problem (clauses of 2 literals only) has a subtle, linear-time algorithm. 3. T ough It Out . Sometimes w e are only in terested in problem instances that are small enough that the exp onen tial gro wth do esn't o v erwhelm our resources. ✦ Query optimization algorithms are lik e that: ev erything is NP-complete, but database queries tend to b e v ery small. ✦ T ra v eling Salesman is an un usual NP- complete problem b ecause it is in fact v ery easy to solv e ev en 1000-cit y problems. Th us, it is used b y man y snak e-oil salesmen to demonstrate that their fa v orite algorithmic metho dology \b eats" NP-completeness (e.g., Hopgo o d with neural nets, Adelman with DNA algorithms). Out Bey ond N P There is no end to the n um b er of complexit y classes that can b e in v en ted b y mathematically 2
inclined academics desirous of gaining ten ure. Some of these are actually in teresting. Co-NP A language/problem is in Co-NP if its complemen t is in N P . � If P = N P , then Co-NP = N P . ✦ Wh y? b ecause the complemen t of a problem in P is surely in P , since w e can just complemen t the answ er in one more step. � Ho w ev er, if P 6 = N P , as w e assume, then Co- NP 6 = N P is lik ely , although not certain. � Apparen t example: The complemen t of SA T (i.e., all Bo olean expressions that are not satis�able, plus the \garbage" that is not a w ell-formed expression) app ears not to b e in N P . ✦ While w e can guess a satisfying truth assignmen t and c hec k that w e guessed righ t in p olynomial time, there is no w a y to \guess wh y there is no suc h assignmen t." ✦ Note that the nonsatis�able expressions are the negations of the tautolo gies (expressions that are alw a ys true), so tautology testing is another example of a Co-NP problem that app ears not to b e in N P . PSP A CE A TM that uses no more than p ( n ) space on input of length n , for some p olynomial p , is said to b e in PSP A CE. � Y ou migh t think that it matters whether the TM is deterministic or nondeterministic, but it do esn't! See b elo w. � A PSP A CE TM can tak e exp onen tial time b efore accepting. p ( n ) � Ho w ev er, if it tak es more than k mo v es, where k = sum of the n um b er of states and tap e sym b ols, then it has rep eated an ID and so has a shorter sequence of mo v es leading to acceptance if it accepts at all. Example The tautology problem is in PSP A CE. 3
� Use linear space to en umerate all p ossible truth assignmen ts, one at a time (i.e., run a coun ter in binary). � Chec k eac h assignmen t, sa y \no" if y ou �nd one that do esn't mak e the expression true, and sa y \y es" if y ou reac h the end. PSP A CE-complete Problems While P � N P � PSP A CE is ob vious (remem b er that PSP A CE includes nondeterministic TM's), it P is not ev en kno wn whether = PSP A CE. � Sa y a problem is if ev ery L PSP A CE-c omplete problem in PSP A CE p olynomial- t reduces ime to L . ✦ Th us, if is in P , then P = PSP A CE; if L is in N P , then N P = PSP A CE. L Example QBF ( Quanti�e d Bo ole an F ormulas ) is a PSP A CE- complete problem. � Example of a QBF: ( 8 x )( 9 y )( x � + � ). y xy ✦ This instance of QBF has answ er \y es" (true), b ecause w e can pic k to b e the y complemen t of x . Sa vitc h's Theorem: Equiv alence of Determini sti c and Nondetermini sti c PSP A CE Key ideas: 1. If a PSP A CE NTM accepts, it do es so within p ( n ) steps. k 2. A sim ulating DTM uses a recursiv e algorithm to answ er questions of the form: \do es ID � * ` i ID � in at most 2 steps?" � ` Basis : i = 0. Chec k if � = � or � � . � : F or eac h p ossible [ID of length Induction � * ` at most p ( n )], recursiv ely c hec k if � � in at * i � 1 i � 1 most 2 mo v es and � ` � in at most 2 mo v es. ✦ Return \y es" if an y suc h found; return � \no" if not. ✦ Y ou need only one \stac k frame" of length p ( n ) to generate and store eac h p ossible � (use a coun ter in base k ). 4
� Clinc her: W e can limit the stac k to p ( n ) log k 2 2 recursiv e calls, taking a total of p ( n ) log k 2 space, a p olynomial if p ( n ) is. ✦ Wh y? That is enough to answ er the * question \do es � ` � in at most p ( n ) log p ( n ) k 2 = k mo v es?" 2 ✦ Let � b e the initial ID, and (using a coun ter) � b e an y of the p ossible accepting ID's of length p ( n ). p ( n ) ✦ Remem b er, if acceptance o ccurs, k mo v es is enough. 5
Recommend
More recommend