我正在编写一些代码来为流感流行的人群中的个人接种疫苗。有两种疫苗(代码中分别命名为HOV和HEV);HOV 已经完成。我尝试/想要做的是将蓝海龟的代理集转换为一个列表,然后我可以一次迭代一只海龟。我需要这样做,因为 HEV 条件必须给每只蓝龟接种略有不同的疫苗(即每种疫苗中的流感毒株必须略有不同)。但是,NetLogo 突出显示了“foreach [vax-turtles]”,并带有一条错误消息,上面写着“期望一个文字值”。
我的代码如下,“如果疫苗 =“HEV””那段代码是我需要帮助的:
extensions [csv]
globals [strain_list_list epidemic-threshold cumulative-infections proportion-of-infection currently-infected peak-prevalence vax-strain]
turtles-own [infection-period infection-number tflu-strain immune-label ant-distance cross-immunity]
patches-own [fomite-age pflu-strain]
to setup
clear-all
setup-turtles
set strain_list_list (list t-sorted-strain-list)
print strain_list_list
reset-ticks
end
to-report t-sorted-strain-list
report map [i -> [tflu-strain] of i] sort turtles
end
to setup-turtles
create-turtles 100
ask turtles [setxy random-xcor random-ycor]
ask turtles [set color white set infection-number 0 set immune-label -999999999999 set tflu-strain -999999999999]
ask one-of turtles [set color …Run Code Online (Sandbox Code Playgroud)