Batch Optimization using the Command Line
The SCONE Command-line Interface
If you need to automate multiple optimizations, you can use the sconecmd
, the SCONE command-line interface. By default, it is located in C:\Program Files\SCONE\sconecmd.exe
, and can be used as follows:
"C:\Program Files\SCONE\sconecmd.exe" -o "your_scenario.scone"
The -o
command line starts an optimization of a scenario. The -e
command line switch can be used to evaluate a .scone
or a .par
file.
Changing Scenario Parameters
You can change any parameter in your .scone scenario by specifying it in the command line, for example:
sconecmd.exe -o "scenario.scone" CmaOptimizer.random_seed=10
You can also access settings by index, which is useful for settings that are not uniquely identifiable by name:
sconecmd.exe -o "scenario.scone" CmaOptimizer.SimulationObjective.CompositeController.#1.value=10
This sets the value
parameter for first child of CompositeController
. The second, third, etc. element can be accessed via #2
, #3
, etc.
Batch Optimizations
For batch processing, you can create a Windows .bat
file which contains multiple commands:
set SCONECMD="C:\Program Files\SCONE\bin\sconecmd.exe" %SCONECMD% -o "scenario.scone" CmaOptimizer.random_seed=10 %SCONECMD% -o "scenario.scone" CmaOptimizer.SimulationObjective.ModelOpenSim3.model_file=data/model.osim
If you wish to run multiple optimizations in parallel, you can do so by prefixing your command with start
. The first argument after start (“SCONE”) is the title of the console window that is spawned.
set SCONECMD="C:\Program Files\SCONE\bin\sconecmd.exe" start "SCONE" %SCONECMD% -o "scenario.scone" CmaOptimizer.random_seed=10 start "SCONE" %SCONECMD% -o "scenario.scone" CmaOptimizer.SimulationObjective.ModelOpenSim3.model_file=data/model.osim
If you wish to optimize all scenarios in a folder, you can use the following .bat script to optimize all .scone scenarios in the current directory:
set SCONECMD="C:\Program Files\SCONE\bin\sconecmd.exe" for %%f in (*.scone) do ( start "%%f" %SCONECMD% -o "%%f" timeout 1 )