如何重新运行一个Netlogo运行?

How to re-run a Netlogo run?

有什么方法可以重新运行 Netlogo 模型和以前一样吗? (即再次有效地按下 Go 并使 运行 与上一个完全相同。)

据我了解,您需要做的就是找出上次使用的随机种子 运行 - 这可以做到吗?然后您需要做的就是在设置中包含代码 "random-seed xxx"。

这个功能真的很有用,所以如果做不到,也许可以在以后的版本中实现。

谢谢。

我在这里假设您仍然希望模型的每个 运行 都不同(每次更改随机种子)。根据 NetLogo Programming Guide:

If you don't set the random seed yourself, NetLogo sets it to a value based on the current date and time. There is no way to find out what random seed it chose, so if you want your model run to be reproducible, you must set the random seed yourself ahead of time.

所以我们可以做到这一点,我们只需要自己处理 "remembering" 随机种子。假设您有一个必须在模型 运行s:

之前执行的标准 setup 过程
globals [ run-seed ]

to setup
  set run-seed new-seed ; get a random seed to use for our run
  random-seed run-seed
  ; do the rest of our normal setup
end

现在,当您的模型 运行 完成后,您可以在命令中心 show run-seed,或用代码打印出来记录。然后您可以在 setup 过程中使用该种子代替 new-seed 以在将来准确地重现模型 运行。