Utilization output
Closed this issue · 5 comments
I've been using the queue_step function with dynamic inputs for the service, arrivals, and servers inputs in a loop (it's fantastic, by the way). I sometimes get an error where the utilization statistic from the summary function will not change for each iteration (it will retain the first utilization statistic in the loop). I can't pinpoint the issue exactly, but when I include a dynamic input (say, from a dataframe in the form of df$column[i]
), this issue will sometimes arise. When I change the dynamic input to a raw value, the utilization value will change. Any insight into what may be going on?
In other words, the following snippets of code will give different utilization statistics when I run the summary function on the queue_step output (when the value of df$column[i]
is 4). I can even change the raw number to different values, get new utilization statistics, and then replace the raw value with df$column[i]
, and the utilization statistic will revert to what it was at the beginning of the run. All other statistics will change and seem to make sense. It is only the utilization statistic that does not change.
queue_model <- queue_step(arrivals = arrivals, service = service, servers = df$column[i])
queue_model <- queue_step(arrivals = arrivals, service = service, servers = 4)
That's very weird! Could you write a small example that I can run?
I made an example but I couldn't reproduce the problem.
n <- 200
ni <- 20
servers <- seq(1, ni, by = 1)
df <- data.frame(servers = servers)
arrivals <- cumsum(rexp(n, 15))
service <- rexp(n)
for(i in 1:ni){
out <- queuecomputer::queue_step(arrivals, service, servers = df$servers[i])
s_out <- summary(out)
print(s_out$utilization)
}
for(i in 1:ni){
out <- queuecomputer::queue_step(arrivals, service, servers = servers[i])
s_out <- summary(out)
print(s_out$utilization)
}
It's truly a bizarre error and I can't tell if it's my environment, packages I have loaded, my data, or the queuecomputer package itself, which is why I wanted to see if it was known issue first. The next time it happens, I'll take note of my environment and save down a small copy of the data to attempt to reproduce it. I'll post when I have that.
I think this is the same as #34 . If it is then the problem was that the server was of class integer. I will have a new CRAN version up soon that will fix this. For now write add as.numeric
to the server input as follows as.numeric(df$servers[i])
. Finally figured this one out!
queuecomputer version 1.1.0 uploaded to CRAN solves this issue.