如何创建群集修补程序,它们之间不重叠 [英] How to create cluster patches that do not overlap between them
本文介绍了如何创建群集修补程序,它们之间不重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建栖息地集群(例如,以海洋"主题为主题的森林斑块:通过控制簇的大小和簇的数量在景观中添加补丁簇)?例如,我使用了"plant-migration"的代码:
I would like to create habitat clusters (e.g. forest patches as in the subject of Marine : Adding patch clusters in a landscape) by controlling the size of clusters and the number of clusters ? For example, I used the code of "plant-migration" :
to create-forests
ask n-of forest-number patches
[
set pcolor green
]
ask patches with [pcolor = green]
[
let a self
let b max list 1 round(random-normal mean-forest-area (mean-forest-area * coef-forest-area))
ask patches with [distance a <= b]
[
set pcolor green ]
]
end
如何创建在它们之间不重叠的群集补丁? 预先感谢
How can I create cluster patches that do not overlap between them ? Thanks in advance
推荐答案
以下是一些示例代码:
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
]
]
end
如果我这样运行它:
clear-all repeat 15 [ make-cluster ]
我明白了:
请注意,所有群集都不会接触或重叠.
Note that none of the clusters touch or overlap.
这篇关于如何创建群集修补程序,它们之间不重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文