在Netlogo中,我使用选择器来选择策略及其相关结果。在我的情况下,建筑规范是战略,火灾损害是结果,火是事件)。随机变量表示是否发生火灾事件。但是,我的结果无效(我有时会因p> 0.40而导致火灾伤害> 0)。非常感谢您对此问题的任何见解。
to fire?
ask patches [
if (strategy = "updated-building-codes")
[set p random-float 1.00
if p > 0.40 [ set fire-level 0 ]
if p > 0.01 and p <= 0.40 [ set fire-level 1 ]
if p > 0.002 and p <= 0.01 [ set fire-level 2 ]
if p <= 0.002 [ set fire-level 3 ]
]
if (strategy = "no-updated-building-codes")
[set p random-float 1.00
if p > 0.40 [ set fire-level 0 ]
if p > 0.01 and p <= 0.40 [ set fire-level 5 ]
if p > 0.002 and p <= 0.01 [ set fire-level 6 ]
if p <= 0.002 [ set fire-level 7 ]
]
]
end