0
votes

I need to run a large number of experiments and would like to do so over night as to waste as little time as possible. I have some output that I can export using PrintWriter, but I need to be able to start the next experiment programmatically after the other.

So something like

After experiment:
    Experiment63.start().run();    
1
have you tried the buildin experiment functions? like parameter variation?Nikolaj Klitlund Børty
yes, but aren't suited to my specific needs.Sjors Hijgenaar
could you elaborate on your specific needs? when you say "programmatically" what do you mean? via: anylogic, java, bash, powershell, console etc.Nikolaj Klitlund Børty
For instance I have a large number of sensitivity analysis experiments in which I want to examine the effect of several parameters on model output independent of each other. I would like to controle it via AnyLogic or Java.Sjors Hijgenaar
well for me, it sounds like it sounds like you need to use the parameter variation experiment. You can run several experiments simultaneously with different input parameters, and afterwards you can look at the result of each of the experiments and compare themNikolaj Klitlund Børty

1 Answers

1
votes

If a parameter variation experiment doesn't do what you need and you really need to run mulitple sensitivity analyses, try this:

  1. Create a new Custom Experiment
  2. Delete everything in the properties window
  3. Use YourExperimentClass.main(new String[] {}) to start each experiment.

For example, lets say you have three sensitivity analyses to run:

SensitivityToHeatExperiment.main(new String[] {}); SensitivityToSpeedExperiment.main(new String[] {}); SensitivityToFrictionExperiment.main(new String[] {});

These calls bring up a window for each experiment. Since experiments don't start automatically, you'll need to add that logic if you don't want to click "run" a bunch of times! In each Experiment's Initial experiment setup section, put run();. This automatically starts the simulation for you.

I haven't quite figured out how to close the windows automatically using this approach: system.exit(0) and experiment.close() shut all windows opened by the experiment, so you'll need a way to tell if all experiments are done running. One option is to use a common file and a FileLock to ensure the simulations don't encounter concurrency problems. Note that FileLock might be handy if all sensitivity experiments need to write to common files.