首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SEIS疾病模型有助于NetLogo感染者不再变得易感?

SEIS疾病模型有助于NetLogo感染者不再变得易感?
EN

Stack Overflow用户
提问于 2021-04-28 02:38:50
回答 1查看 26关注 0票数 0

我正在开发一个简单的NetLogo疾病模型,它有4个部分:

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

我的模拟从一个最初被感染的人开始,其余的人都是易感的。

这是我到目前为止所拥有的代码:

代码语言:javascript
复制
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

由于某些原因,只有最初感染的个体似乎会回到易感池,而任何其他新感染的个体都不会回到易感池。最初被感染的人在回到易感人群后也不会再次感染,即使它遇到了受感染的人。

我不确定如何解决这个问题。

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2021-04-28 19:09:54

您的问题是,您从未将潜伏期时间和感染期时间的值重新设置为0。有两种方法可以解决这个问题:

  1. 将设置为0放入更改所有状态标志和颜色的相同代码中
  2. 完全放弃跟踪和递增,并使用一个变量来记录乌龟到达状态的时间-假设它被称为' state -start-time‘,那么您只需使用set state-start-time ticks,然后对持续时间进行减法测试。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67288887

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档