Use patch variable or create new agents when only a few patch will update the value (which one is better?)

StackOverflow https://stackoverflow.com/questions/19781153

Frage

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?

War es hilfreich?

Lösung

Neither approach seems obviously superior to me, given only the information that you've stated. The patches-only approach seems a little simpler, so I guess I'd stick with that for now, but keep the idea of switching in the back of your mind, in case you discover later once your model is more elaborate that there would be benefits to switching to turtles that just aren't apparent yet.

Note that if you need to do patches with [food-level > 0] a lot, it will take time each to scan all of the patches to find the patches with food. If that turns out to be a performance issue in your model, using turtles instead would solve it. But the ten patches with food on them are always the same, then you could run patches with [food-level > 0] once during setup and store the resulting patchset in a global variable, and that would also solve the performance issue.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top