19基于蚁群算法的QoS组播路由问题MATLAB源代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

欢迎访问GreenSim团队主页→邮箱:greensim@163.com第1页基于蚁群算法的QoS组播路由问题MATLAB源代码QoS组播路由是网络路由优化和计算智能领域研究的热点,这里的QoS约束包含常见的时延、时延抖动、带宽、丢包率,优化目标是组播树的费用最小化,该问题已被证明是NP完全问题,常规算法通常难以达到理想效果。蚁群算法凭借其独特的启发式规则和分布式特性,在QoS组播路由问题上取得成功应用。%%---------------------------------------------------------------clcclearcloseall%%---------------------产生网络拓扑结构----------------------------%GreenSim团队——专业级算法设计&代写程序%欢迎访问GreenSim团队主页→=1000;%正方形区域的边长,单位:kmNodeAmount=25;%网络节点的个数Alpha=100000000;%网络特征参数,Alpha越大,短边相对长边的比例越大Beta=200000000000;%网络特征参数,Beta越大,边的密度越大PlotIf=1;%是否画网络拓扑图,如果为1则画图,否则不画图EdgeCostDUB=[5,5];%链路费用的下界和上界EdgeBandWideDUB=[30,1000];%链路带宽的下界和上界VertexCostDUB=[3,3];%节点费用的下界和上界VertexDelayDUB=1e-4*[5,20];%节点时延的下界和上界VertexDelayJitterDUB=1e-4*[3,8];%节点时延抖动的下界和上界VertexPacketLossDUB=1e-4*[0,500];%节点丢包率的下界和上界figure[Sxy,AM,EdgeCost,EdgeDelay,EdgeBandWide,VertexCost,VertexDelay,VertexDelayJitter,VertexPacketLoss]=...NetCreate(BorderLength,NodeAmount,Alpha,Beta,PlotIf,EdgeCostDUB,EdgeBandWideDUB,VertexCostDUB,VertexDelayDUB,VertexDelayJitterDUB,VertexPacketLossDUB);BFEdgeCost=EdgeCost;title('随机生成的网络拓扑');EBW=min(min(EdgeBandWide));[x,y]=find(EdgeBandWideEBW);Lxy=length(x);fori=1:LxyEdgeCost(x(i),y(i))=inf;EdgeDelay(x(i),y(i))=inf;EdgeBandWide(x(i),y(i))=inf;end欢迎访问GreenSim团队主页→邮箱:greensim@163.com第2页S=13;%起始节点的编号E=[1,3,5,7,9,17,19,21,23,25];%终止节点的编号K=100;%迭代次数(指蚂蚁出动多少波)M=200;%蚂蚁个数(每一波蚂蚁有多少个)Tau=ones(NodeAmount,NodeAmount);%初始信息素矩阵,N×NAlpha=2;%表征信息素重要程度的参数Rho=0.05;%信息素蒸发系数Q=5;%信息素增加强度系数EC=EdgeCost;%链路费用矩阵,N×NED=EdgeDelay;%链路时延矩阵,N×NVC=VertexCost;%节点费用向量,1×NVD=VertexDelay;%节点时延向量,1×NVDJ=VertexDelayJitter;%节点时延抖动向量,1×NVPL=VertexPacketLoss;%节点丢包率向量,1×NCD=1e-3*20;%时延约束CDJ=1e-2*10;%时延抖动约束CPL=0.1;%丢包率约束KD=1000;%延时约束惩罚系数KDJ=10000;%时延抖动惩罚系数KPL=200;%丢包率约束惩罚系数N=length(E);%目的节点的个数ROUTES=cell(1,N);%备选路径集,细胞结构,1×Num个子单元,每个子单元对应一个目的节点Num=zeros(1,N);%每个目的节点的备选路径的个数fori=1:Ndisp(i);[AllRoutes,RC,RD,RDJ,RPL]=ACR(S,E(i),K,M,Tau,Alpha,Rho,Q,EC,ED,VC,VD,VDJ,VPL,CD,CDJ,CPL,KD,KDJ,KPL);ROUTES{i}=AllRoutes;Num(i)=length(AllRoutes);end[MBR,LC1,LC2]=MCRGSA(M,N,Pm,K,t0,alpha,ROUTES,Num,EdgeCost,VertexCost,E);ElapsedTime1=toc;figureNet_plot(BorderLength,NodeAmount,Sxy,BFEdgeCost,1);holdonTree=inf*ones(size(BFEdgeCost));Code=MBR(M,:);fori=1:length(Code)R=ROUTES{i}{Code(i)};J=length(R)-1;forj=1:Ja=R(j);b=R(j+1);欢迎访问GreenSim团队主页→邮箱:greensim@163.com第3页Tree(a,b)=BFEdgeCost(a,b);Tree(b,a)=BFEdgeCost(b,a);endendNet_plot2(BorderLength,NodeAmount,Sxy,Tree,1);holdonfori=1:length(E)j=E(i);plot(Sxy(2,j),Sxy(3,j),'ko','MarkerEdgeColor','b','MarkerFaceColor','r','MarkerSize',10);holdonendholdonplot(Sxy(2,S),Sxy(3,S),'ko','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',12)源代码运行结果展示010020030040050060070080090010000100200300400500600700800900100012345678910111213141516171819202122232425x(km)y(km)随机生成的网络拓扑欢迎访问GreenSim团队主页→邮箱:greensim@163.com第4页010020030040050060070080090010000100200300400500600700800900100012345678910111213141516171819202122232425x(km)y(km)12345678910111213141516171819202122232425020406080100120140160180200140160180200220240260280IterationsFitness

1 / 4
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功