simulate_queue<- function(open_time, rate, low, high){
i<-1
j<-1
a<-rexp(1,rate)
b<-runif(1,low,high)
c<-a+b
d<-a + rexp(1,rate)
e<-c()
while (d <= open_time) {
a[i+1]<- d
if (a[i+1] < c[i]){
c[i+1]<-c[i]+b
b<- runif(1,low,high)
}
else c[i+1]<-a[i+1]+b
e[i]<-( while(d <= open_time){
if (c[j] < a[i+1]) {sum(c[j]< a[i])
i <- i+1
}
else if (c[j] > a[i+1]) {0
j <- j+1
}
else 0
}
)
i<-i+1
d <- a[i] + rexp(1,rate)
}
L <- list(arrival_times=a,queue_lengths=e,departure_times=c)
L
}
我不知道为什么会出现错误消息 if(c [j]&lt; a [i + 1]){:缺失值需要TRUE / FALSE时出错 请帮帮我..