Repast Simphony:关闭批处理运行中的数据收集

Repast Simphony: Turn Off Data Collection in Batch Runs

我们一直在 Repast Simphony 中进行开发,现在正尝试扩大模拟规模。 GUI 非常适合测试,但是,我们不需要这些数据集来进行更大规模的运行。 我假设我们可以通过从 GUI 中删除数据集或删除定义它们的 *.xml 文件来停止数据收集,但这会使切换回小型测试变得困难。

假设模拟处于批处理模式,是否有停止 Repast 数据收集的方法? 像 -

public class myBuilder implements ContextBuilder<Object> {  
    
    @Override
    public Context build(Context<Object> context) {
        // some very intelligent code
        // with excellent commenting

        if(RunEnvironment.getInstance().isBatch()) {
            // what can I put here?
            // something like this?
            AbstractDataSetManager.getInstance.clearDataSets();
        }

    } // end build()
}// end myBuilder class

有没有像RunEnvironment这样的数据集class? 或者通过主上下文访问数据聚合器的方法?

不幸的是,当 ContextBuilder.build 被调用时,删除数据集已经太晚了,因为它们已经被初始化了。您可以从 scenario.xml 中手动删除数据集,例如,

?xml version="1.0" encoding="UTF-8" ?>
<Scenario simphonyVersion="2.8.0">
<repast.simphony.dataLoader.engine.ClassNameDataLoaderAction context="jzombies" file="repast.simphony.dataLoader.engine.ClassNameDataLoaderAction_0.xml" />
<!--
<repast.simphony.action.data_set context="jzombies" file="repast.simphony.action.data_set_1.xml" />
<repast.simphony.action.data_set context="jzombies" file="repast.simphony.action.data_set_2.xml" />
<repast.simphony.action.data_set context="jzombies" file="repast.simphony.action.data_set_3.xml" />
-->
<repast.simphony.action.time_series_chart context="jzombies" file="repast.simphony.action.time_series_chart_10.xml" />
<repast.simphony.action.histogram_chart context="jzombies" file="repast.simphony.action.histogram_chart_11.xml" />
<repast.simphony.action.histogram_chart context="jzombies" file="repast.simphony.action.histogram_chart_12.xml" />
<repast.simphony.action.display context="jzombies" file="repast.simphony.action.display_13.xml" />
<repast.simphony.action.display context="jzombies" file="repast.simphony.action.display_14.xml" />
<repast.simphony.action.display context="jzombies" file="repast.simphony.action.display_15.xml" />
<repast.simphony.action.display context="jzombies" file="repast.simphony.action.display_16.xml" />
<repast.simphony.action.display context="jzombies" file="repast.simphony.action.display_17.xml" />
</Scenario>

如果您保留两份副本 - 一份用于批处理,一份用于 GUI 并在它们之间交换(将适当的副本复制到 scenario.xml),这应该可以满足您的需求。我会避免使用一个文件并在必要时取消注释。这不是特别可靠,因为如果您在 GUI 中加载带有注释数据集的场景并编辑和保存,则数据集不再被注释掉但根本不会被写入。