[R] queue simulation

Norm Matloff matloff at cs.ucdavis.edu
Mon Dec 22 22:20:36 CET 2008


> Date: 22-Dec-2008 10:11:28 GMT
> From: "Gerard M. Keogh" <GMKeogh at justice.ie>
> Subject: [R] queue simulation
> To: r-help at r-project.org
> 
> Hi all,
> 
> 
> I have a multiple queing situation I'd like to simulate to get some idea of
> the distributions - waiting times and allocations etc.
> Does R has a package available for this - many years ago there used to be a
> language called "simscript" for discrete event simulation and I was
> wondering if R has an equivalent (or hopefully with graphics, something
> better!).

To my knowledge, this doesn't exist, but one never knows.  I look
forward to hearing the other responses.

Discrete-event simulation (DES) is generally done under one of two main
world views--event-oriented, process-oriented.  The more popular is
probably the process-oriented view, but it requires something like
threading, which would be problematic in R.  

It would be easy to take the event-oriented view, as it would just
require coding up some kind of priority queue routine.  In fact, a
couple of weeks ago I made a note to myself to do this as an example of
how one could do linked data structures in R.  Again, this view is
considered a poor way to program DES, but if you are interested, feel
free to contact me.

I very much like (and am somewhat involved in the development of) SimPy,
a Python-based DES package.  You could use SimPy for your simulation and
use RPy to access R from SimPy, to take advantage of R's graphics and
statistics facilities.

SimPy is at http://simpy.sourceforge.net/  Also, I have a tutorial on it
at http://heather.cs.ucdavis.edu/~matloff/simcourse.html

Norm Matloff
University of California, Davis



More information about the R-help mailing list