微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

NetLogo 中的 SEIS 疾病模型帮助 - 受感染的个体不会再次变得易感?

如何解决NetLogo 中的 SEIS 疾病模型帮助 - 受感染的个体不会再次变得易感?

我正在开发一个简单的 Netlogo 疾病模型,它有 4 个隔间:

S - 易感个体 E - 暴露个体 I - 感染者 S - 恢复后的个体再次变得易感(即没有免疫力)。

我的模拟从 1 个人开始,他们最初感染了其他人易感。

这是我目前的代码

turtles-own [
  disease?
  latent?
  susceptible? 
  latent-period-time
  infectIoUs-period-time
]


to setup
  clear-all
  create-turtles num-agents [ setxy random-xcor random-ycor
    set shape "wolf"
    set size 2
    become-susceptible 
  ]
  
  ask n-of infected-agents turtles [become-infected] 
  reset-ticks
end

to go
move
spread
  tick 
end

to move
  ask turtles [ 
  right random 50
  left random 50
    fd 1 ] 
end

to spread
  ask turtles [
  ifelse disease? [] [
  if any? other turtles-here with [ disease? ]
  [ become-latent
    set latent-period-time 0 ]
  ]]

  ask turtles [
    if latent-period-time = latent-period ;latent-period is a slider variable set to 30 
    [
     become-infected
     set infectIoUs-period-time 0] 
  ]
  
  ask turtles [ 
       if infectIoUs-period-time = infectIoUs-period ;infectIoUs-period is a slider variable set to 100
    [ 
      become-susceptible] 
  ] 
  
  ask turtles [ 
    if latent?
        [ set latent-period-time latent-period-time + 1 ]
 if disease? 
      [set infectIoUs-period-time infectIoUs-period-time + 1]  ]
end 

to become-susceptible
  set disease? false
  set latent? false 
  set susceptible? true 
  set color orange 
end 

to become-latent
  set latent? true 
  set disease? false 
  set susceptible? false 
  set color gray
end 

to become-infected 
  set latent? false
  set disease? true
  set susceptible? false 
  set color blue
end

出于某种原因,似乎只有最初感染的个体会回到易感人群,而任何其他新感染的个体都不会返回易感人群。最初感染者即使遇到感染者,回到易感池后也无法再次感染。

我不知道如何解决这个问题。

谢谢!

解决方法

您的问题是您从未将latent-period-time 和infectious-period-time 的值重置为0。有两种方法可以解决此问题:

  1. 将设置为 0 放入更改所有状态标志和颜色的相同代码中
  2. 完全取消跟踪和递增,并使用一个记录乌龟何时进入状态的变量 - 假设它被称为“状态开始时间”,那么您只需拥有 set state-start-time ticks,然后为您的持续时间测试。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。