在大空间尺度上构建补丁集群 [英] To build patch clusters at large spatial scales

查看:72
本文介绍了在大空间尺度上构建补丁集群的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了

I used the code from How to create cluster patches that do not overlap between them to build patches as shown in the first figure below.

这是代码:

to make-cluster
loop [
 let cluster [patches in-radius (2 + random-float 2)] of one-of patches
 if all? (patch-set [neighbors] of cluster) [pcolor = black] [
   ask cluster [ set pcolor green ]
   stop ] ]

clear-all repeat 20 [ make-cluster ]

当我在较大的空间范围内(例如补丁尺寸= 1像素的1000 x 1000补丁)使用此代码时,绿色补丁就像圆圈(请参见下面的第二个图).

When I use this code in a large spatial extent (i.e. 1000 x 1000 patches with patch size = 1 pixel), green patches are like circles (see the second figure below).

我如何获得第一张图所示的补丁?

How can I have patches as shown in the first figure ?

非常感谢您的帮助.

推荐答案

如果您的目标是仅具有异构区域(而不是专门的块状,对称物体),则可以在此处尝试一些答案:在NetLogo

If your goal is to simply have heterogeneous regions (rather than specifically blocky, symmetric things), you might play around with some of the answers here: Creating a random shape (blob) of a given area in NetLogo

弗兰克(Frank)的解决方案以及我的第一个解决方案在如此庞大的世界中可能会运行得很慢.我刚刚添加了一个解决方案,该解决方案应该可以扩展到您所需要的范围.为了方便起见,我也把它放在这里:

Frank's solution and my first solution will probably run pretty slow on that large of a world. I just added a solution that should scale to a world of your size. I've put it here too for convenience:

to make-blob [ area x y ]
  let blob-maker nobody
  crt 1 [ set blob-maker self setxy x y ]
  let border patch-set [ patch-here ] of blob-maker
  repeat area [
    ask blob-maker [
      ask min-one-of border [ distance myself ] [
        set pcolor green
        set border (patch-set border neighbors4) with [ pcolor = black ]
      ]
      rt random 360
      fd .8
    ]
  ]
  ask blob-maker [ die ]
end

也就是说,如果您喜欢块状,那么通常可以将块状结构中包含大量补丁的模型重新设计成行为类似的少量补丁.例如,一种策略是缩小海龟的大小和移动,以使海龟的世界仍然相对较大.

That said, if you like the blockiness, it's often the case that models with a large number of patches in a blocky formation can be reworked into models with a smaller number of patches that behave quite similarly. For example, one strategy is to scale down the size and movements of the turtles so that the world is still relatively large to them.

这篇关于在大空间尺度上构建补丁集群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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