From a86c63a5eef1eb73c66331e17adf9fd15f37f828 Mon Sep 17 00:00:00 2001 From: Danilo Pianini Date: Fri, 3 Feb 2023 13:26:44 +0100 Subject: [PATCH] Update _index.md --- site/content/howtos/execution/batch/_index.md | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/site/content/howtos/execution/batch/_index.md b/site/content/howtos/execution/batch/_index.md index 220f4c7fe1..4b2bd37f07 100644 --- a/site/content/howtos/execution/batch/_index.md +++ b/site/content/howtos/execution/batch/_index.md @@ -1,42 +1,41 @@ +++ -title = "Execute simulations batches" +title = "Parameter Sweeping with simulation batches" weight = 1 tags = ["batch", "variables", "dry"] -summary = "Execute multiple instances of the same configuration" +summary = "Execute multiple instances of a simulation with different parameters" +++ In some cases you may need to test the same simulation configuration with different *parameters*. Suppose for example that you want to see what happens when you place a bunch of pedestrian in a circle -(for sake of semplicity we'll ignore their behavior). You may want to +(for sake of semplicity we'll ignore their behavior). +You may want to observe the scenario with 50 pedestrians placed in a 5 meters radius circle. Then you may like to observe it with 100 pedestrian and perhaps by changing the circle radius also. Instead of re-writing the configuration file over-and-over for each parameter combination, Alchemist offers the possibility to write the -configuration once, and it will then derive a batch of simulations. +configuration once, and it will then derive a batch of simulations.the same configuration ## Launching batch simulations -To exploit this mechanism, you must declare what we above called "parameters" + +To exploit this mechanism, you must declare the "parameters" as **variables**. In our example, they would be the *number of pedestrian* and the *radius of the circle* where to place them. Let's write the configuration file, -specifing that we want to test the simulation with 10, 30, 50, 70, 90 pedestrian +specifing that we want to test the simulation with 10, 30, 50, 70, 90 pedestrians and a 5, 10, 15 meters circle radius: {{< code path="src/test/resources/website-snippets/batch-pedestrian-simulation.yml" >}} {{% notice info %}} To understand how variables work refer to [this page](/howtos/simulation/variables/). -You may also want to learn how to deal with [data exportation](/howtos/simulation/export/) -and [termination criterias](/howtos/execution/termination/). +You may also want to learn how to [export data](/howtos/simulation/export/) +and specifying [termination criteria](/howtos/execution/termination/). {{% /notice %}} -Now we can launch the batch of simulations by yielding the following command: - -```bash -./gradlew run --args="-y -b -hl -var pedestrianNumber - var circleRadius -e " -``` +Now we can launch the batch of simulations by providing the simulator the following command-line arguments: +* `-b`: enable batch mode +* `-var pedestrianNumber`: all values of variable `pedestrianNumber` will be tested +* `-var circleRadius`: all values of variable `circleRadius` will be tested -The `-b` option is to tell Alchemist that we want to execute a batch, while the `-hl` stands -for headless which means we are not interested in starting-up a gui. -Under the hood the simulator will compute the cartesian product of the variables sets -specified with the `-var` option. +Under the hood, the simulator will compute the cartesian product of the all possible values of the variables selected with the `-var` option. +Variables not selected for the batch will have their default value.