【发布时间】:2017-10-20 12:38:29
【问题描述】:
我有代理,他们的设备可能会根据故障概率随机面临故障。 (工作设备?假) 当设备不工作时,我应该计算到现在的等待时间摘要,然后更新设备的状态(working-devices?true)。
我的问题出在更新部分。 假设等待时间 = 1 并且我们在滴答 = 10 那个工作设备?变成假的,我们做我们的模型 365 天(滴答声)。 在更新时,如果 tick > 11 ( 10 + 1 ),我应该让我的状态变为 true。 11 表示(滴答声 + 等待时间)。
我的问题是如何理解在哪个刻度上状态变为假? 编写更新程序的最佳方法是什么?
;; waiting-time is slider (for example ) 1
breed [ customers customer]
....
customers-own [device-working? real-waiting-time? ... ]
to setup
....
ask customers [
set real-waiting-time 0
set device-working? true
.....
]
end
to go
if ticks < 365 [
ask customers [if (device-working? = true)
[ impose update]
]
to impose
if random 100 > 95
[set device-working? false
set real-waiting-time real-waiting-time + waiting-time ]
end
to update
;; let the-tick when devices of customers faces failure
;; if tick > the-tick + waiting-time-slider and device-working? = false
;; [set device-working? true]
end
【问题讨论】:
标签: netlogo