Wednesday September 4, 2013
This problem concerns a very simple model of the growth of a population of rabbits. It belongs to the general class of "HAVE = HAD + CHANGE" models (what you have now is equal to what you had before, plus what changed).
Your task is to create a much simpler version of the rabbits and wolves model linked here: http://www.shodor.org/interactivate/activities/RabbitsAndWolves/.

In your model, there need only be rabbits; wolves and grass are not required.

Your model should be dynamic by incorporating time in the form of discrete time steps.

Each rabbit in the population has a probability of reproduction, which specifies the chance at each time step that the rabbit will create another rabbit. Your model can assume that, unlike in the model linked above, the environment is always suitable for reproduction, that rabbits do not require food to reproduce, and that rabbits never die.

Your model does not need to include position or motion of the rabbits, but it does need to keep a count of the rabbits. The starting number of rabbits is 1.

Your model can assume that rabbits reproduce asexually, such that it only takes 1, not 2 rabbits to produce a new rabbit. A rabbit must be alive for 1 time step before it can reproduce.

You should run multiple simulations at once, in parallel, for different values of the probability. Each simulation should run for the same number of time steps, and each should report the number of rabbits in the population at the end of the simulation.

The values of probability to use are: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, and 0.9. Run as many simulations in parallel as you have processors available (e.g. if you have a dual-core machine, you could run 0.1 and 0.2 at the same time, then 0.3 and 0.4, then 0.5 and 0.6, etc).

Figure out the most number of time steps you can run and still have all simulations (from 0.1 to 0.9) finish in under 1 minute, and run simulations for 1x, 0.5x, 0.33x, and 0.25x that many time steps.

You can create a Monte Carlo simulation by running multiple simulations per number of time steps, to allow different random values to occur.
Show solution
Challenge Resources:
©1994-2022   |   Shodor   |   Privacy Policy   |   NSDL   |   XSEDE   |   Blue Waters   |   ACM SIGHPC   |     |     |     |     |     |   XSEDE Code of Conduct   |   Not Logged In. Login