确定乌龟簇的半径和其中的乌龟数量-后处理 [英] Determining the radius of turtle clusters and number of turtles in them - postprocessing

查看:101
本文介绍了确定乌龟簇的半径和其中的乌龟数量-后处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我遇到这样的情况,在给定的滴答声持续时间内,约有1000只黑海龟以随机的角度和步幅散布在整个netlogo世界中.在传播过程中的每个时间步中,每只乌龟都会被分配一个随机概率,如果该数目超过任何给定乌龟的给定阈值,它的颜色就会变为红色并停止移动.此外,碰巧在一片红色乌龟中移动(停止/定居)的黑乌龟(仍在移动),将它们的颜色更改为灰色并稳定下来(停止移动).最后,碰巧在一块灰色或红色的乌龟(停住/定居)内移动的其他黑乌龟(仍在移动),也将它们的颜色更改为灰色并稳定下来(停止移动)

If I have a situation in which about a 1000 black turtles disperse at random angles and steps throughout the netlogo world for a given duration of ticks. Each turtle is assigned a random probability at each timestep during dispersal, and if this number exceeds a given threshold for any given turtle it changes it's color to red and stops moving. Additionally, black turtles (still moving) that happen to move within a patch of red turtles (stopped/settled), change their color to grey and settle (stop moving) as well. Finally, other black turtles (still moving) that happen to be move within a patch of either grey or red turtles (stopped/settled), also change their color to grey and settle (stop moving)

我的问题是关于何时达到仿真持续时间的后处理问题.如何确定黑海龟海中的红灰海龟群的数量?另外,如何确定每个群集的大小(径向范围)?最后,如何确定每个群集中的海龟数量?

My question is a post-processing question for when the simulation duration is reached. How do I determine the number of clusters of red-grey turtles in the sea of black turtles? Also, how do I determine the size (radial extent) of each cluster? And finally, how do I determine the number of turtles in each cluster?

推荐答案

Jen是对的:在真正回答该问题之前,您需要清楚地了解集群的组成部分.

Jen is right: you need a clear idea of what constitutes a cluster before being able to truly answer that question.

话虽这么说,一种可能的选择是使用聚类算法.我建议您看看Christopher Frantz的 dbscan扩展.

That being said, one possible option is to use a clustering algorithm. I'd suggest taking a look at Christopher Frantz's dbscan extension.

下面是一个快速抛出的示例:

Here is a quickly thrown together example:

extensions [ dbscan ]

to setup
  clear-all
  ask patches [ set pcolor white ]
  create-turtles 1000 [
    set color black
    set label-color blue
    setxy random-xcor random-ycor
  ]
  ask n-of 5 turtles [
    ask turtles in-radius 3 [
      set color one-of [red grey]
    ]
  ]
end

to find-clusters
  let red-grey-turtles turtles with [ member? color [red grey] ]
  let clusters dbscan:cluster-by-location red-grey-turtles 3 3
  (foreach clusters range length clusters [ [c i] ->
    foreach c [ t ->
      ask t [ set label i ]
    ]
  ])
end

很抱歉,没有进一步的解释:我要赶飞机...

Sorry for the lack of further explanations: I have a plane to catch...

这篇关于确定乌龟簇的半径和其中的乌龟数量-后处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆