1. Dr. McLay on Punk Rock Operations Research posted the following exam question she gave to a stochastic processes class:

    Question: There is a zombie outbreak in Richmond. The zombie population can be modeled as a linear growth birth death process.  Each zombie independently reproduces at a rate of λ = 2/hour and is killed by resourceful Virginians at a rate of μ = 0.5/hour.  If the population started with a pack of two zombies, find the average size of the zombie population after 24 hours.

    Answer: The average size of the population can be modeled using a linear growth birth death process. Let Ei denote the expected size of the zombie population after 24 hours given that there are initially i zombies. Then Ei = i * E1.

    The expected size of the zombie population is given by

    Ei = ie^((λ-μ)t) = 2*e^36 after t=24 hours. That is a lot of zombies!

    Math is cool.  There are some assumptions that go into this solution that are addressed in her post.

     
  2. Prof. Laura McLay over at Punk Rock Operations Research (which is among the cooler names for a blog I’ve ever seen) included these awesome questions on a stochastic processes final exam this past semester:

    The werewolf question: The werewolf population in the Richmond area can be modeled as a linear growth birth and death process.  Each werewolf independently reproduces at a rate of lambda = 0.15 werewolves/year and is killed by vampires at a rate of mu = 0.1/year.  If the population started with a pack of three werewolves in the year 1860, find the average size of the werewolf population today (150 years later).

    The Star Wars question (pre-Episode IV): Suppose that every month, Darth Vader organizes a gathering on the Death Star to build morale and promote bonding among the Storm Troopers.  The Storm Troopers’ attendance at the gatherings is represented by a Markov chain.  Given that a Storm Trooper has attended the last gathering (state 0), they go to the next gathering with probability p0.  In general, given that they last attended the kth prior gathering, they go to the next gathering with probability pk, with0 < pk < 1 , k = 0,1,2,3,4.   Storm Troopers are required to attend a gathering every six months, and hence, given that they last attended the 5th prior gathering, they go to the next gathering with probability 1 (p5 = 1).

    a. Define the Markov chain for this problem, specify the classes, and determine whether they are recurrent or transient.

    b. What is the cumulative density function representing the number of months until a Storm Trooper first returns to the gathering (i.e., the first return to state 0)?  Assume that they have just attended a gathering (i.e., they start in state 0).

    b.  In the long run, what is the proportion of Storm Troopers that have attended one of the last three gatherings?

     
  3. Stochastic “Inventory Control”

    -[ background ]-
     
    In the Spring of 2003, I took a course in stochastic processes. The second exam was take home and it required some coding, which I did in TurboPascal, as in the case of my tic tac toe program one year later (the posting of which reminded me of the code from my stochastic processes class).

    -[ assignment and notes ]-

    A local store uses an (s, S) inventory policy for a particular product. Every Friday evening after the store closes, the inventory level is checked. If the stock level for the product is greater than s, no action is taken. Otherwise, if the stock on hand is less than or equal to s, an amount S-s is procured over the weekend and is available when the store re-opens on Monday morning.

    Let {Xn, n = 1, 2, …} be the stock on hand when the inventory is checked on Friday evening of week n and let {Zn, n = 1, 2, …} be the demand for product during week n.

    Then for any ω ∈ Ω,

       Xn+1(ω) = Xn(ω) - Zn+1(ω)  if s < Xn(ω), Zn+1(ω) ≤ Xn(ω)    Xn+1(ω) = S - Zn+1(ω)  if Xn(ω) ≤ Zn(ω) ≤ S    Xn+1(ω) = 0  otherwise.

    Let s = 3, S = 5, X0 = 0 and assume customers arrive at the store according to a Poisson process with rate λ = 4 per week. (Each customer wants one unit of product.)

    Phase I of the exam required the proof that {Xn, n = 1, 2, …} is a Markov chain and writing its transition matrix. These are intuitive (or you’re looking for the answers to your exam, assuming the prof. still uses this exam), so I won’t include them here.

    Phases II and III of the exam required some coding.

    Phase II

    A) Write a program to generate (i.e., fill in) the one-step transition matrix for a passed value of S. Print the one-step matrices for S = 4.

    B) Let π[0] = (1, 0, …, 0). Write a program to compute the equilibrium probabilities of the Markov chain using Jacobi iteration.
    Also, plot πj[0] as a function of n, i.e., the number of Jacobi iterations.

    Jacobi Iteration.

    Jacobi Iteration is a simple computational technique for obtaining the equilibrium probabilities of a Markov chain using a series of matrix multiplies rather than solving a system of linear equations.

    Let π[n] be the probability row vector representing the probability of occupying a given state after n transitions. That is, πj[n] = P{in state j after n transitions}.

    By conditioning on the state occupied at transition n we have

    π[n+1] = π[n]P  (Eqn 1)

    where P is the one-step transition matrix for the Markov chain. In the limit as n goes to ∞, π[n] goes to π, the vector of equilibrium probabilities. Depending on the system and the desired accuracy, convergence can be quite rapid.

    To compute the equilibrium probabilities, start with π[0], then compute π[1], then π[2] and so on using Equation 1 until π[n+1] is “close” to π[n]. For this problem, stop iterating when

    Max{|πj[n+1] - πj[n]|, all j in State Space} = 0.0001.

    Computational note: Due to round-off error by the computer, it may be necessary to “re-normalize” π[n] every few iterations so that its elements sum to one. To do this, add up the first m-1 elements of the vector π[n] (assuming the chain has m states) then set the mth element equal to one minus the sum. The elements now sum to one.

    The source code and binaries for the solutions to these Phase II questions are linked below. I’m not including Phase III’s code because, unlike Phase II’s, it does not have many possible uses outside the context of this exam. Phase II’s code is relevant because somewhere, someone might want to write a simple program to perform Jacobi iterations or to write one-step transition matrices. This code could easily be extended for other (non-Poisson) arrival distributions and/or for generation of the n-step transition matrix.

    -[ license ]-
     
    The code and the accompanying binaries are distributed with NO LICENSE; don’t blame me if this messes up your computer. Please do let me know if you find an error, though.

    -[ downloads ]-

     
Related Posts Plugin for WordPress, Blogger...