【问题标题】:Turtles asked to go to certain areas are all congregating in one place被要求去某些地区的海龟都聚集在一个地方
【发布时间】:2020-07-29 16:04:44
【问题描述】:

我正在编写一个捕食者-猎物模型,其中捕食者有一个小型内部机器学习模型来决定它要在哪个栖息地捕猎。

如果捕食者在前一天没有成功狩猎,他们会随机分配四种策略。每种策略都有一个独特的栖息地,它们可以在其中捕猎,但是尽管它们都从环境的随机区域移动到中心位置,然后用笔模式向下“绘制”并忽略环境的所有其他部分,但我不知道为什么.

我尝试了许多代码组合来解决这个问题,但它总是做同样的事情。我最近的尝试如下


    if strat = "strat1" [ifelse any? patches in-cone 0 250 with [habitat = "rugged slope"]
      [set target-patch min-one-of patches in-cone 0 250 with [habitat = "rugged slope"] [distance myself]
 face target-patch
  fd 1]
      [face one-of patches with [habitat = "rugged slope"]
        fd 1]]

    if strat = "strat2" [ifelse any? patches in-cone 0 250 with [habitat = "gentle slope"]
      [set target-patch min-one-of patches in-cone 0 250 with [habitat = "gentle slope"] [distance myself]
 face target-patch
  fd 1]
      [face one-of patches with [habitat = "gentle slope"]
        fd 1]]

    if strat = "strat3" [ifelse any? patches in-cone 0 250 with [habitat = "rugged forest"]
      [set target-patch min-one-of patches in-cone 0 250 with [habitat = "rugged forest"] [distance myself]
 face target-patch
  fd 1]
      [face one-of patches with [habitat = "rugged forest"]
        fd 1]]

        if strat = "strat4" [ifelse any? patches in-cone 0 250 with [habitat = "gentle forest"]
      [set target-patch min-one-of patches in-cone 0 250 with [habitat = "gentle forest"] [distance myself]
 face target-patch
  fd 1]
      [face one-of patches with [habitat = "gentle forest"]
        fd 1]]

  ]
end

如您所见,他们被告知要去某些区域,但结果看起来像这样(附图片)

掠食者离开他们的巢穴(粉红色),尽管他们对去哪里有独特的命令,但他们只是在中间相遇并画画。

【问题讨论】:

  • 补丁颜色是否表示栖息地类型?
  • 嗨,他们是!
  • 因此,根据查尔斯的回答,如果他们看不到很远,那么他们将面临正确类型的随机补丁。如果它们靠近边缘,则任何类型的大多数补丁都将远离边缘,因此它们被绘制到中心。一旦它们在中心,那么栖息地就在各个方向,它们基本上是在一个随机的方向上移动,直到它们移动得太远,而大部分又在它们后面,所以向内移动。如果你关闭世界环绕,我猜他们会随机移动到任何地方。如果是这样,这就是你的问题。

标签: netlogo agent agent-based-modeling


【解决方案1】:

我认为我们可能需要查看更多您的代码,以了解这些区域是如何分布的。但问题可能是patches in-cone 0 250 只会查看捕食者当前所在的补丁(半径为零)。所以,如果(比如说)strat = "strat2" 和捕食者在带有habitat = "gentle slope" 的补丁上,那么目标补丁将是捕食者所在的补丁。如果栖息地不是“缓坡”(这可能是最有可能的),那么即使附近有特定的缓坡栖息地,它的路径也将非常漫无目的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-16
    • 2016-03-28
    • 1970-01-01
    • 2018-05-30
    • 2022-10-18
    • 2016-02-08
    • 1970-01-01
    • 2014-04-19
    相关资源
    最近更新 更多