0% found this document useful (0 votes)
28 views16 pages

NP hard and NP complete problems DAA

Daa

Uploaded by

manvithamaha95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
28 views16 pages

NP hard and NP complete problems DAA

Daa

Uploaded by

manvithamaha95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 16
NY Wag ye Pe NP- Complete paodlems: Basic concepts N 4 OY Deena nteltc Algootithmms, NP Had ome —nip-complete closes © coor’s theanern: 7 Some pacene Paoblems ade compen owd difficult 4© Send eSSictemt algosritherms $09 golving them ond * %& cammot ye sdved on Settune also amd have Non polyvion’a ne olgpatthrn amd some pmroblems cam be Solved by a time algosithro , Mike otni, o(tagn), OGn Seg) amd _ OCW: gdynomial Heme algoaithmsase befng tractable ove pooblems that equine TON ase thaxe, that Polynomias. Lome ac vein hee Imtvactable- > Ray paoblern Som which omswea CS ecthes Yes ot 70 & called decision pacolem. Gne algooithnn Sos, gecestom paoblem & © called decisfon algosithn. a Ang paculem thos fmvdwes the edentetication OF oped cost Cominimum © we mMogimnunn) cS calied tO) pooblem. The algpoithn Sor optim ted on A optimization algpaitory DeSinttton of Pt pacbleins that can be saved cpa “terme. Cp" stovs $09 pdyoermial)- Examnples: Seadchting of Key element, soaking OF elements, All pota shoodest path. mon - deteseianis tee Bekinitlonn of Apt Dt stawds Sor tond Sod aoe OS: INP Polynomial Lemme”. Note that NP does Yt 5 “won - poly sornial’. rareopies 8 Waveltiing golespesion paoblen, G0Pl colortrg Padlem, Kmapsack Probleny, Hewmiltonten cixcate Pooblemy. 7 s88The Ap-class pasblems Gom be Sates cabegont zed foto NP- Complete and Np-hasd padelems classification ©§ — complexity paobtems Pehete ieee ee reer - SoS ts NP- completeness pncder, rose Statied amg oi ene does "0k. pepvidle @ method S06 ot! Compusiing oa algooitins Sos the gacblem What we d, mes AH goeotes an vdynomi Hey oe Es shou toack Many PHoblens oot cahich 0 Kmaon polynomtal iene algosithmgs as okonally agelaked- classes oF problems They ane => Yene we establish roo 4) Nee Has zy NP- Complete 2 & paoblem that CS NP- ewenplete has the Propesty that tk Con be Solved oO polynomial Home t$$ oll othe) NP compet= paoblems can also be. solved tm polypeomtal. tome - hand Ppacblern Com be Solves! them ot Np- com plete olyromia- me, > r§ em NP & «polymorn Ea ttene» lems cam ee — Solved fn Pfol eRe oNP- complet € paoblems axe we-haad Youd Some NP- hand garoblems Cug-e. NOE lem complete : 49 we ne Non The non- detenmenstic algoatithyns ue te Following for, Ls choice? Aabltrartly choses one Of the element Sxom ———— Gren set: ar Failures Indicates am Umsuccessful compleson. B- SUCCES: Indicates GQ Success-Fal complet en. 7 A non deteoministte algosxéthrn terminates cunsuccessfatly °$ osnd only & these exists wo set of choices steading ty am succes Signal: = Wheneved theme és a set of chotes that leads oa 5 one Successful completo, then such set o§ chotes & Seleded and the algosiith nm tenentnates SuccessFully > To case the SUC compleory Es mot pocsl die. then she He. complerity fs oC). the fone Ty fe then OE OE a eeceny signal. Completion. S e cd tp seach, “Sed ge the minimum no-o§ stePs sane © success, egthe no-oF completion of Cn). whee WES tnpets: P # machine Capable o§ eyecuting non- deterministic goatee thy ate way 26 called a mon-determtn istic _ Machine. > & Noo debewnsntstic SuPersek Son, algosthmns ahe vlopodthens algogithw cs constdesed asa de tenanenestoe algositts «mm Le. the deterministic & Special case of ener ens ee, ‘ NP P WH tstic. algosttinn ae Searching tErne conmplenity ores, Set o$ elements Ain] ty soni Nonbeksease fy Ca, ) Kr=choice Cums TS alk) = x ther woite (ky. Su cee ssc), C ty ana m—— BampPle 2 ton deterentn isle algoaiithrn ee . > Let Om) be an umsoated oe a Non-deter Entegens @{izn] cs an aunillony oe then the mtenistic algoatthen MpsoeT (Am) SO Numbess into non- decreasing ones Algodithm, NendetSort Carn) 3 I Fats t6 a won-cetenmentsite Sotteg algoaiten 3 S02 $=) to n do SC3)}:205 Sor j:24 bo ndo 2 Kr= choice Cun)= °& sk&)+#0 ‘then SoilueL)* else t S&)=ACIS fon 3=l bn-tdo ‘S SCi)> SCH] then Failure (0): ” waite CsCiing): SuccessL5 Eraume Ls 5 Lave 3: LECiSio0 Pollen s descents, — Amy paoblem $04 which the amswed ’s etther C8 4 & called a decigton paoblem. The conrsespording Ga decision pawblem & called decéstoo algostthn. > An optimization pacblem ts ome that tdemtSES on optimal value 0f a given Sumckon Ceither a. mond Nalue Or a mentmum value): The abgpaithro asgociocted | qaied an optimtzation | A moottinad complete subg) which tS egoroaphic to Km, Shewe G=Cwe fa clique, km & complete graph on ™ veodkices* 3 The Size of the cligue ts the moo Veokices in TE > Mondimunn cl?gue paoblem & os optimt zakon powllem hak hos to detecmine the size of * Josgest cligue tn Gq we wake “Se of dects fon paoblem to determine Lhethed Gr hos cleque 0§ size etleast k Son Some gee? A . i ie congidea a D cligue Ga.K) be the deteymmniste decision algositnn fon the cligue decisfon paoblem. an be the 0-05 veatites to G- The Size0S mon 2p G Com be Soumd by making sevesral application ue €S Usel once for cath 6, Wot) the olp Sam © cue er . es @) we) Complete Graphs ae Abeits tHe) > TS the deme complerdty 08 9 clave ame a0 5G), Side of most digue com be Sunt Aso, & the stecio§ a. modem © 7 bm mene gtr2. then the cedisfom poe sowed fi Hime gtr) digue com be determines tem cam be > Hemae the mandmum clégue pacblem tS ove polynomial time &§ the clique decsstom Pardblem cam be solved im Polynomial ee => Te tnput to the mentimurn dis ue decison povided OS @ sequence oF eweh age ND EG) isa ste o§ Che tmput x, Cowblenn cero CE edges ond om tnteger Ke pater o§ mum bers Ci5) the each edge Ci, J) és bog dogs po iS a bimany Bepsesentakion es assumed: The tpt size af omy tmstamce , ts. me (Cok) [est] 0) «eg Coe ey izg as OY oy => is Ge 5 ae me _Sommected Com Gomemt chen nzivl- Thusis this deestom — psseten Camnots ke | solved by am algeaithn OF complenity Uren tt caret be Swed by any Ry anna na msn <0 ‘ae a Da Vi a De i DT i Tae — = “goo S 26 algorithro thee De fy a sno dekerirent worst’ OS) Une ee cligue dectston powblem. Algoatthen Ock SOS to Souen sek of IK disemet vertices: Ten te bests to gee thethea these Veakices Sovma. Complete Subgra.ph- IS G& ts aves ey tts adjacency Makrix amd WIEN the fmput Leng Ho ta wy. Look 4 dheg? 42. Tne So¥ Joop of tres A 19 Can Sastly Le implemented to wun en moordckenrninstic EME Com). Tye tne Sow toe dup {1 ane w ts otk, Hence the overall enondetermenstic tine és otne Ebola = Clim). Theae & 0 Kmown paynorméal: cHeare_ determine. algonithan Sov this paoblem: Algorithm Dek Ca," 6) 4 s=Gs fog tel to k do t= choice CU) § tes then Sailure()- 4 S7 SORE} I combine t to sets UW teve $ contains K disttinck | Veter tadicac Sor all pains Ci, Such that iS, Jes amd t+f do $3) ts net am edge of G Sranople 4: SedisSiabiltly pooblem 2 ther, We Sormalate sakissnbritly powblem oe * a Sovnnulo. & tue Sor some ousstg Cea és Nalues to the vaotables: The boolean composed of, 1 Booleam Vawiables XM” Samekiong © Boleam connectives os OY Pie ai Buch as ‘th one or on tnputs amet OF zon), <> (ig A Gino), Cor), aCwoL), > Ctmateadio®, md only 6.) ond CNE Coonjumtiive. Norenal Form) ¢ BS tt ts weprecented ac Ae, OS: Whene the Ci ane clauses each Sepresemted ae VEey Dey ONF Cotssunetive Notenal Row)? Te ts ty DNE TSE aL srepresonted oy Me; and each clause Ce ts weprecented as AI CKN WV Cin X) is to owe Whereas Cx, v% ) Nn CAN X) co in ONE, A Soemula & fn CNE Oe Liberals, TT NP- 4 The cha Hal te ACS AIP Hasd amd Np- complete 9 Probleny cg” pean es cats to be “PSymemlly,bourdad” XS onst- case Complently %& bounded by % PAynanial Sumettorn og the tnpt stze Cte, & there ts o polymom zal 'p! Such thed Soa each Snpuk OF Size mn! the ellgooiitnm jermtnete Slew ak wos Per) steers > A Paoblem ts Said to be paymomially bounded. 2 Here. — <2. polyrnomt ally bounded agoatthyn fox tt 7 “py es the class o& decision Pacblems tak aure polynomially bosreded: “pr os deSEmect only For deciefon pondems. > unpe & the class of decisfow poculems for which there ic Poly nomially bounded siondectermimistic. algoatthrn - . & NP- Cornplete Panololernss => A faollem L ts Np- compete &F1 ts NP~ asd ond Le NP Coon-determimnistio polynomial). A paoblem that &5 NP-complete has the. povpeaty that % z coun be. save 7 polynomial Heme CSF all other np-cmptete, pooblerns com also bbe Solved tn polynomial Lame 3 wom Ne-hasel pardblem com le solved tr palynomfal sec» chen all NP-complete eroblemé cas be Solvcel heme, AU wee Complete problems ewe hasd Preblemg aac OL Kagan be a eae) NF—complete- Normally “he P blems a op ie oo — Se Wp complete buk Some O8e nP_Haad @ : ' lem ond Ly * However % pooblem L ts a decieto? S te thak Lol fam optimization pooblem then & & posseb hs . 7 : jolero Fos, example tne Kmapsacg decision P7° Vere. Seduced &. imizoston F ROpPEAckK oOptimi ame. not NP complet one Some np hasd paoblems * eNe-Hasd: * psoblero L és np-Haad i$ sodtsSiabtlt ES Any Don dekenwministic polynomial is soktsSicble and creducalle then the som to be Wr- Haad- EXE p Yalling Peobdlem, Floo-Shop achedlog. rob 2m" ty Teluces to L time problem paoblem ee = claves 0S wP-HAeD amd WP- CamplETE PROBLEMS: (> Let PNB NPE and NPC ane the seks of all possfble decision paoblems that ave gdvable &n polynomial Heme by using deterministic algoafthms, nde deterrofnits algostthean< 5 Ny ptard and NP complete Tespecttuely. = cthan the celodionship blo Pp, NP NPH end NPC con we expveged ‘using Vea A eag rams &s pacsenntect pelow- Ae) most thepheticos Computes scientists vier the sie ships aren PNP npe as ‘eat P ama Nee ase holy comtainel within NP amd ponec=4 , NP wey: eee ere’ ee’ &'E oz a ewernewe ee at To 2+ Whee vex NP= NPR one! P=Nen Pe then the creladzonship PWR NRC Cond Ket} ee © Np Relation she Ship eckucen P, aIP ma NPC amet NPH Hale ; oles Hautting poodle fs an xCmple afar Ne-hand decisiow Pdoblem trot &8 mot NP- Complete. > The Valting pdoolem @s to cetera Pine S06 oo aabivary detexroinstic allgosithn A amd am tip T whether algeria D with input Lever teeminakes -Te Con enters aun Sn beotte Lov? - >The paobler elgootih do Solve Tr Zs wodecidable te, there SUSE NO vs PHOblepy. So Rt CKhayty comnot be im NP ghow sorissiabiltty A halting pooblem, simply A whose input 6S a ~ To contivuct on algexithen paoposttional Sowmula. x- TS Khas pi vas fables then Ar tees ont oll a? pogtble mute Values amp! vyeoises &% x ie sodickiable. TS tt Cs then A> Th& 2% iS mot SsatisSable then A emipes - toops Hence, A: bale? on tnput X Sud ; sotistinble. |e we | ae hoe & polynowmtal fone algooth | QQ POdblem them we pauid solve Pooblem fn folynowial time using Ar amd X as t/P to the algositiens $08, the halting paroblem - PHemce , the hailing Psoblem 2S Am wetland which €¢ mot tm NP. jo PF eres wm SOV ADE the sods StaBttR, ptobleny We : . Coor's Theosem gtales tha ealissiabitly %4 to PS PENP. ue aleeady jenow thee gafisScabittty &S tp NP. Hence &F PENNE, dig case sscabetitty ts @n P > Then th ctemalns to be char that CS sodteSiebitty te top then pane EO Odden to Pave thés oe show how te obtaie ony palynomtah time non Clelsemint str, deciston algosithye A ome! tnput TL) a Semele QCA 2) Such that Q & satis Stable t& A has Succeseful araentee With Bnpat T. TS the Length of Tits ‘amd the time Complerity of A te Pin) Sa Some palywoméal PCD thers the Horgih of AMAT BE OCFend A550) = O (pte The time needed to ComStsuct Q WU) also be a 5 > A deterministic algortthm z 4, ekernne Outcome OF A OM OMy Empat JT May bg, es ; Med ac “3 @s Computes defeamntnist Agosy, @ asnd them uses W OCS \ thr S09, the. Ee oni] °, Sotishability parole td determine Ww je mot Q &s gakistfable. TS Oem) tothe O (ex, Sue eer ec a OG Peage + hogy +2-CPenydogn). EF eattsgeabiitly tg tn P then Fm) 2s & Paynomntal. Sunckion af ™m and Line Complendy Of Z becomes Olstny> Soe Some polynomial wld. * Hence 28 gablsfiabiitly t& Bo p then Sod NE Bon deterministic algoritien A tn AP we can cobain © determnimighke EZ mm P. => Assumption Sox Constructing the lbovleam Sovmula. Q Sor 0 given Mon- detenministic algosithm At A» A ts to be exeaded tr Word osiented. Q- A staple erpresiton Es ov erpresstom that Contains One operator and alk cperamds ade Sianpie Vastables- & Cetmple Vasiable <— simple exgresston) &b Conroy vasdable)e— Cstmele vosiable) diy Cevaple \asiable) < Cosrcay Vasile) Vasiable) <—(choice of S) uly CGeople dype tnteger OF boaleasy . 3- Al Voatables fn A one o§ a goat A Contains nO sread or Ustic Statement Comstaynts as Algonstirr A Comtains Mo 6+ Lo oddigion 4D Stnple acsignment sicdement AG a State allosed tp Contain only the followtrg type oF ee © swkement gue k B> Stakement BCL) then gutob SO SuccessO>, getuvces ° Algosdthan A comtato type declaration a demenston Stokements S Let eEnp bea polyromfal téme such that A ‘ake ~0 reps ‘thom pln) Heme on the Pnpuk of demgtts nm.

You might also like