我需要在每个刻度上更新每个海龟的财富变量,调用次数在我的分析器列表的顶部。
我确信最多的计算时间用于计算有多少其他代理在他们的家中使用相同的补丁并计算每只海龟的份额。food_carrying 和 my-home 是 turtle 的属性, Storage 是 patch 属性。
to update-wealth
let h my-home
set wealth ([Storage] of my-home / (Count agents with [my-home = h])) + food_carrying
end
你能想出更好的方法吗?
Name Calls Incl T(ms) Excl T(ms) Excl/calls
UPDATE-WEALTH 9744912 831703.608 461086.654 0.047