我是Netlogo的新手,我的cas如下: 我有100只海龟,海龟有两个变量height和width,从高度我可以计算出种群。我知道如何让x%的海龟随机死亡,让海龟有一定的价值变小或变大而死;或删除30%的库存。
但是我的情况有些不同,我想从高度值最小的海龟中取出15%的牲口,换句话说,我想问一问具有最小高度值的海龟死掉,以便死海龟占总数的15%。
有任何提示或帮助吗?我尝试执行以下操作,但我知道这不起作用:
turtles-own [ sh sto ]
Globals [Stock death_severity]
to setup
ca
crt 100 [
initialize_ITGM
set sto 1.5 * sh + random 50
setxy random-xcor random-ycor
]
reset-ticks
end
to go
cal-stock
remove-turtles
end
to cal-Stock
set stock sum [sto] of turtles
end
to remove-turtles
if death_severity = "light_severity" [
ask turtles with-min [sh] [die]
set stock 0.20 * (Stock)]
end
to initialize_ITGM
set sh random-float 2
end
答案 0 :(得分:3)
https://ccl.northwestern.edu/netlogo/docs/dictionary.html#min-n-of
ask min-n-of (0.15 * count turtles) turtles [sh] [die]