我正在研究一个模型,其中存在后代的有性繁殖,所以有两种代理类型,男性和女性。我要求代理在达到一定的年龄后进行繁殖: 400次刻度,并继续每400次刻度这样做。
如果有男性的话,女性应该只生一个孩子。该模型适用于最初的几代人,但随后人口呈爆炸式增长。一名女性和一名男性的起始人口顺序如下: 2,3,7,19,575。我不知道为什么它突然从19增加到575。
看起来有些雌性后代在出生后立即繁殖,尽管它们有一个age = 0,也就是说它们没有遵循这个命令:
ask females [
if age > 0 and age mod 400 = 0 [
reproduce
] 下面是完整的模型:
turtles-own [age]
breed[males male]
breed[females female]
females-own [ mates max-mate-count mate-count availa-males mother father]
to setup
clear-all
crt 2 [
ifelse random 2 = 1 [set breed males] [set breed females]
]
ask females [set color grey
setxy random-xcor random-ycor
]
ask males [set color red
setxy random-xcor random-ycor
]
reset-ticks
end
to go
ask turtles [increment-age]
ask females [
if age > 0 and age mod 400 = 0 [
choose-mates
]
]
ask females [
if age > 0 and age mod 400 = 0 [
reproduce
]
]
tick
end
to increment-age
set age (1 + age)
end
to choose-mates
ask females [
set mates males in-radius 100 with [age >= 400]
]
end
to reproduce
ask females with [count mates > 0 ] [
hatch 1 [
set mother myself
set father one-of [mates] of mother
ifelse random 2 = 1 [set breed males
set color red
move-to one-of patches with [pcolor = black]
set age 0
]
[set breed females
set color grey
move-to one-of patches with [pcolor = black]
set mate-count 0
set age 0
]]]
end 希望你能帮上忙!
https://stackoverflow.com/questions/51422111
复制相似问题