View source: R/core_queuefunctions.R
queue_step | R Documentation |
Compute the departure times and queue lengths for a queueing system from arrival and service times.
queue_step(arrivals, service, servers = 1, labels = NULL)
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 |
labels |
character vector of customer labels (deprecated). |
If only departure times are needed, the queue
function is faster.
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
queue
, summary.queue_list
, plot.queue_list
# 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) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.