{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw7sol - IEOR 4404 Simulation Prof Mariana Olvera-Cravioto...

This preview shows pages 1–3. Sign up to view the full content.

IEOR 4404 Assignment #7 Solutions Simulation 5th November 2006 Prof. Mariana Olvera-Cravioto Page 1 of 7 Assignment #7 Solutions 1. % This program generates a single server queue with nonhomogeneous Poisson % arrivals and a server that takes a break at the end of each busy cycle. % If upon returning from the break there are no jobs waiting, then the % server takes another break. % Variables: % t % n = number of customers in the system % NA = number of arrivals % ND = number of departures % tA = time of next arrival % tD = time of next departure % tB = time until the server returns from a break % A = vector of arrivals % D = vector of departures % TotalTimeOnBreak = total amount of time that the server is on a break % in a given simulation run % AvgTimeonABreak = array of size 500 that keeps track % of the average time spent on a break in each run for i =1:500 M = 10^(10); % A very large value to represent infinity T = 100; % Length of the simulation % Initialize t = 0; NA = 0; ND = 0; n = 0; lambda = 19; lambdat = 4; tA = nextarrival(t,lambdat,lambda); tD = M; tB = 0.3*rand(1,1); %here we make the assumption that the server is initially on a break A = []; D = []; TotalTimeOnBreak = tB; % Algorithm while t <= T if tA <= min(tD,tB) % There is an arrival t = tA; NA = NA + 1; n = n + 1; lambdat = DetermineRate(t); tA = nextarrival(t,lambdat,lambda);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 IEOR 4404, Assignment #7 Solutions A = [A;t]; else if tD < tA & tD <= tB % There is a departure t = tD; n = n - 1; ND = ND + 1; if n == 0 % Server becomes idle tD = M; % Generate the length of the break, Uniform(0,0.3) tB = t + 0.3*rand(1,1); else % Generate service time of new job, Exponential(25) Y = Exponential(25);
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}