在一个实验中管理多个任意逻辑模拟 [英] Managing multiple anylogic simulations within an experiment

查看:14
本文介绍了在一个实验中管理多个任意逻辑模拟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在 AnyLogic 7 下开发 ABM,现在我们希望通过单个实验进行多个模拟.每次模拟运行都需要设置不同的参数,以便为一小组标准场景生成结果.

We are developing an ABM under AnyLogic 7 and are at the point where we want to make multiple simulations from a single experiment. Different parameters are to be set for each simulation run so as to generate results for a small suite of standard scenarios.

我们有一个无需按运行"即可自动启动的实验.随后按下 Run 会增加实验计数器并重新运行模型.

We have an experiment that auto-starts without the need to press the "Run". Subsequent pressing of the Run does increment the experiment counter and reruns the model.

我们想要的是一种让自动运行或单击运行"启动模拟循环的方法.在该循环中,将对链接到传递参数的变量进行编程调整.

What we'd like is a way to have the auto-run, or single press of Run, launch a loop of simulations. Within that loop would be the programmatic adjustment of the variables linked to passed parameters.

EDIT- 一个问题是一些参数是字符串.优化或参数变化实验不适合枚举要在一组模拟运行中使用的一组字符串.您可以为一个实验中的所有模拟运行为每个参数设置一个字符串.

EDIT- One wrinkle is that some parameters are strings. The Optimization or Parameter Variation experiments don't lend themselves to enumerating a set of strings to be be used across a set of simulation runs. You can set a string per parameter for all the simulation runs within one experiment.

我们使用了在没有演示窗口的情况下从外部运行模型"的帮助示例,将自动运行功能添加到初始实验设置代码块中.需要一种等待 Run 0 完成,然后调度 Run 1、2 等的方法.

We've used the help sample for "Running a Model from Outside Without Presentation Window", to add the auto-run capability to the initial experiment setup block of code. A method to wait for Run 0 to complete, then dispatch Run 1, 2, etc, is needed.

非常感谢指向具有此类功能的教程模型或实验 java 块的代码片段.

Pointers to tutorial models with such features, or to a snip of code for the experiment's java blocks are much appreciated.

推荐答案

和你一样,我也遇到过这个问题.
我的目标是在模型中使用参数变化,而变化是针对非数字数据的,我知道要开始的运行次数.
然后我在自定义变体的帮助下成功完成了这项任务.

As you, I was confronted to this problem.
My aim was to use parameter variation with a model and variation were on non numeric data, and I knew the number of runs to start.
Then i succeed in this task with the help of Custom Variation.

  • 首先,我构建了一个类型为多次运行"的实验,创建我的 GUI(用户可以选择每次运行中使用的字符串值.
  • 然后,我创建了一个新的 Java 类,该类继承自之前的多次运行"实验,

在这个类(称为 MyMultipleRunClass)中存在:- 重载默认实验中的 getMaximumIterations 方法,以向默认 anylogic 回调提供正确的迭代次数,并且还使用 idnex 从数组中检索我的参数值,- 静态方法开始的实现,

In this class (called MyMultipleRunClass) was present: - overload of the getMaximumIterations method from default experiment to provide to default anylogic callback the correct number of iteration, and idnex was also used to retrieve my parameter value from array, - implementation of the static method start,

public static void start() {
    prepareBeforeExperimentStart_xjal( MyMultipleRunClass.class);
    MyMultipleRunClass ex = new MyMultipleRunClass();
    ex.setCommandLuneArguments_xjal(null);
    ex.setup(null);
}

然后要运行的实验是空的"customExperiment,它会通过显示的子类自动启动另一个多运行实验.也许它存在最短路径,但从我的角度来看,任何逻辑都被正确使用(非暴露接口没有技巧)并且它按预期工作.

Then the experiment to run is the 'empty' customExperiment, which automatically start the other Multiple run experiment thru the presented subclass. Maybe it exists shortest path, but from my point of view anylogic is correctly used (no trick with non exposed interface) and it works as expected.

这篇关于在一个实验中管理多个任意逻辑模拟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆