NetLogo:Chooser的问题

时间:2017-04-28 07:45:34

标签: netlogo

我正在尝试进行疾病模拟,您可以选择要模拟的疾病。为了达到这个目的,我在接口上增加了一个选择器,命名为"疾病",有天花,麻疹和腮腺炎等选项。它还伴随着设置中的以下代码:

if disease = smallpox
[
set infection-rate 90
set infectivity 6
set lethality 30
set recovery recovery-rate
set immunity (1 - (1 / infectivity)) * 100
]

if disease = measles
[
  set infection-rate 90
  set infectivity 15
  set lethality 1
  set recovery recovery-rate
  set immunity (1 - (1 / infectivity)) * 100
]

if disease = mumps
[
  set infection-rate 80
  set infectivity 6
  set lethality 1
  set recovery recovery-rate
  set immunity (1 - (1 / infectivity)) * 100
]

以下内容:

ask turtles with [sick? != true and immune? != true]
[if any? (turtles-on patch-ahead 1) with [sick? = true]
[if (random 100) < infection-rate
  [
    set sick? true
  ]

]
]

在界面中,我还设置了一个跟踪器来跟踪感染率&#34;。但是,当我运行该程序时,感染率为零;此外,海龟不会感染他人。 (这不是一个问题,因为我已尝试使用手动设置值来感染我的#34;感染&#34;代码并且有效。)

我是如何编码&#34; ifs&#34;或者我是如何尝试使用这些变量的?在此先感谢您的帮助。

0 个答案:

没有答案
相关问题