Hello,
One model that I am currently working on has quite a large number of agents and actions in it. As a result, the model
performance slows down considerably as the model is run. Are there any ways to make my model run at a constant speed
without losing the complexity that I have built in?
Maxim G — 03.05.08
Hi! This is great you ask this. There are several directions I would follow:
1. reduce number of events if possible (e.g. remove unnecessary updates)
2. simplify animation of an agent
3. reduce number of agents – represent a group of agents with a single agent
4. remove iteration over collections (e.g. if you have a collection of references you periodically iterate)
PJ — 04.05.08
Maxim,
Thanks for the tips. I've already reduced the number of agents by a factor of 10 (I would like to have millions). I cut
down on some of the presentation aspects as well. I'm not using collections, although I do have a few spots where I use
arrays, and they iterate every step. I have a number of charts (both line plots and pie charts). What effect do these
have on model speed? If I change these to update only every 10 steps, rather than every step, will model performance
really improve?
Thanks,
PJ
Pavel — 06.05.08
Please try to update charts every 10, 20, etc. steps and inform me about the results.
Also you may increase the "Maximum Available Memory" in the advanced properties of the Simulation.
PJ — 06.05.08
Pavel,
I tried the things you suggested, including setting the Max available memory at 200mb, but there was no real difference
in the model run time.
Maxim G — 07.05.08
PJ, I forgot to mention that different collection types impose different times to do typical operations like add, remove
or get by index. E.g. HashSet class offers constant time performance for the basic operations (add, remove, contains and
size), assuming the hash function distributes the elements properly among the buckets. Iterating over this set requires
time proportional to the sum of the HashSet instance's size.
Max