0

*When there are 3 thousand patches,the speed of netlogo is normal. But when I change the size of world(99*99), the speed is too slow about 5 minutes update 10 tick. I am eager to improve the speed of it. The following is the code.

to publish
  set contribution_list  ( reverse sort [cumulative-contribution] of patches)
  let m count patches
  if contribution > item (round( m * shibei-proportion) ) contribution_list
    [set pcolor blue + 3]
  if contribution > item (round( m * (shibei-proportion + bian-proportion)) ) contribution_list
    [set pcolor blue + 2]
  if contribution > item (round( m * (shibei-proportion + bian-proportion + dahongbao-proportion))) contribution_list
    [set pcolor blue + 1]
  set cumulative-contribution 0
end
yaya
  • 1
  • 2
  • Possible duplicate of [Is NetLogo too slow for big simulations? How can I speed up a NetLogo model?](https://stackoverflow.com/questions/41490078/is-netlogo-too-slow-for-big-simulations-how-can-i-speed-up-a-netlogo-model) – Ken Y-N Dec 27 '18 at 03:45
  • 1
    Without seeing the entire model it's difficult to be sure, but it appears that you are doing `[cumulative-contribution] of patches` for every patch or every turtle at every tick. If so, you should reorganize the code so it only happens once per tick, total. – Seth Tisue Jan 02 '19 at 20:45

0 Answers0