Netlogo 登革热网络标志模型
我的团队已经制定了一个代码,用于模拟特定地区的登革热。但是,我们不理解代码有什么问题,因为被感染的人不会被感染。很抱歉,我们是新来的。希望你能花点时间看看这个节目。谢谢Netlogo 登革热网络标志模型,netlogo,Netlogo,我的团队已经制定了一个代码,用于模拟特定地区的登革热。但是,我们不理解代码有什么问题,因为被感染的人不会被感染。很抱歉,我们是新来的。希望你能花点时间看看这个节目。谢谢 breed [humans human] breed [mosquitoes mosquito] breed [dead] globals [ total-human ;; Total number of agents that are human total-mosquito ;; Total number
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
繁殖[人类]
繁殖[蚊子]
繁殖[死亡]
全球的[
人类总数;;人类代理的总数
蚊子总数;;人类蚊子总数
角度;朝向个人
]
乌龟自己的[
杀死;由人类内脏内的蚊子组成的药剂子集
被感染的人?;;如果是真的,人被感染了
被感染的蚊子?;如果是真的,蚊子被感染了
易受影响的人;如果是真的,人是易受影响的
易感蚊子?;如果是真的,蚊子是易感的
]
设置
清除所有
设置人员
设置蚊子
创建死0
[将形状设置为“方形”
设置颜色[橙色]
重置滴答声
结束
设置人员
创造人类最初的人类
[
setxy随机xcor随机ycor
设置形状“人”
将颜色设置为白色
设置受感染的人?错误
设定为人类?真的吗
如果世卫组织<最初受感染的人;;这些人最初受感染
[
设定受感染的人?真的吗
设置易受影响的人?错误
]
分配颜色给人
]
结束
设蚊
制造蚊子最初的蚊子
[
setxy随机xcor随机ycor
设置形状“蚊子”
设置颜色为蓝色
设置受感染的蚊子?错误
设置敏感蚊子?对
如果(随机浮动100<10);;10%的蚊子最初受到感染
[
设置受感染的蚊子?对
设置敏感蚊子?错误
]
指定颜色
]
结束
给人分配颜色
如果感染了人类?[设置颜色为红色]
如果是人类?[设置颜色为白色]
结束
指定颜色
如果蚊子被感染了?[设置颜色为黄色]
蚊子是否易感?[设置颜色为蓝色]
结束
外带
驱蚊
感动人
结束
驱蚊
问蚊子
[
rt随机100
lt随机100
fd 1
]
打上钩
结束
感动人
问人类
[
rt random 100;人们在世界各地随机移动
lt随机100
fd 1
如果还有人感染了人类?=是的;如果人有传染性,他们就有可能感染叮咬他们的蚊子
[询问蚊子叮咬的可能性
[如果有?带有[易感蚊子?=真]的蚊子]
[设置受感染的蚊子?正确
设置敏感蚊子?错误]
]
]
[询问蚊子叮咬的可能性;如果人没有传染性,他们可能会被传染性蚊子感染
[如果有其他受感染的蚊子?=正确;如果蚊子具有传染性,它们可以感染附近未受感染的人
[询问人类桡骨咬伤可能性[如果有?人类桡骨咬伤可能性与[易感人类?=真]
[设置受感染的人?对
设置易受影响的人?错误]
]
]
[询问具有[易感人?=真]桡骨咬伤可能性的人][如果有,询问具有[易感人?=真]桡骨咬伤可能性的人]
[设置受感染的人?错误
设置易感人群?为真]];如果非感染性蚊子叮咬非感染性人群,则不会发生任何事情
]
]
]
如果还有人感染了人类?=真的
[询问半径恢复可能性中的人类[如果有的话?半径恢复可能性中的人类与[感染人类?=真]
[
设置受感染的人?错误
设定为人类?真的吗
]
]
]
[询问半径范围内的人类死亡可能性[如果有?半径范围内的人类死亡可能性与[感染人类?=真]
[置你于死地]
]
]
]
结束
好的,问题是最初被感染的人不会被感染。如果他们没有被感染,他们显然无法感染蚊子,而蚊子也无法感染其他人。这意味着问题可能出在这一行:
if who < initial-infected-people
请更具体地描述你的问题。最初被感染的人不会被感染吗?最初的人会被感染但不会感染蚊子吗?蚊子会被感染,但不会感染更多的人吗?最后,叮咬可能性的值是多少(因为这是感染的半径)?一般编程建议首先-逐步建立模型。例如,在试图传播疾病之前,让人和蚊子四处走动。模型中的其他一般问题(1)您应该拥有人类自己的
变量,包括kill、infected human?和易受影响的人?蚊子自己也感染了蚊子?和易感蚊子?目前,你给你所有的海龟相同的变量集,不管它们是否与品种相关。(2) 将勾选
移动到执行
过程的末尾。(3)在移动人员
过程中,您有太多事情要做。将运动与疾病传播分开。你的go
程序应该有如下内容:移动蚊子、移动人、感染蚊子、感染人、恢复蚊子、恢复人、打勾,每一个都是一个单独的程序。JenB在这里的所有建议都很好。我将重复并扩展她最重要的建议:不要一下子写那么多代码。从工作代码开始。一次换一个零钱
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