Hello everybody :) I am trying to simulate a queue with times of arrival to the queue and time taken to dispatch every member of the queue coming from two exponential distributions, I am interested in knowing the number of people at any time and the time that takes every member of this queue to be dispatched. I thought this was gonna be an easy task but I've failed to try to simulate this, is there any package that does this already? Any help will be greatly appreciated. Thank you very much Carlos -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que est? limpio. For all your IT requirements visit: http://www.transtec.co.uk
On Mon, 2010-03-22 at 02:49 -0600, Carlos Ernesto Lopez Nataren wrote:> Hello everybody :) I am trying to simulate a queue with times of arrival to the queue and time taken to dispatch every member of the queue coming from two exponential distributions, I am interested in knowing the number of people at any time and the time that takes every member of this queue to be dispatched. > > I thought this was gonna be an easy task but I've failed to try to simulate this, is there any package that does this already? > > Any help will be greatly appreciated. > > Thank you very much > CarlosCarlos, if I understand your problem do you need know the time for each person in a queue dispatched. You say this time fit a exponential distribution, so do you have a rate of dispatch (x dispatch per time) If I want generate 10 times of dispatch rate 0.4, use the command times <- rexp(10,0.4) If I need the total delay for each person, use the command cumsum(times) If I need the average time in the queue, use the command means(cumsum(times)) -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil
What does it mean to "dispatch every member"? Is this a single server queue where processing is done FIFO through a single server, or is it just every member has to wait a predetermined time for processing? If a single server queue, then you can determine the arrival time and then iterate and add the processing time for each item and determine if the next one is still in the queue to determine how to modify that time. This is what a discrete event simulator does. You will have to check each event and its time to determine what happens. There are analytical formulas for simple single/multi-server queues. Your problem discription does not define "what problem you are trying to solve". If you are just trying to determine how many are in the queue based on an arrival rate and response time, then apply Little's Law (N = A * R). On Mon, Mar 22, 2010 at 4:49 AM, Carlos Ernesto Lopez Nataren < natorro@fisica.unam.mx> wrote:> > Hello everybody :) I am trying to simulate a queue with times of arrival to > the queue and time taken to dispatch every member of the queue coming from > two exponential distributions, I am interested in knowing the number of > people at any time and the time that takes every member of this queue to be > dispatched. > > I thought this was gonna be an easy task but I've failed to try to simulate > this, is there any package that does this already? > > Any help will be greatly appreciated. > > Thank you very much > Carlos > > -- > Este mensaje ha sido analizado por MailScanner > en busca de virus y otros contenidos peligrosos, > y se considera que está limpio. > For all your IT requirements visit: http://www.transtec.co.uk > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]