希望能加快反向排序列表的速度

时间:2018-12-27 03:33:12

标签: list performance sorting netlogo patch

*当有3000个补丁时,netlogo的速度是正常的。但是当我改变世界的大小(99 * 99)时,速度太慢了,大约5分钟更新了10个刻度。我渴望提高速度。以下是代码。

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

0 个答案:

没有答案