排队模型(matlab代码)

排队模型(matlab代码)

ID:43849510

大小:76.31 KB

页数:5页

时间:2019-10-15

排队模型(matlab代码)_第1页
排队模型(matlab代码)_第2页
排队模型(matlab代码)_第3页
排队模型(matlab代码)_第4页
排队模型(matlab代码)_第5页
资源描述:

《排队模型(matlab代码)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、functionout=MMSmteam(s,m,mu1,mu2,T)%M/M/S/m排队模型%s——修理工个数%m——机器源数%T——时间终止点%mu1——机器离开-到达时间服从指数分布%mu2——修理时间服从指数分布%事件表:%p_s——修理工空闲概率%arrive_time——机器到达事件%leave_time——机器离开事件%mintime——事件表中的最近事件%current_time——当前时间%L——队长%tt——时间序列%LL——队长序列%c——机器到达时间序列%b——修理开始时间序列%e——机器离开时间序列%a_count——到

2、达机器数%b_count——修理机器数%e_count——损失机器数%初始化arrive_time=exprnd(mu1,1,m);arrive_time=sort(arrive_time);leave_time=[];current_time=0;L=0;LL=[L];tt=[current_time];c=[];b=[];e=[];a_count=0;%循环whilemin([arrive_time,leave_time])

3、time];%记录时间序列ifcurrent_time==min(arrive_time)%机器到达子过程arrive_time(1)=[];%从事件表中抹去机器到达事件a_count=a_count+1;%累加到达机器数ifL

4、time);%离开事件表排序else%无空闲修理工L=L+1;%更新队长c=[c,current_time];%记录机器到达时间序列endelse%机器离开子过程leave_time(1)=[];%从事件表中抹去机器离开事件arrive_time=[arrive_time,current_time+exprnd(mu1)];arrive_time=sort(arrive_time);%到达事件表排序e=[e,current_time];%记录机器离开时间序列ifL>s%有机器等待L=L-1;%更新队长b=[b,current_time];%记录修

5、理开始时间序列leave_time=[leave_time,current_time+exprnd(mu2)];%产生新的机器离开事件leave_time=sort(leave_time);%离开事件表排序else%无机器等待L=L-1;%更新队长endendLL=[LL,L];%记录队长序列endWs=sum(e-c(1:length(e)))/length(e);Wq=sum(b-c(1:length(b)))/length(b);Wb=sum(e-b(1:length(e)))/length(e);Ls=sum(diff([tt,T]).*

6、LL)/T;Lq=sum(diff([tt,T]).*max(LL-s,0))/T;p_s=1.0/(factorial(m)/factorial(m).*(mu2/mu1)^0+factorial(m)/factorial(m-1).*(mu2/mu1)^1+factorial(m-2)/factorial(m-1).*(mu2/mu1)^2+factorial(m)/factorial(m-2).*(mu2/mu1)^2+factorial(m)/factorial(m-4).*(mu2/mu1)^4+factorial(m)/factori

7、al(m-5).*(mu2/mu1)^5);fprintf('修理工空闲概率:%d',p_s)%修理工空闲概率fprintf('到达机器数:%d',a_count)%到达机器数fprintf('平均逗留时间:%f',sum(e-c(1:length(e)))/length(e))%平均逗留时间fprintf('平均等待时间:%f',sum(b-c(1:length(b)))/length(b))%平均等待时间fprintf('平均修理时间:%f',sum(e-b(1:length(e)))/length(e))%平均修理时间f

8、printf('平均队长:%f',sum(diff([tt,T]).*LL)/T)%平均队长fprintf('平均等待队长:%f

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。