在 NetLogo 中,我可以要求代理从中央补丁沿着梯度死亡吗?
In NetLogo can I ask agents to die along a gradient from a central patch?
在我的模型中,代理在整个环境中随机萌芽。我想要这些代理的密度梯度。
对于不同的半径,有没有比 运行 更简洁的方法?:
ask patch 0 0 [ask n-of 20 turtles in-radius 20 [die]]
谢谢
你可以按照这些思路做一些事情:
to setup
clear-all
let max-distance max [ distancexy 0 0 ] of patches
ask patches [
if random-float 1.0 > (distancexy 0 0 / max-distance) [
sprout 1
]
]
end
许多变体都是可能的。关键是使用 random-float
和 distancexy 0 0
的组合来获得你想要的密度。
在我的模型中,代理在整个环境中随机萌芽。我想要这些代理的密度梯度。
对于不同的半径,有没有比 运行 更简洁的方法?:
ask patch 0 0 [ask n-of 20 turtles in-radius 20 [die]]
谢谢
你可以按照这些思路做一些事情:
to setup
clear-all
let max-distance max [ distancexy 0 0 ] of patches
ask patches [
if random-float 1.0 > (distancexy 0 0 / max-distance) [
sprout 1
]
]
end
许多变体都是可能的。关键是使用 random-float
和 distancexy 0 0
的组合来获得你想要的密度。