如何有效地设置地图比例的属性

问题描述 投票:0回答:1

我在 Netlogo 上有一张非常大的地图,我想告诉它一定比例(可通过滑块更改)有咖啡种植园。然而,地图太大,处理时间太长。我的方法有效,但我希望有一种更快的方法来做到这一点。

我有

ask patches [set total-cultivation count patches with [Type-Cover= "Agricultural Areas"]]

ask n-of (total-cultivation * %area) patches [set plant-type coffee ]

总修为是全局变量 %面积从 0 到 1。

这是地图。灰色部分是需要统计的部分。预先感谢

 cobertura >= 18 and cobertura <= 18.99 or cobertura >= 19 and cobertura <= 19.99[set pcolor grey set Type-Cover "Agricultural Areas"]

编辑:我遇到了另一个问题。即使这个有效的补丁是随机放置的,但种植园并不只占用一个像素,它们大多靠得很近。我该如何解决这个问题?

netlogo patch
1个回答
3
投票

您要求每个补丁都进行计数。这意味着 N 个补丁分别评估 N 个补丁的类型覆盖,总共 N^2 次操作。

从您稍后使用它的方式来看,我假设

total-cultivation
是一个全局参数。因此,只需剪掉补丁就可以将其减少到 N 次操作。

set total-cultivation count patches with [Type-Cover= "Agricultural Areas"]

关于你的第二个问题,你首先需要弄清楚你的系统的规则是什么。它们应该有多聚集?您可以在 Stackoverflow 上找到几个有关集群的早期问题,因此我建议您看一下这些问题。

© www.soinside.com 2019 - 2024. All rights reserved.