在我的模型中,我使用行为空间来执行多次运行,每次运行都会更改变量,并将输出存储在 *.csv 中以供以后分析。该模型在前几次迭代中运行良好,但随着数据的增长而速度很快变慢。我的问题是,在行为空间中使用文件刷新会有所帮助吗?或者有什么办法可以解决这个问题吗?
干杯
西蒙
最佳答案
确保您使用表格格式输出并且电子表格格式已禁用。在http://ccl.northwestern.edu/netlogo/docs/behaviorspace.html我们读到:
Note however that spreadsheet data is not written to the results file until the experiment finishes. Since spreadsheet data is stored in memory until the experiment is done, very large experiments could run out of memory. So you should disable spreadsheet output unless you really want it.
另请注意:
doing runs in parallel will multiply the experiment's memory requirements accordingly. You may need to increase NetLogo's memory ceiling (see this FAQ entry).
其中链接的常见问题解答条目为 http://ccl.northwestern.edu/netlogo/docs/faq.html#howbig
使用file-flush
不会有帮助。它将所有缓冲数据刷新到磁盘,但仅限于您自己使用 file-open 打开的文件,而且无论如何,与文件关联的缓冲区是固定大小的,不会随着时间的推移而增长。 file-flush
仅当您在运行期间从另一个进程读取同一文件时才有用。
关于NetLogoBehaviorSpace内存大小限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24397338/