Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15514 > unrolled thread

a queue

Started byFrancisco Gutierrez <fgutiers2002@yahoo.com>
First post2013-09-23 06:46 +0000
Last post2013-09-30 05:20 +0000
Articles 4 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  a queue Francisco Gutierrez <fgutiers2002@yahoo.com> - 2013-09-23 06:46 +0000
    Re: a queue "Dr. Wolfgang Hintze" <weh@snafu.de> - 2013-09-27 06:32 +0000
    Re: a queue Francisco Gutierrez <fgutiers2002@yahoo.com> - 2013-09-29 01:24 +0000
    Re: a queue "Dr. Wolfgang Hintze" <weh@snafu.de> - 2013-09-30 05:20 +0000

#15514 — a queue

FromFrancisco Gutierrez <fgutiers2002@yahoo.com>
Date2013-09-23 06:46 +0000
Subjecta queue
Message-ID<l1oo3e$j7b$1@smc.vnet.net>
Dear Friends:
I have a simple queue with the following characteristics:

First, there is a VERY long list of customers waiting before the system started to operate. 
Second, the service rate is better (faster) than the arrivals rate

I want to calculate the times at which  the guys who were in the waiting list before the system started will be served
What should I do?

mathematica 9.0

Francisco

[toc] | [next] | [standalone]


#15554

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2013-09-27 06:32 +0000
Message-ID<l238p7$h69$1@smc.vnet.net>
In reply to#15514
Am Montag, 23. September 2013 08:46:06 UTC+2 schrieb Francisco Gutierrez:
> Dear Friends:
>
> I have a simple queue with the following characteristics:
>
>
>
> First, there is a VERY long list of customers waiting before the system started to operate.
>
> Second, the service rate is better (faster) than the arrivals rate
>
>
>
> I want to calculate the times at which  the guys who were in the waiting list before the system started will be served
>
> What should I do?
>
>
>
> mathematica 9.0
>
>
>
> Francisco

The following code (in Version 8, but it should also work in Version 9) gives a simple example of the treatment of the queueing problem with one Server and one queue.

Let us suppose that a customer who has arrived at t=ta will exit from the system (after having been served) at time t=te.
Let the duration of service be s.
Now let's adopt the following strategy: as there is only one server available, the service to a customer starts when the server has finished possible earlier tasks. Assuming furthermore that there is only one queue and adopting the principle first come first serve (which is very natural in this case) we have

te = Max[ta,te']+s

where te' is the exit time of the previous customer. Given ta and s, this formula provides recursively the exit times.

We now make the model explicit by a simulation which uses random variables as follows

ta: the influx of customers is assumed to be a Poisson process, i.e. the time differences dta between consecutive arrivals are exponentially distributed
s: the service time is exponentially distributed

The code then calculates the exit times te.

* start of code *)

a := -Log[Random[]] (* time difference between two consecutive customers *)
s := -4/5 Log[Random[]] (* serivce time *)

dta = Array[a &, 10^2]; (* array of differences of arrival times *)

ta = FoldList[Plus, 0, dta]; (* array of arrival times *)

te = Array[0 &, Length[ta]]; (* array of exit times, initiation *)

Table[te[[i]] = Max[ta[[i]], te[[i - 1]]] + s, {i, 2,
  Length[ta]}]; (* calculation of the exit times *)

(* graphis output *)
gta = ListPlot[ta, PlotStyle -> RGBColor[1, 0, 0], ImageSize -> 600,
   PlotLabel ->
    "Simulation of a queueing system (1 queue, 1 server)\nred : arrival time\n\
black: exit time", DisplayFunction -> Identity];
gte = ListPlot[te + 2, DisplayFunction -> Identity];
Show[Graphics[gta, RGBColor[1, 0, 0]], Graphics[gte],
 AxesLabel -> {"Customer", "Times"}, DisplayFunction -> $DisplayFunction]

(* end of code *)

[toc] | [prev] | [next] | [standalone]


#15560

FromFrancisco Gutierrez <fgutiers2002@yahoo.com>
Date2013-09-29 01:24 +0000
Message-ID<l27vgn$sco$1@smc.vnet.net>
In reply to#15514
Mant thanks for this, extremely useful

Francisco

[toc] | [prev] | [next] | [standalone]


#15566

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2013-09-30 05:20 +0000
Message-ID<l2b1m2$6sf$1@smc.vnet.net>
In reply to#15514
Am Sonntag, 29. September 2013 03:24:39 UTC+2 schrieb Francisco Gutierrez:
> Mant thanks for this, extremely useful
> 
> 
> 
> Francisco

I suggest to consider the following extensions of the Basis queueing problem:

1) "fair queue": 1 queue, n Server, n>1
2) "supermarket": n Queues, n Server, n>1

and to encode them in Mathematica.

Best regards,
Wolfgang

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web