gcubed.runners.simulation_runner

This module contains the SimulationRunner class - used to run simulation experiments that build on an existing baseline projection.

It supports the types of experiments that could be done using the Ox implementation of G-Cubed.

Overview

Runs a simulation experiment, building simulation layers on top of a single set of baseline projections.

  1. The baseline projections are loaded. This means that the one set of baseline projections can be res-used across multiple simulation runners.
  2. The experiment design is loaded, setting out each of the events being simulated as a separate simulation layer.
  3. The simulation layers are loaded and applied to the model to generate projection updates.

Projections based on any of the simulation layers can be compared to projections from the baseline or from other simulation layers associated with the experiment.

Note that the model has already been solved in the baseline projections. There is no scope to do any adjustments to linearisations etc.

You can run new simulation experiments with this simulation runner after it has been created, by simply updating the experiment_design_file. That resets the runner to its initial state, ready for a new run.

SimulationRunner( baseline_projections: gcubed.projections.baseline_projections.BaselineProjections, experiment_design_file: str = None)

Constructor

When the constructor is called, the runner loads the configuration and the model, ready for running. Call the run method when you are ready to start model linearisation etc. after having set properties for the runner to determine its behaviour, for example, how linearisation is done in relation to the neutral real interest rate.

The relinearisation of the model is done for each event year associated with a simulation layer and for each year nominated for relinearisation.

Arguments

baseline_projections: The baseline projections to be used as the basis for the simulation.

experiment_design_file: The location of the experiment design CSV file, as a relative path directory to the experiment design file from the simulations directory within the model directory (the model directory contains the configuration file).

Exceptions

Raises exceptions if the baseline projections are not specified correctly.

Raises exceptions if the experiment design file is not specified correctly.

start_projections_from_the_neutral_real_interest_rate: bool

True if the baseline linearisation is around neutral real interest rates and False if they are around database values.

Defaults to True.

linearise_around_the_neutral_real_interest_rate: bool

True if the baseline linearisation is around the neutral real interest rate and False if it is around database values.

relinearise_around_the_neutral_real_interest_rate: bool

True if relinearisations are around the neutral real interest rate and False if they are around previous projection values in the relinearisation year.

relinearise_in_event_years: bool

True if the runner is to relinearise the model in all event years as well as the years specified and False if the runner is to relinearise the model only in the years specified.

Defaults to False.

If necessary, modify this setting once the running is instantiated but before the experiment is run.

experiment_design_file: str

The experiment design file name or None if no experiment is to be run.

Returns the original baseline projections that the simulation layer build on.

def run(self):

Overview

Do the actual work of running the model and performing the experiment.

Call this method after setting up the runner.

Once the experiment has run, you can retrieve projections from the simulation layer(s) of interest and the baseline for comparison and analysis purposes.