HO 4 CSC 354S SYSTEMS MODELING AND DISCRETE SIMULATION SPRING 1997 UNIVERSITY OF TORONTO MIDTERM TEST DURATION - 50 minutes Test aids allowed: One 8.5 X 11" fact sheet, possibly double-sided Notes to students: A. There are a total of 50 marks and 50 minutes to obtain them. B. The test paper has 6 questions. Write your answers on the paper or booklets provided. C. In general, state your assumptions and show your intermediate work leading to an answer. 1. [5 marks] Explain in sufficient detail how the Utilization Law is really just Little's Law in disguise. Little's Law, applied to some system, says that the mean number in that system is equal to the product of the arrival rate to the system and the mean time spent in the system. If the system represents the server only, then the mean number there is the utilization (the probability of finding someone there) and the mean time spent there is the mean service time. If the mean arrival rate to the server is equal to the mean rate of work that flows through the server, then the Utilization Law (the utilization of a server is equal to the product of the throughput through the server and the mean service time) is really just Little's Law. 2. [6 marks] State 2 reasons why we want the generation of a random number stream to be reproducible. I. It makes the debugging of a computer program for a simulation easier, because you can re-test execution flow with the same inputs after doing a bug fix. II. It makes the comparison of 2 or more systems easier when doing simulations, because the systems are subjected to the same workload. 3. [5 marks] In a multiplicative LCG with modulus m , why is the maximum period m-1 ? The absolute maximum period for any LCG is m . For a multiplicative LCG, 0 cannot be a valid value, as that would cause immediate cycling in a multiplicative LCG. Therefore, the maximum period for such an LCG is m - 1 . 4. [10 marks] Let X be a random variable that is normally distributed with a mean m of 10 and a variance of 4. Using reasonable interpolations in the absence of a calculator, find the values of a and b such that i) P ( a < X < b ) = 0.90 , and ii) | m - a | = | m - b | P ( X < b ) = P ( X > a ) = 0. 95 , by symmetry F ( [ ( b - 10 ) / 2 ] = .95 , so by table lookup, b = 13.3 Immediately by symmetry, a = 6.7 5. [10 marks] Suppose that X and Y are random variables such that Y = aX + b , where a and b are constants. Show that correlation ( X , Y ) = + 1 if a > 0 - 1 if a < 0 cov ( X , Y ) = cov ( X , aX + b ) = a Var ( X ) Var ( Y ) = Var ( aX + b ) = a2 Var ( X ) corr ( X , Y ) = cov ( X , Y ) / ™ [ Var ( X ) Var ( Y ) ] = a Var ( X ) / ™ [ Var (X ) a2 Var ( X ) ] = a / ™ (a2) = + 1 if a > 0 , and -1 if a < 0 6. [14 marks] Show how the composition method can be used to generate a variate with probability density function x 0 œ x œ 1 f ( x ) = 2 - x 1 œ x œ 2 0 elsewhere f is a triangular distribution. Rewrite f as f(x) = 0.5 f1(x) + 0.5 f2(x), where f1 ( x ) = 2 x , 0 œ x œ 1 f2 ( x ) = 4 - 2 x , 1 œ x œ 2 then F1( x ) = x2 on the appropriate interval, and F2( x ) = 4 x - x2 - 3 on the appropriate interval. F1-1( u ) = ™ ( u ) , and F2-1( u ) = 2 - ™ (1 - u) . Generate a u1 ~ U (0,1) and if u1 œ 0.5, then sample from f1; otherwise, sample from f2 Generate u2 ~ U(0,1) to sample from f1 or f2.