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

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

View Full Document Right Arrow Icon
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);
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 IEOR 4404, Assignment #7 Solutions A = [A;t]; else % 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);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/17/2010 for the course IEOR 4404 taught by Professor C during the Spring '10 term at Columbia.

Page1 / 7

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online