Transcription of NP-complete problems - People
1 Ndingshortestpathsandminimumspanningtree singraphs, matchingsinbipartitegraphs, maximumincreasingsub-sequences, maximum owsinnetworks, cient, becauseineach casetheirtimerequirementgrowsasa polynomialfunction(such asn,n2, orn3) ofthesizeof betterappreciatesuch ef cientalgorithms, considerthealternative:Inalltheseprob-le mswearesearchingfora solution(path,tree, matching, etc.)fromamonganexponentialpopulationofp ossibilities. Indeed,nboyscanbematchedwithngirlsinn!di fferentways, agraphwithnverticeshasnn 2spanningtrees, anda typicalgraphhasanexponentialnum-berof pathsfromstot. Alltheseproblemscouldinprinciplebesolved inexponentialtimebycheckingthroughallcan didatesolutions, onebyone.
2 Butanalgorithmwhoserunningtimeis2n, orworse, is allbutuselessinpractice(seethenextbox).T hequestforef cientalgorithmsis about ndingcleverwaystobypassthisprocessofexha ustivesearch,usingcluesfromtheinputinord ertodramaticallynarrowdownthesearch thisquest,algorithmictech-niquesthatdefe atthespecterofexponentiality:greedyalgor ithms, dynamicprogramming,linearprogramming(whi ledivide-and-conquertypicallyyieldsfaste ralgorithmsforproblemswecanalreadysolvei npolynomialtime).Nowthetimehascometomeet thequest's mostembarrassingandpersistentfailures. We shallseesomeother search problems , inwhichagainweareseekinga solutionwithparticularpropertiesamongane xponentialchaosofal-ternatives.
3 Butforthesenewproblemsnoshortcutseemspos sible. Thefastestalgorithmsweknowforthemarealle xponential ,thegameofchesswasinventedbytheBrahminSi ssatoamuseandteach hisking. Askedbythegratefulmonarch whathewantedinreturn,thewisemanrequested thatthekingplaceonegrainofriceinthe rstsquareofthechessboard,twointhesecond, fourinthethird,andsoon,doublingtheamount ofriceuptothe64thsquare. Thekingagreedonthespot,andasa resulthewasthe rstpersontolearnthevaluable -albeithumbling lessonofexponentialgrowth. Sissa's requestamountedto264 1 = 18;446;744;073;709;551;615grainsofrice, enoughricetopaveallofIndiaseveraltimesov er!
4 Allovernature, fromcoloniesofbacteriatocellsina fetus, weseesystemsthatgrowexponentially fora while. In1798,theBritishphilosopherT. RobertMalthuspublishedanessay inwhich hepredictedthattheexponentialgrowth(heca lledit geometricgrowth )ofthehumanpopulationwouldsoondepletelin earlygrowingresources, anargumentthatin uencedCharlesDarwindeeply. , , ,moderatedtoa doublingevery18monthsandextendedtocomput erspeed,is knownasMoore's Andthesearethetworootcausesoftheexplosio nofinformationtechnologyinthepastdecades :Moore's lawandef 's lawprovidesa disincentivefordevelopingpolynomialal-go rithms.
5 Afterall,if analgorithmisexponential,whynotwaitit outuntilMoore's lawmakesit feasible?Butinrealitytheexactoppositehap pens:Moore's law is a hugeincen-tivefordevelopingef cientalgorithms, becausesuch algorithmsareneededinordertotakeadvantag eof If, forexample, anO(2n)algorithmforBooleansatis ability(SAT) weregivenanhourtorun,it wouldhavesolvedinstanceswith25variablesb ack in1975,31vari-ablesonthefastercomputersa vailablein1985,38variablesin1995,andabou t45variableswithtoday's machines. Quitea bitofprogress exceptthateach extravariablerequiresayearanda half's wait,whiletheappetiteofapplications(many ofwhich are, ironically, re-latedtocomputerdesign)growsmuch faster.
6 Incontrast,thesizeoftheinstancessolvedby anO(n)orO(nlogn)algorithmwouldbemultipli edbya factorof about100each (n2) algorithm ,theinstancesizesolvableina xedtimewouldbemul-tipliedbyabout10each decade. EvenanO(n6) algorithm ,polynomialyetunappe tizing,wouldmorethandoublethesizeofthein stancessolvedeach decade. Whenit comestothegrowthofthesizeofproblemswecan attack withanalgorithm,wehavea reversal:expo-nentialalgorithmsmakepolyn omiallyslowprogress, whilepolynomialalgorithmsadvanceexponent iallyfast!ForMoore's law tobere ectedintheworldweneedef ,exponentialexpansioncannotbesustainedin -de nitelyinour ; 's law willstopdoublingthespeedof ourcomputerswithina decadeortwo.
7 Andthenprogresswilldependonalgorithmicin genuity orotherwiseperhapsonnovelideassuch asquantumcomputation, Dasgupta, , Vazirani249 Satis abilitySATISFIABILITY, orSAT( ),is a problemofgreatpracticalimportance, withapplicationsrangingfromchiptestingan dcomputerdesigntoimageanaly-sisandsoftwa reengineering. It is alsoa 's whataninstanceofSATlookslike:(x_y_z) (x_y) (y_z) (z_x) (x_y_z):ThisisaBooleanformulainconjuncti venormalform(CNF). Itisa collectionofclauses(theparentheses),each consistingofthedisjunction(logicalor, denoted_) ofseveralliterals,wherea literaliseithera Booleanvariable(such asx) orthenegationofone(such asx).
8 Asatisfyingtruthassignmentisanassignment offalseortruetoeach variablesothateveryclausecontainsa literalwhosevalueistrue. TheSATproblemis thefollowing:givenaBooleanformulainconju nctivenormalform,either nda , settingallvariablestotrue, forexample, satis truthassignmentthatsatis esallclauses?Witha littlethought,it isnothardtoarguethatinthisparticularcase nosuch truthassignmentexists. (Hint: Thethreemiddleclausesconstrainallthreeva riablestohavethesamevalue.) Buthowdowedecidethisingeneral?Ofcourse, wecanalwayssearch throughalltruthassignments, onebyone, butforformulaswithnvariables, thenumberofpossibleassignmentsis exponential, typicalsearch problem .
9 We aregivenaninstanceI(thatis, someinputdataspecifyingtheproblemathand, inthiscasea Booleanformulainconjunctivenormalform),a ndweareaskedto ndasolutionS(anobjectthatmeetsa particularspeci cation,inthiscaseanassignmentthatsatis eseach clause).If nosuch solutionexists, wemustsay cally, a search problemmusthavethepropertythatanypropose dsolutionStoaninstanceIcanbequickly checkedforcorrectness. Whatdoesthisentail?Foronething,Smustatle astbeconcise(quick toread),withlengthpolynomiallyboundedbyt hatofI. Thisis clearlytrueinthecaseofSAT, forwhichSis anassignmenttothevariables. To formalizethenotionof quick checking, wewillsay thatthereis a polynomial-timealgorithmthattakesasinput IandSanddecideswhetherornotSis a solutionofI.
10 ForSAT, thisis easyasit justinvolvescheckingwhethertheassignment speci edbySindeedsatis willbeusefultoshiftourvantagepointandtot hinkof thisef cientalgorithmforcheckingproposedsolutio nsasde ningthesearch :Asearch problemis speci edbyanalgorithmCthattakestwoinputs, aninstanceIanda proposedsolutionS, andrunsintimepolynomialinjIj. We saySisasolutiontoIif andonlyifC(I;S) = problem ,researchersoverthepast50yearshav etriedhardto ndef cientwaystosolveit,butwithoutsuccess. ,interestingly, therearetwonaturalvariantsofSATforwhich wedohavegoodalgo-rithms. If allclausescontainatmostonepositivelitera l,thentheBooleanformulais , showninbold, , anda satisfyingtruthassignment,if oneexists, , if allclauseshaveonlytwoliterals, thengraphthe-orycomesintoplay, andSATcanbesolvedinlineartimeby ndingthestronglyconnectedcomponentsof a particulargraphconstructedfromtheinstanc e( ).