queue_step: Compute the departure times and queue lengths for a queueing...

View source: R/core_queuefunctions.R

queue_stepR Documentation

Compute the departure times and queue lengths for a queueing system from arrival and service times.

Description

Compute the departure times and queue lengths for a queueing system from arrival and service times.

Usage

queue_step(arrivals, service, servers = 1, labels = NULL)

Arguments

arrivals

numeric vector of non-negative arrival times

service

numeric vector of service times with the same ordering as arrival_df.

servers

a non-zero natural number, an object of class server.stepfun or an object of class server.list.

labels

character vector of customer labels (deprecated).

Details

If only departure times are needed, the queue function is faster.

Value

An list object of class queue_list with the following components:

  • departures - A vector of response times for the input of arrival times and service times.

  • server - A vector of server assignments for the input of arrival times and service times.

  • departures_df - A data frame with arrivals, service, departures, waiting, system time, and server assignments for each customer.

  • queuelength_df - A data frame describing the evolution of queue length over time

  • systemlength_df - A data frame describing the evolution of system length over time

  • servers_input - A copy of the server argument

  • state - A vector of availability times for the servers

See Also

queue, summary.queue_list, plot.queue_list

Examples


# With two servers
set.seed(1)
n <- 100

arrivals <- cumsum(rexp(n, 3))
service <- rexp(n)


queue_obj <- queue_step(arrivals,
    service = service, servers = 2)


summary(queue_obj)
plot(queue_obj, which = 5)

# It seems like the customers have a long wait.
# Let's put two more servers on after time 20


server_list <- as.server.stepfun(c(20),c(2,4))

queue_obj2 <- queue_step(arrivals,
    service = service,
    servers = server_list)

summary(queue_obj2)
if(require(ggplot2, quietly = TRUE)){

    plot(queue_obj2, which = 5)

}



queuecomputer documentation built on Nov. 16, 2022, 1:07 a.m.