1

I have to run the some code for different village map setting, now my grid is 20 * 20 patches but I will have up to 60 * 60 grid size as well, all patches now have 2 variables storage and food-level, only 10 patch will use their food-level variable, I can continue with the same settings or I can create 10 other turtles (trees for example) and assign them food-level and remove food-level for patches, which way do you think is better?

4

1 回答 1

1

仅考虑到您所说的信息,这两种方法似乎都明显优于我。仅补丁的方法似乎更简单一些,所以我想我现在会坚持下去,但请记住切换的想法,以防您以后发现模型更精细时会有切换到尚不明显的海龟的好处。

请注意,如果您需要做patches with [food-level > 0]很多事情,每次扫描所有补丁以找到带有食物的补丁都需要时间。如果这被证明是您模型中的性能问题,那么使用海龟可以解决它。但是上面有食物的十个补丁总是相同的,然后您可以patches with [food-level > 0]在设置期间运行一次并将生成的补丁集存储在全局变量中,这也将解决性能问题。

于 2013-11-06T12:56:16.627 回答