daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clear;close all;clc;
  2.  
  3. lambda = .5;
  4. Ts = 2;
  5. Tf = 10;
  6.  
  7. N = 10;
  8.  
  9. jobs = - log(rand(1, N)) / lambda;
  10. job_durations = mod(rand(1, N), Tf) + Ts;
  11.  
  12. T0 = 0;
  13.  
  14. t = [];
  15. t_start = [];
  16. t_end = [];
  17. for c = 1:N
  18.     if c == 1
  19.         t(c) = T0;
  20.         t_start(c) = T0;
  21.         t_end(c) = T0 + mod(rand(), Tf) + Ts;
  22.     else
  23.         t(c) = t(c - 1) + jobs(c);
  24.         t_start(c) = max(t(c), t_end(c - 1));
  25.         t_end(c) = t_start(c) + mod(rand(), Tf) + Ts;
  26.     end
  27. end
  28.  
  29. fprintf('Cреднее время нахождения заявки в системе: %f\n', mean(t_end - t_start));
  30. fprintf('Cреднее время ожидания в очереди: %f\n', mean(t_start - t));
  31. fprintf('Cреднее время простоя обслуживающего прибора: %f\n', mean(t_start(2:end) - t_end(1:end - 1)));
  32.  
  33. queue = [];
  34. lock = false;
  35.  
  36. % fprintf('Средняя длина очереди: %f\n', );
  37. % fprintf('Максимальная длина очереди: %f\n', );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top