- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
Chapter8
Thegreedyapproach—Anefficientapproachforoptimizationproblems
Whatwehaveknownafterpreviouslearning…DynamicprogramminganditsgeneraldiagramOptimalsubstructureThelongestcommonsubsequenceproblemMatrixchainmultiplicationTheall-pairsshortestpathproblemTheknapsackproblem
ContentsofcurrentchapterIntroductionoftheGreedyApproachTheshortestpathproblemMinimumcostspanningtreesKruskal’sAlgorithmPrim’sAlgorithmFilecompression
8.1IntroductionComparedwiththeDynamicProgrammingAlgorithms:Greedyalgorithmsaredesignedtosolveoptimizationproblemsinwhichaquantityistobeminimizedormaximized,too.ButGreedyalgorithmstypicallyconsistofaniterativeprocedurethattriestofindalocaloptimalsolution.Insomeinstances,theselocaloptimalsolutionstranslatetoglobaloptimalsolutions.Inothers,theyfailtogiveoptimalsolutions.
BasicideaAgreedyalgorithmmakesacorrectguessonthebasisoflittlecalculationwithoutworryingaboutthefuture.Itbuildsasolutionstepbystep.Eachstepincreasesthesizeofthepartialsolutionandisbasedonlocaloptimization.Thechoicemadeisthatwhichproducesthelargestimmediategainwhilemaintainingfeasibility.Sinceeachstepconsistsoflittleworkbasedonasmallamountofinformation,theresultingalgorithmsaretypicallyefficient.
Anexample:FractionalKnapsackProblemProblemdescription:Givennitemsofsizess1,s2,...,sn,andvaluesv1,v2,...,vnandsizeC,theknapsackcapacity,theobjectiveistofindnonnegativerealnumbersx1,x2,…xnthatmaximizethesumSubjecttotheconstraint
Examplen=3,C=20,(v1,v2,v3)=(25,24,15), (s1,s2,s3)=(18,15,10)Feasiblesolutions: (x1,x2,x3) ?sixi ?vixi (1)(1/2,1/3,1/4) 16.5 24.5 (2)(1,2/15,0) 20 28.2 (3)(0,2/3,1) 20 31 (4)(0,1,1/2) 20 31.5
Selectionstrategy-1Choosetheonewiththemaximalvaluefromtheremainitemsintotheknapsack.Solution(2)(1,2/15,0) 20
您可能关注的文档
- 《Linux原理及应用》第10章 Shell编程-教学课件(非AI生成).ppt
- 《Linux原理及应用》第11章 Linux系统管理-教学课件(非AI生成).ppt
- 《Linux原理及应用》第13章 Linux的图形环境-教学课件(非AI生成).ppt
- 《Linux原理及应用》第14章 Linux编程-教学课件(非AI生成).ppt
- 《算法设计技巧与分析》第1章 算法分析的基本概念-教学课件(非AI生成).ppt
- 《算法设计技巧与分析》第4章 堆和不相交集数据结构(英文)-教学课件(非AI生成).ppt
- 《算法设计技巧与分析》第4章 堆和不相交集数据结构-教学课件(非AI生成).ppt
- 《算法设计技巧与分析》第5章 归纳法(英文)-教学课件(非AI生成).ppt
- 《算法设计技巧与分析》第6章 分治(英文)-教学课件(非AI生成).ppt
- 《算法设计技巧与分析》第6章 分治-教学课件(非AI生成).ppt
文档评论(0)