与邻居一起计数品种(绘图)

时间:2017-07-11 20:33:53

标签: netlogo

我有两个品种:supras和subs。

我想画两行:

  • 拥有邻居的潜艇的数量(除以总数 海龟种群)
  • 有邻居的supras数量 是潜艇(除以海龟总数)

我该怎么做?我试过这个:

  • System-specific pagecopy.h files should define these macros and then #include this file: ... PAGE_COPY_FWD (dstp, srcp, nbytes_left, nbytes)
  • plot count (subs with [one-of neighbors = supras]) / num-turtles

每个人口的数字始终为0,但情况并非如此。这是我的代码:

plot count (supras with [one-of neighbors = subs]) / num-turtles

1 个答案:

答案 0 :(得分:2)

neighbors会返回patches的代理集,因此说neighbors = supras无法满足您的需求 - 没有补丁suprassubs。相反,您要检查是否有任何邻居有supras-heresubs-here。这对我有用:

plot (count ( subs with [ any? neighbors with [ any? supras-here ] ] ) ) /  ( count turtles )

plot (count ( supras with [ any? neighbors with [ any? subs-here ] ] ) ) /  ( count turtles )

您可能希望将Y max缩小到1,以便查看更多内容。