登革热Netlogo模型

我的小组研究了一个模拟特定地区登革热的代码.但是,我们不明白代码有什么问题,因为感染者没有被感染.对不起,因为我们是这个节目的新手.希望你能花时间看一下这个程序.谢谢.

breed [humans human]
breed [mosquitoes mosquito]
breed [dead]

globals [
  total-human     ;; Total number of agents that are human
  total-mosquito  ;; Total number of mosquitoes that are human
  angle           ;; Heading for individuals
]

turtles-own [
  kill                  ;; Agent-subset consisting of mosquitoes within          vison of human
  infected-human?       ;; If true, human is infected
  infected-mosquito?    ;; If true, mosquito is infected
  susceptible-human?    ;; If true, human is susceptible
  susceptible-mosquito? ;; If true, mosquito is susceptible
]

to setup
clear-all
setup-people
setup-mosquitoes
create-dead 0
[ set shape "square"
  set color orange ]
reset-ticks
end

to setup-people
create-humans initial-people
[
  setxy random-xcor random-ycor
  set shape "person"
 set color white

  set infected-human? false
  set susceptible-human? true

  if who < initial-infected-people ;; these people are initially infected
  [
    set infected-human? true
    set susceptible-human? false
  ]

  assign-color-human
]
end

to setup-mosquitoes
create-mosquitoes initial-mosquito
[
  setxy random-xcor random-ycor
  set shape "mosquito"
  set color blue

  set infected-mosquito? false
  set susceptible-mosquito? true

  if (random-float 100 < 10) ;; 10% of mosquitoes are initially infected
  [
    set infected-mosquito? true
    set susceptible-mosquito? false
  ]
  assign-color-mosquito
 ]
end

to assign-color-human
  if infected-human? [ set color red ]
  if susceptible-human? [ set color white ]
end

to assign-color-mosquito
  if infected-mosquito? [ set color yellow ]
  if susceptible-mosquito? [set color blue ]
end

to go
   move-mosquitoes
   move-people
    end

to move-mosquitoes
  ask mosquitoes
  [
rt random 100
lt random 100
fd 1
  ]
  tick

end

to move-people
  ask humans
  [
rt random 100 ;people move around the world randomly
lt random 100
fd 1

ifelse infected-human? = true ;there is a chance that if people are       infectious they will infect mosquitoes who bite them
  [ask mosquitoes in-radius bite-likelihood
    [if any? mosquitoes with [susceptible-mosquito? = true]
                  [set infected-mosquito? true
                   set susceptible-mosquito? false]
    ]
  ]

  [ask mosquitoes in-radius bite-likelihood ;there is a chance that if people are not infectious they can be infected by infectious mosquitoes
    [ifelse infected-mosquito? = true ;if mosquitoes are infectious they can infect nearby non-infected people
                  [ask humans in-radius bite-likelihood [if any? humans in-radius bite-likelihood with [susceptible-human? = true]
                                                                          [set infected-human? true
                                                                           set susceptible-human? false]
                                                               ]
                  ]
                  [ask humans in-radius bite-likelihood with [susceptible-human? = true] [if any? humans in-radius bite-likelihood with [susceptible-human? = true]
                                                                          [set infected-human? false
                                                                           set susceptible-human? true]] ;if noninfectious mosquitoes bite noninfectious people, nothing happens

                  ]
    ]
  ]

  ifelse infected-human? = true
  [ask humans in-radius recovery-likelihood [if any? humans in-radius recovery-likelihood with [infected-human? = true]
                                            [
                                             set infected-human? false
                                             set susceptible-human? true
                                            ]
                                           ]
  ]

  [ask humans in-radius death-likelihood [if any? humans in-radius death-likelihood with [infected-human? = true]
                                          [set breed dead]
                                         ]
  ]
  ]





end

最佳答案 好的,问题是初次感染的人不会被感染.如果它们没有被感染,它们显然不能感染那些不能感染其他人的蚊子.这意味着问题可能就是这一行:

if who < initial-infected-people

一般建议 – 如果你正在使用谁,你可能做错了什么.在这种情况下,我假设您有一个滑块(或其他一些输入方法)将初始感染的人设置为某个数字.假设这个数字是5.然后这条线说要感染任何一个谁的数字

breed [humans human]
breed [mosquitoes mosquito]
breed [deads dead]

globals [
  total-human     ;; Total number of agents that are human
  total-mosquito  ;; Total number of mosquitoes that are human
]

humans-own [
  kill                  ;; Agent-subset of mosquitoes within vision
  infected-human?       ;; If true, human is infected
  susceptible-human?    ;; If true, human is susceptible
]

mosquitoes-own [
  infected-mosquito?    ;; If true, mosquito is infected
  susceptible-mosquito? ;; If true, mosquito is susceptible
]

to setup
  ...
  set total-human <some number> (or put on a slider)
  set total-mosquito <some number> (or put on a slider)
  create-humans total-human [<code for shape, position etc]
  ask n-of initial-infected-people humans [set infected-person? TRUE]
  create-mosquitoes total-mosquito [<code for shape, position etc>]
  ...
end
点赞