NivaarExam PrepOfficial exam papers ↗

23-Ind-A6 Systems Simulation · May 2018

Question 3 of 9: Acceptance–Rejection and LCG Period

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

National Exams — May 2018 — 17-Ind-A6 Systems Simulation. Three-hour, closed-book exam; one of two permitted calculators (Sharp or Casio), one 8.5″×11.0″ aid sheet (both sides). Format: three sections — Section A (four concept questions, candidates choose any two, 10 marks each, 20 marks total), Section B (three methods questions built around one continuing warehouse-simulation case study, candidates choose any two, 15 marks each, 30 marks total), Section C (two applications questions, candidates choose any one, 20 marks each). All nine questions are solved below for completeness. Two source anomalies are flagged where they occur: the front-page summary table states Section A is "Do 2 of 3," while Section A's own instructions and its four printed question sets read "two of the following four" — the printed four-question section is answered in full here; and Part C Question 2's sub-parts (a)–(c) are never printed anywhere in the paper, even though the results text for (d)–(f) explicitly refers back to "the factorial design matrix in (a)." Two-page Normal-distribution tables were supplied with the exam; the values below are the same table values obtained by direct computation.

Reference texts: Banks, Carson, Nelson & Nicol, Discrete-Event System Simulation (5th ed., Pearson) — random-number/random-variate generation, input modeling and goodness-of-fit testing, output analysis (warm-up, replication length, batch means vs. replication/deletion), and comparing alternative systems; Montgomery, Design and Analysis of Experiments (current ed., Wiley) — single-factor ANOVA, multiple comparisons, and 2k factorial designs with interaction analysis (Part C).

Question 3 (Part A.3): Acceptance–Rejection and LCG Period (10 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. $q(x)=3x^2/2$ on $-1\le x\le1$; majorizing function $g(x)=3/2$; linear congruential generator (LCG) $a=21,\ m=100,\ c=13,\ X_0=7$.

Find. (a) an acceptance–rejection (A-R) algorithm; (b) two accepted variates from the LCG stream; (c) a comment on the LCG's period.

Approach. Build the standard A-R test using $g$ as the constant envelope; iterate the LCG and apply the test in non-overlapping $(U_1,U_2)$ pairs until two acceptances occur; check the LCG against the Hull–Dobell full-period conditions.

  1. (a) Set up the algorithm. $g(x)=3/2$ bounds $q(x)$ everywhere on $[-1,1]$ (its maximum, at $x=\pm1$, is $3/2$), so:
    Step 1: generate $U_1\sim U(0,1)$ and form the candidate $Y=-1+2U_1$ (uniform on $[-1,1]$).
    Step 2: generate $U_2\sim U(0,1)$.
    Step 3: accept $X=Y$ if $U_2 \le q(Y)/g(Y)=Y^2$; otherwise reject and return to Step 1.
  2. (b) Run the LCG and test candidates. Iterating $X_{i+1}=(21X_i+13)\bmod100$ from $X_0=7$ and testing non-overlapping pairs $(U_1,U_2)$ against $U_2\le Y^2$:
    Acceptance–rejection trial log
    Trial$U_1$$U_2$$Y=-1+2U_1$$Y^2$Accept?
    10.600.730.200.0400reject
    20.460.79−0.080.0064reject
    30.720.250.440.1936reject
    40.380.11−0.240.0576reject
    50.440.37−0.120.0144reject
    60.900.030.800.6400accept
    70.760.090.520.2704accept
    Five candidates are rejected before the sixth and seventh trials succeed — consistent with the algorithm's average acceptance rate of $1/c=2/3$ per candidate† being pulled down here by an unlucky early run. $$\boxed{X_1=0.80,\qquad X_2=0.52}$$
  3. (c) Comment on the period. Apply the Hull–Dobell theorem to $a=21,\ m=100,\ c=13$: (i) $\gcd(c,m)=\gcd(13,100)=1$ ✓; (ii) $a\equiv1$ modulo every prime factor of $m$: $21\equiv1\ (\mathrm{mod}\ 2)$ and $21\equiv1\ (\mathrm{mod}\ 5)$ ✓; (iii) since $4\mid m$, also need $a\equiv1\ (\mathrm{mod}\ 4)$: $21=5(4)+1$ ✓. All three conditions hold, so this LCG achieves the full period $m=100$ — a substantially better design than the pure-multiplicative generators of Questions 1 and 2 (periods $20$ and $10$ respectively), because the additive constant $c$ removes the multiplicative-subgroup restriction that caps a pure MCG's period below $m$ whenever $m$ is composite.

† the constant-envelope area ratio here is $c=g(x)\big/\big(\text{uniform density }1/2\big)=3$, so the expected number of candidates per acceptance is $3$, i.e. an average acceptance probability of $1/3$ — two acceptances in seven trials is well within normal sampling variation of that rate.

ItemResult
(a) algorithmcandidate $Y=-1+2U_1$; accept if $U_2\le Y^2$
(b) two accepted variates$X_1=0.80$, $X_2=0.52$ (after 5 rejections)
(c) LCG periodHull–Dobell fully satisfied — full period $=100$