Mimi Framework

Monte Carlo Scenarios

From Catherine Ledna: Hi all, I have a quick question/request regarding some Mimi functionality. I’ve been doing Monte Carlo runs that are structured where I am updating an external model parameter for each model run. As a result, this means I’m calling the Mimi run function in a loop, with one Monte Carlo sample per run. Currently, the run function gives you the option to save Montecarlo parameters to a file, but only if all of the trials are run at once. If you’re calling run multiple times, it will overwrite the trial output filename unless a new file name is specified. I’m wondering if there is some way to modify that function to append to an existing parameter file rather than overwrite it. The only workaround I have currently is stitching a bunch of CSV files together after the fact, but it’s not very efficient. Thank you!

Hi there! Just to try to understand your problem a little bit better, am I right in saying that you have defined a SimulationDefinition using @defsim, let’s call it sd, and you are calling run(sd, ...) within your loop using a sample size of 1? And then also within that loop you are manually updating another external parameter?

Is there a reason that that external parameter can’t be given a distribution? We have the ability to run scenarios, which for example has been used to calculate the SCC for a few pre-defined discount rates, but that includes having maybe 3 scenarios for different discount rates, and then each is run for an N of 1000 or something, so I’m just trying to understand the case of only having a sample size of 1.

We can also talk offline if you aren’t comfortable posting code here!