📄 s2rout4.m
字号:
% Routine 2.4 a = 1; % arrival time parameterm = 10; % number of processorsmu = 8; % mean processing timesig = 3; % s.d. of the processing timeQ = 1:m; % set the # processors = mQ = 0*Q; % initialize the queue of m processorswait=0; % initialize total waiting timeN = 10000; % experiment with N customers % store opensfor k=1:N % watch N customers T = -a*log(1-rand); % arrival time of new customer C S = mu + sig*randn; % compute time to service C Q = max(Q - T, 0); % update the queues to present t = min(Q); % shortest line wait time t for i=1:m % check to see which line is shortest: if Q(i) <= t j = i; break; end; % endif end; % queue j has shortest wait wait = wait + Q(j); % add in time until C to reaches cashier Q(j) = Q(j) + S; % time for C to clear queue jend; % store closeswait/N % average time to reach cashier
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -