Netlogo的SEIR模型中n-of错误

问题描述 投票:0回答:1

我正在尝试将社交距离扩展到我的NetLogo代码中,并且我使用n-of运行代码时始终遇到错误:“仅从0个代理中请求了500个随机代理。观察者运行N-OF时出错 由过程SETUP调用 由Button'setup'调用]“

[我添加了一个名为“ social-distancing”的滑块,目前将其设置为0.5”

这是我的设置:

globals [susceptible-code exposed-code infectious-code recovered-code distancing-yes-code distancing-no-code population total-dead]
turtles-own [epi-state distancing] ;; each turtle has an epidemiological state


;; Creating the  the initial configuration of the model
to setup
  clear-all
  set susceptible-code "susceptible"
  set infectious-code "infectious"
  set exposed-code "exposed"
  set recovered-code "recovered"
  set distancing-yes-code "distancing"
  set distancing-no-code "not-distancing"

  create-turtles 1000 [
    set epi-state susceptible-code ;; setting the turtle state as susceptible
    set color blue
    set size 0.4
    set shape "circle"
    set xcor random-xcor
    set ycor random-ycor
    set distancing-no-code "not-distancing"
  ]

  ;; makeing one turtle infectious

  let initial-no-of-sd count turtles * social-distancing

  ask one-of turtles [
    set epi-state infectious-code
    set color red ;; we color infectious turtles in red
  ]

  ask n-of initial-no-of-sd turtles with [distancing = distancing-yes-code] [
    set distancing distancing-yes-code
    set color yellow
  ]

  set population count turtles
  reset-ticks
end
netlogo
1个回答
2
投票

错误消息告诉您,您从一组中要求500只海龟做某事,但该组中没有海龟。我的猜测是这行:

© www.soinside.com 2019 - 2024. All rights reserved.