底辺私立医大を卒業した医者って頭悪いよね? Part10at HOSP
底辺私立医大を卒業した医者って頭悪いよね? Part10 - 暇つぶし2ch951:卵の名無しさん
18/12/09 01:03:32.21 EZ1Q6//t.net
>>897
ようやく完成。 
# serve first the client in que whose service time is shortest
n=40
la=5/60 # arrival rate
mu=6/60 # service rate
set.seed(1234) ; aint=rexp(n,la) # arrival interval
act=cumsum(aint) # arrival clock time
set.seed(5678) ; ds=rexp(n,mu) # service time for i-th patient (duration of service)
Wq=numeric(n) # Wq[i] : Wating time in que of i-th patient
sect=numeric(n) # sect[j] : service end clock time of j-th service (not i-th patient)
act=round(act) ; ds=round(ds) # round up for convenience
"
> act # arrival clock time
[1] 30 33 33 54 59 60 70 72 82 91 114 133 153 189 210 211 221 222
[19] 244 250 274 282 287 298 301 313 313 318 327 338 343 343 363 363 372 373
[37] 425 436 436 477
> ds # service time
[1] 12 10 14 27 18 11 15 1 8 4 2 10 1 11 25 14 3 33 37 22 9 19 6 0 2
[26] 14 25 21 2 10 2 3 13 1 5 4 12 19 8 12
"
# initialize
Wq=ssct=sect=rep(NA,n)
Wq[1]=0 # no waiting time with 1st patient
ssct[1]=act[1] # service start time for 1st patient
sect[1]=act[1]+ds[1] # service end clock time for 1st patient
served=1 # index of already served patient


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch