首页 文章

NetLogo - 查找具有最大值的补丁

提问于
浏览
3

我正试图让雌性动物代理选择在一定范围内没有雌性的所有斑块 . 然后,从那些斑块中,我希望雌性移动到同一半径内具有最高平均猎物的那个 . 我目前有:

let potential-sites patches with [not any? patches in-radius 2 with [owner-fem != nobody]]
  let pot-site-areas [patches in-radius 2] of potential-sites
  let pot-site-prey map [mean [prey] of ?] pot-site-areas
  let ideal-site max pot-site-prey

但后来我意识到我无法告诉女性去哪个补丁,因为理想网站只是一个没有与之关联的补丁坐标的值 . 有关如何将值链接到实际补丁的任何建议?非常感谢!

1 回答

  • 3

    使用 max-one-of ,也许是这样的:

    let ideal-site max-one-of potential-sites [mean [prey] of patches in-radius 2]
    

相关问题