Automation

This is a set of automation features for Monte-Carlo and batch runs.

Note

The automation part is still rudimentary in the current release.

Model Runner

class sfctools.automation.runner.ModelRunner(settings_path, results_path, builder, iter)

Bases: object

A model runner is a generic ‘frame’ for running a model file. It requires a specific folder structure (see constructor). The usage of this is optional and voluntary. However, this could be helpful when running Monte-Carlo batches.

Parameters
  • settings_path – str or path to .yml file

  • results_path – str or path, dir where results are written

  • builder – callable, method to call when building agents

  • iter – callable, method to call when iterating one simulation, should have an argument N (for number of iterations) and must return a dataframe (or a comparable data structure which supports a to_csv method)

This runs a simulation and create logger files and data files

./root
|_____output.txt <<
|_____errors.txt << will contain all error messages
|_____progress.txt << will log the progress of the simulation run
|_____output.0
|_____output.1
|_____output.2
|_____output.3 << will contain the data of the actual runs
run(M: int, N: int)

runs a monte-carlo simulation wih M monte carlo runs and N simulation periods per run. Outputs are written to logger files.

Parameters
  • M – number of monte-carlo runs

  • N – number of time periods per monte-carlo run