0

此代码适用于小型网络(30 个顶点),但对于 300 个顶点的网络需要数小时!有更快的方法吗?

to calculate-duration
  ask act 0 [set color green]
  set pathlist [ ]
  loop [
  if all? deps [color = green] [stop]
  let path [0]
  let i 0
  while [i != count acts - 1][
  ask act i [set path lput [who] of one-of out-link-neighbors path]
   let j i
   set i last path
   ask turtle i [set color green]
   ask dep j i [set color green]
   ]
  let d 0
  foreach path [x -> set d d + ( [duration] of turtle x ) ]
  set path lput d path
  set pathlist lput path pathlist
  ]
4

0 回答 0