【问题标题】:NetLogo3D : Detecting a turtle between two radiusNetLogo3D:检测两个半径之间的乌龟
【发布时间】:2019-11-02 16:38:57
【问题描述】:

我目前正在使用 Netlogo3d 对一些简单的 boid 进行建模,但我遇到了锥内和半径内函数的问题。

(我正在重新实现 Couzin、Krause、James、Ruxton 和 Franks 的文章“动物群中的集体记忆和空间排序”)

我在我的 boids 周围使用三个不同的区域来定义它的行为: 一种用于排斥,一种用于吸引,一种用于定向。 那三个是围绕身体的球体 Thoses areas look like this 我正在像这样检测那些地区的海龟:

to find-flockmates-repulsion  ;; turtle procedure
  set flockmatesRepulsion other turtles in-cone (visionRepulsion * scale) fov
end
to find-flockmates-orientation  ;; turtle procedure
  set flockmatesOrientation other turtles in-cone ((visionOrientation + visionRepulsion) * scale) fov
end
to find-flockmates-attraction  ;; turtle procedure a modifier pour enlever les turtles dans le radius visionOrientation
  set flockmatesAttraction other turtles in-cone ((visionAttraction + visionOrientation + visionRepulsion) * scale) fov
end

但这三个区域是重叠的,我不希望它们重叠。

有没有办法减少圆锥内和半径内函数的选择,例如:

set flockmatesAttraction other turtles [ (in-cone ((visionAttraction + visionOrientation + visionRepulsion) * scale) fov) and not (in-cone ((visionOrientation + visionRepulsion) * scale) fov) ]

如果可能的话,不要在 2 个列表上使用循环,我正在努力提高我的 boids 效率 谢谢!

(PS : 对不起英文不好)

【问题讨论】:

    标签: netlogo area flock boids


    【解决方案1】:

    您可以像在问题中所做的那样简单地计算您的三个代理集,然后从较大的代理集中删除较小的代理集,而不是找到我认为编写为有效的锥内修改一个得到不同的代理集,这就是你所追求的。

    所以你会这样做:

    to find-flockmates-repulsion  ;; turtle procedure
      set flockmatesRepulsion other turtles in-cone (visionRepulsion * scale) fov
    end
    to find-flockmates-orientation  ;; turtle procedure
      set flockmatesOrientation other turtles in-cone ((visionOrientation + visionRepulsion) * scale) fov
    end
    to find-flockmates-attraction  ;; turtle procedure a modifier pour enlever les turtles dans le radius visionOrientation
      set flockmatesAttraction other turtles in-cone ((visionAttraction + visionOrientation + visionRepulsion) * scale) fov
    end
    
    ;; and then remove the overlap using the member? reporter
    set flockmatesAttraction flockmatesAttraction with [not member? self flockmatesOrientation ]
    

    顺便说一句,我使用了查尔斯发布的关于如何从另一个代理集中减去一个代理集的答案 Removing an agentset from another agentset (the agents from the first set which are also present in the second set) 其中他说:

    我想你想要的是会员?原始。如果 D 和 B 是 代理集,以下应该给你 D 的成员不是 B.的成员。

    让 DminusB D 与 [不是成员?自我B]

    【讨论】:

    • 谢谢!它在没有增加太多计算时间的情况下工作得很好
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-09
    • 1970-01-01
    • 1970-01-01
    • 2014-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多