Managing multiple anylogic simulations within an experiment

我的未来我决定 提交于 2020-01-06 13:52:40

问题


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.

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- 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.

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.

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


回答1:


maybe I don't understand your need but this certainly sounds like you'd want to use a "Parameter Variation" experiment. You can specify which parameters should be varied in which steps and running the experiment automatically starts as many simulation runs as needed, all without animation.

hope that helps




回答2:


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.

  • Firstly I build an experiment typed as 'multiple run', create my GUI (user was able to select the string values used in each run.
  • Then, I create a new java class which inherit from the previous 'multiple run' experiment,

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);
}

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.



来源:https://stackoverflow.com/questions/26634142/managing-multiple-anylogic-simulations-within-an-experiment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!