queue: Compute the departure times for a set of customers in a queue...

Description Usage Arguments Details See Also Examples

View source: R/core_queuefunctions.R

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

1
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 server.stepfun or an object of class server.list.

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

queue_step

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)

queuecomputer documentation built on April 9, 2021, 5:06 p.m.