As part of our agent-based modeling approach, we released version 1.0.0 of bl.cli, a tool to run Monte Carlo simulations of our model. We initially built bl.cli to make it easier for our economists to produce data to quickly compare race results under heuristic strategies. bl.cli runs the Monte Carlo simulation and streams the results to a file. It has grown into a tool that allows anyone comfortable with command-line applications to run Monte Carlo simulations of our model and, in the long run, reproduce our results.
bl.cli has the following features:
- Easy and powerful configuration
- The configuration of model runs is done in an easy-to-change configuration file which includes descriptions of the available parameter options.
- For any agent parameter, it is possible to provide default parameters and to override any such parameter on a per-agent basis.
- Reproducibility: All model runs are reproducible by default because they are represented as data in files. Furthermore, model runs can be reproduced elsewhere by sharing the respective parameter file.
- Larger than memory sampling: bl.cli has been built to be able to deal with sample sizes larger than the available RAM. This is done by streaming the samples to a file and releasing the memory during the sampling process.
- Parallelization and backpressure: bl.cli is heavily parallelized and will take full advantage of all available CPU cores to increase sampling speed. At the same time, whenever the file writing speed is the performance bottleneck, backpressure will be applied to the sampling process to only sample at the speed that is needed for file writing.
- Batch processing: Batch processing different model parameters can be trivially done by dropping multiple parameter files in the parameters folder. bl.cli will then run a Monte Carlo simulation for each of them.
We wanted to make sure that the JVM-based command-line tool can be run without any prerequisites (such as a Java install) on any major operating system. We also wanted to integrate the build process with our GitLab Continuous Integration pipeline. To make this possible, we had to push some of the most cutting-edge Java build tools to their limits, but this allowed us to generate a stripped-down JRE that is compiled into an image for each major operating system inside of our current (Linux-based) pipeline. Whereas the current approaches to delivering command-line applications on the JVM are being phased out, this new approach can be expected to work and be supported for one or more decades to come. We see building scientific software that still works decades from now as an important step toward more reproducible science.
As the next step, we aim to get approval that bl.cli isn’t considered an information hazard and then release it as open-source software.