2022年排队模型(matlab代码 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年排队模型(matlab代码 .pdf》由会员分享,可在线阅读,更多相关《2022年排队模型(matlab代码 .pdf(5页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、function out=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到达机器数%b_count修理机器数%e_count损失机器数%初始化arrive_time=exprn
2、d(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;%循环while min(arrive_time,leave_time)Tcurrent_time=min(arrive_time,leave_time);tt=tt,current_time;%记录时间序列if current_time=min(arrive_time)%机器到达子过程arrive_time(1)=;% 从事件表中抹去机器到达事件a_count=a_cou
3、nt+1; %累加到达机器数ifLs%有机器等待L=L-1;%更新队长b=b,current_time;% 记录修理开始时间序列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(
4、e);Ls=sum(diff(tt,T).*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)/factorial(m-5).*(
5、mu2/mu1)5);fprintf( 修理工空闲概率:%dn,p_s)% 修理工空闲概率fprintf( 到达机器数 :%dn,a_count)%到达机器数fprintf( 平均逗留时间 :%fn,sum(e-c(1:length(e)/length(e)% 平均逗留时间fprintf( 平均等待时间 :%fn,sum(b-c(1:length(b)/length(b)%平均等待时间fprintf( 平均修理时间 :%fn,sum(e-b(1:length(e)/length(e)% 平均修理时间fprintf( 平均队长 :%fn,sum(diff(tt,T).*LL)/T)%平均队长fp
6、rintf( 平均等待队长 :%fn,sum(diff(tt,T).*max(LL-s,0)/T)%平均等待队长for i=0:mp(i+1)=sum(LL=i).*diff(tt,T)/T;%队长为 i 的概率fprintf( 队长为 %d 的概率 :%fn,i,p(i+1);名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 5 页 - - - - - - - - - endfprintf( 机器不能马上得到修理的概率:%fn,1-sum(p(1:s)% 机器不能马上得到
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年排队模型matlab代码 2022 排队 模型 matlab 代码
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内