资源描述:
《求解最大流问题的matlab程序(matlab program for solving maximum flow problems)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、求解最大流问题的matlab程序(Matlabprogramforsolvingmaximumflowproblems)MaximumflowalgorithmAlgorithmidea:themaximumflowproblemisactuallyafeasibleflow{fij},whichmakestheV(f)reachthemaximum.IfyougiveafeasibleflowF,aslongasthereisnojudgmentinNaugmentingpathontheF,ifthereisanaugmen
2、tedpath,improvedF,anewfeasibleflowrateincreases;ifthereisnoaugmentingpath,getthemaximumflow.1.labelingmethodformaximumflow(Ford,Fulkerson)Startingwithafeasibleflow(ageneralzeroflow),thefollowinglabelingprocedureandtheadjustmentprocessarefolloweduntilnoaugmentingpatha
3、boutFcanbefound.(1)labelingprocessInthisprocess,thepointsinthenetworkaredividedintolabeledandunlabeledpoints,andthelabeledpointsaredividedintotwokinds:checkedandunchecked.Eachlabellabelinformationpointsareexpressedintwoparts:thefirstlabelshowthatthelabelfromwhichpoin
4、ttostartthetracebackpathfromtheVTtofindoutisaugmented;secondlabelissaidtohavecheckedwhetherthevertex.Atthestartofthelabel,markvs(s,0),whenvsisthelabel,butattheendofthecheckpoint,andtherestareunlabeledpoints,denotedas(0,0).TakealabelwithoutcheckingthepointVI,forallunl
5、abeledpoints,vj:A.forarc(VI,VJ),iffij0,thengivetheVJlabel(-vi,0),thentheVJpointbecomesthelabel,whichisnotchecked.Thus,VIbecomesalabeledandcheckedpoint,anditssecondlabe
6、lisdenotedas1.Repeatthestepsaboveand,onceVTismarked,indicateanextendedpathfromVItoP,andVTintotheadjustmentprocess.Ifallthelabelshavebeencheckedandthelabelprocessfails,thealgorithmendswiththefeasibleflowbeingthemaximumflow.(2)adjustmentprocessFromtheVTpoint,throughthe
7、firstlabelofeachpoint,backwardtracing,wecanfindtheaugmentingpathP.Forexample,ifthefirstlabelofVTisVK(or-vk),thenthearc(VK,VT)(orcorrespondingly(VT,VK))isthearcontheP.Next,checkthefirstlabelofVK,andifitisVI(or-vi),find(VI,VK)(orVI(VK)).CheckthefirstlabelofVI,andsoon,u
8、ntilvs.Atthispoint,theentireaugmentingpathisfound.CalculatetheQatthesametimeasyoulookfortheaugmentingpath:Q=min{min(cij-fij),minf*i