My usual approach to this problem is to create a small library of functions that help me create and customize a boiler stove. I don’t know what your experiment definition language looks like, but usually I need to write a function that writes text to initialize the simulation, a function that writes text to complete the simulation, and some other functions to write out different pieces of text that define each type of experiment.
By putting these functions in a file named mysim
, let's say I could use them as follows:
from mysim import sim_init, sim_conclude, experimentType1, experimentType2 sim_init (name="Today Simulation", author="Simon") for param1 in [0,1,2,3,4,5,6,7,8,20,30,40,50,60,70]: experimentType1 (param1) for param2 in ["A", "B", "C"]: experimentType2 (param1, param2) sim_conclude (savefile="output.txt")
This Python script will generate an input simulation file that will run an experiment of type 1 for each param1
value and conduct an experiment of type 2 for each combination of param1
and param2
.
Implementations of the functions themselves may look messy, but the script that creates the particular simulation file will be simple and straightforward.
source share