/
CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005
... CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005
...

CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005 ... - PDF document

calandra-battersby
calandra-battersby . @calandra-battersby
Follow
390 views
Uploaded On 2015-12-02

CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005 ... - PPT Presentation

180thisiscalledPolynomialtimeApproximationSchemePTASegcertainschedulingproblems 1intimethatispolynomialinn1 thisiscalledFullyPolynomialtimeapproximationSchemeFPTASegKnapsa ID: 212387

=1+" 8"0 thisiscalledPolynomial-timeApproximationScheme(PTAS) e.g.certainschedulingproblems. =1+"intimethatispolynomialin(n;1 ") thisiscalledFullyPolynomial-timeapproximationScheme(FPTAS) e.g.Knapsa

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "CS105:Algorithms(Grad)ApproximationAlgor..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005 =1+",8"�0,thisiscalledPolynomial-timeApproximationScheme(PTAS),e.g.certainschedulingproblems. =1+"intimethatispolynomialin(n;1 "),thisiscalledFullyPolynomial-timeapproximationScheme(FPTAS),e.g.Knapsack,SubsetSum.Now,letusconsideranapproximationalgorithmforNP-Hardproblem,VertexCover.1.2ApproximationAlgorithmforVertexCoverGivenaG=(V;E), ndaminimumsubsetCV,suchthatC\covers"alledgesinE,i.e.,everyedge2EisincidenttoatleastonevertexinC: Figure1:AninstanceofVertexCoverproblem.Anoptimalvertexcoverisfb,c,e,i,gg. Algorithm1:Approx-Vertex-Cover(G) C ;1whileE6=;2pickanyfu;vg2EC C[fu;vgdeleteallegesincidenttoeitheruorvreturnC Asitturnsout,thisisthebestapproximationalgorithmknownforvertexcover.Itisanopenproblemtoeitherdobetterorprovethatthisisalowerbound.Observation:Thesetofedgespickedbythisalgorithmisamatching,no2edgestoucheachother(edgesdisjoint).Infact,itisamaximalmatching.Wecanthenhavethefollowingalternativedescriptionofthealgorithmasfollows.FindamaximalmatchingMReturnthesetofend-pointsofalledges2M. Page2of7 CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005 1.3AnalysisofApproximationAlgorithmforVCClaim1:ThisalgorithmgivesavertexcoverProof:Everyedge2Misclearlycovered.Ifanedge,e=2Misnotcovered,thenM[fegisamatching,whichcontradicttomaximalityofM.Claim2:Thisvertexcoverhassize2minimumsize(optimalsolution)Proof: Figure2:AnotherinstanceofVertexCoveranditsoptimalcovershowninbluesquaresTheoptimumvertexcovermustcovereveryedgeinM.So,itmustincludeatleastoneoftheendpointsofeachedge2M,whereno2edgesinMshareanendpoint.Hence,optimumvertexcovermusthavesizeOPT(I)jMjButthealgorithmAreturnavertexcoverofsize2jMj,so8IwehaveA(I)=2jMj2OPT(I)implyingthatAisa2-approximationalgorithm.Weknowthattheoptimalsolutionisintractable(otherwisewecanprobablycomeupwithanalgorithmto ndit).Thus,wecannotmakeadirectcomparisonbetweenalgorithmA'ssolutionandtheoptimalsolution.ButwecanproveClaim2bymakingindirectcomparisonsofA'ssolutionandtheoptimalsolutionwiththesizeofthemaximalmatching,jMj.WeoftenusethistechniqueforapproximationproofsforNP-Hardproblems,asyouwillseelateron.Butis =2atightboundforthisalgorithm?Isitpossiblethatthisalgorithmcandobetterthan2-approximation?Wecanshowthat2-approximationisatightboundbyatightexample:TightExample:Consideracompletebipartitegraphofnblacknodesononesideandnrednodesontheotherside,denotedKn;n.Noticethatsizeofanymaximalmatchingofthisgraphequalsn,jMj=n Page3of7 CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005 Figure3:Kn;n-completebipartitegraphsotheApprox-Vertex-Cover(G)algorithmreturnsacoverofsize2n.A(Kn;n)=2nBut,clearlytheoptimalsolution=n.OPT(Kn;n)=nNotethatatightexampleneedstohavearbitrarilylargesizeinordertoprovetightnessofanalysis,otherwisewecanjustusebruteforceforsmallgraphsandAforlargeonestogetanalgorithmthatavoidthattightbound.Here,itshowsthatthisalgorithmgives2-approximationnomatterwhatsizenis.2ApproximationAlgorithms:TravelingSalesmanProblem2.1Lasttime: -approximationalgorithmsDe nition:Foraminimization(ormaximization)problemP,Aisan -approximationalgorithmifforeveryinstanceIofP,A(I) OPT(I) (orOPT(I) A(I) ).Lasttimewesawa2-approximationforVertexCover[CLRS35.1].Todaywewillseea2-approximationfortheTravelingSalesmanProblem(TSP)[CLRS35.2].2.2De nitionAsalesmanwantstovisiteachofncitiesexactlyonceeach,minimizingtotaldistancetravelled,andreturningtothestartingpoint.TravelingSalesmanProblem(TSP).Input:acomplete,undirectedgraphG=(V;E),withedgeweights(costs)w:E�!R+,andwherejVj=n.Output:atour(cyclethatvisitsallnverticesexactlyonceeach,andreturningtostartingvertex)ofminimumcost. Page4of7 CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005 2.3InapproximabilityResultforGeneralTSPTheorem:Foranyconstantk,itisNP-hardtoapproximateTSPtoafactorofk.Proof:RecallthatHamiltonianCycle(HC)isNP-complete(Sipser).Thede nitionofHCisasfollows.Input:anundirected(notnecessarilycomplete)graphG=(V;E).Output:YESifGhasaHamiltoniancycle(ortour,asde nedabove),NOotherwise.SupposeAisak-approximationalgorithmforTSP.WewilluseAtosolveHCinpolynomialtime,thusimplyingP=NP. Figure4:ExampleofconstructionofG0fromGforHC-to-TSP-approximationreduction.GiventheinputG=(V;E)toHC,wemodifyittoconstructthegraphG0=(V0;E0)andweightfunctionwasinputtoAasfollows(Figure4).LetalledgesofGhaveweight1.Completetheresultinggraph,lettingallnewedgeshaveweightLforsomelargeconstantL.ThealgorithmforHCisthen: Algorithm2:HC-Reduction(G) ConstructG0asdescribedabove.1ifA(G0)returnsa`small'costtour(kn)then2returnYES3ifA(G0)returnsa`large'costtour(L)then4returnNO5 ItthenremainstochooseourconstantLkn,toensurethatthe2casesareclearlydi erentiated.2.4ApproximationAlgorithmforMetricTSPDe nition.Ametricspaceisapair(S;d),whereSisasetandd:S2�!R+isadistancefunctionthatsatis es,forallu;v;w2S,thefollowingconditions.1.d(u;v)=02.d(u;v)=d(v;u) Page5of7 CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005 3.d(u;v)+d(v;w)d(u;w)(triangleinequality)ForacompletegraphG=(V;E)withcostc:E�!R+,wesay\thecostsformametricspace"if(V;^c)isametricspace,where^c(u;v):=c(fu;vg).Giventhisrestriction(inparticular,theadditionofthetriangleinequalitycondition),wehavethefollowingsimpleapproximationalgorithmforTSP. Algorithm3:MetricTSPApprox(G) ComputeaweightedMSTofG.1RootMSTarbitrarilyandtraverseinpre-order:v1;v2;:::;vn.2Outputtour:v1!v2!!vn!v1.3 Figure5:ExampleMST,wheretheoutputtourwouldbe1!2!!17!1.2.5AnalysisofApproximationAlgorithmforMetricTSPOnaninstanceIofTSP,letuscompareA(I)toOPT(I),viatheintermediatevalueMST(I)(theweightoftheMST).Claim:ComparingA(I)toMST(I):A(I)2MST(I).Proof:LetbeafullwalkalongtheMSTinpre-order(thatis,werevisitverticesaswebacktrackthroughthem).InFigure5,wouldbethepathalongallthearrows,wrappingaroundtheentireMST,namely,1!2!1!3!4!5!4!6!4!!1.Itisclearthatcost()=2MST(I).Now,thetoutoutputbyAisasubsequenceofthefullwalk,sobythetriangleinequality:A(I)cost()=2MST(I)provingourclaim.Claim:ComparingOPT(I)toMST(I):OPT(I)MST(I).Proof:Letbeanoptimumtour,thatis,cost()=OPT(I).DeletinganedgefromresultsinaspanningtreeT,whosecostbyde nitioniscost(T)MST(I).Hence,OPT(I)=cost()cost(T)MST(I) Page6of7 CS105:Algorithms(Grad)ApproximationAlgorithms(continued)Feb21,2005 asrequired.Combiningthese2claims,weget:A(I)2MST(I)2OPT(I)Hence,Aisa2-approximationalgorithmfor(Metric)TSP.2.6ConcludingRemarksItispossible(andrelativelyeasy)toimprovetheapproximationfactorto3/2forMetricTSP.Notethatintheoriginalwordingoftheproblem,withthesalesmantouringcities,thecost(distance)functionisinfactevenmorestructuredthanjustametric.Here,wehaveEuclideandistance,andasitturnsout,thisfurtherrestrictionallowsustogetaPTAS,althoughthisisamoredicultalgorithm. Page7of7