queue {queuecomputer} | R Documentation |
Compute the departure times for a set of customers in a queue from their arrival and service times.
Description
queue
is a faster version of queue_step
but the input returned is much simpler. It is not compatible with the summary.queue_list
method or the plot.queue_list
method.
Usage
queue(arrivals, service, servers = 1, serveroutput = FALSE)
Arguments
arrivals |
numeric vector of non-negative arrival times |
service |
numeric vector of non-negative service times |
servers |
a non-zero natural number, an object of class |
serveroutput |
boolean whether the server used by each customer should be returned. |
Details
If the arrival vector is out of order the function will reorder it. The same reordering will be applied to the service vector, this is so each customer keeps their service time. Once the queue is computed the original order is put back.
See Also
Examples
n <- 1e2
arrivals <- cumsum(rexp(n, 1.8))
service <- rexp(n)
departures <- queue(
arrivals, service, servers = 2)
head(departures)
curve(ecdf(departures)(x) * n,
from = 0, to = max(departures),
xlab = "Time", ylab = "Number of customers")
curve(ecdf(arrivals)(x) * n,
from = 0, to = max(departures),
col = "red", add = TRUE)
[Package queuecomputer version 1.2.0 Index]