doc:batch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
doc:batch [2021/07/16 09:43] – created thomasdoc:batch [2022/06/08 12:04] (current) – [Batch Optimizations] thomas
Line 1: Line 1:
-====== Batch Optimization from the Command Line ====== +====== Batch Optimization using the Command Line ====== 
-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``.+==== 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: 
 +<code> 
 +"C:\Program Files\SCONE\sconecmd.exe" -o "your_scenario.scone" 
 +</code> 
 +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: 
 +<code> 
 +sconecmd.exe -o "scenario.scone" CmaOptimizer.random_seed=10 
 +</code> 
 + 
 +You can also **access settings by index**, which is useful for settings that are not uniquely identifiable by name: 
 +<code> 
 +sconecmd.exe -o "scenario.scone" CmaOptimizer.SimulationObjective.CompositeController.#1.value=10 
 +</code> 
 +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: 
 +<code> 
 +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 
 +</code> 
 + 
 +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. 
 +<code> 
 +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 
 +</code> 
 + 
 +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: 
 +<code> 
 +set SCONECMD="C:\Program Files\SCONE\bin\sconecmd.exe" 
 +for %%f in (*.scone) do ( 
 + start "%%f" %SCONECMD% -o "%%f" 
 + timeout 1 
 +
 +</code>