Class Simulation

Class Simulation#

Class Documentation#

class Simulation

Sets up and controls the flow of the simulation.

Running set_inheritance() and run_reps() in this order is essential to run a simulation. The class also contains setters for advanced options, which should be run before run_reps(). The simulation runs a burn-in period of 1 year (365 days) implicitly at the start of each repetition before outputting any data. A 1 year burn-in allows consistency in annual data such as rainfall (seasonality) data and aestivation periods.

Note

Advanced options that have been set apply to all repetitions (runs) of a single simulation.

Warning

Advanced options will typically give an error message if the setting process has been unsuccessful. If they are not re-set successfully before running the simulation the option will maintain its default behaviour.

Public Functions

Simulation(InputParams input)

Simulation constructor.

See also

InputParams

Parameters:

input[in] simulation parameters

~Simulation()

Simulation destructor.

void set_coords(const std::filesystem::path &filepath)

Sets the sites’ coordinates and the release sites from a file, unless any errors are thrown.

The file should be structured in three columns, with x and y coordinates and whether the site is a release site (y/n) respectively. Values should be delimited by white space, and site rows should be delimited by new lines.

Warning

Setting specific release sites will change the mode of gene drive release from random to scheduled. The specified release sites will be used for each of the releases (if using multiple release times). Mosquitoes will be released at all release sites for each release time.

Parameters:

filepath[in] coordinates filepath, can be a relative or absolute filepath, or a filename (only if the file is in the build directory)

void set_boundary_type(BoundaryType boundary)

Sets the boundary type for the model.

Parameters:

boundary[in] boundary type

void set_dispersal_type(DispersalType disp)

Sets the dispersal type for the model.

Parameters:

disp[in] dispersal type

void set_rainfall(const std::filesystem::path &filepath)

Sets the daily rainfall values from a file, unless any errors are thrown.

These can be daily values for a year cycle (365 days), or daily values for all the simulated days (max_t). The values should be delimited by new lines.

See also

Seasonality

Note

This option will use the input parameters alpha1 and resp previously provided and ignore amp.

Parameters:

filepath[in] rainfall filename, can be a relative or absolute filepath, or a filename (only if the file is in the build directory)

void set_release_times(const std::filesystem::path &filepath)

Sets the release times for gene drive release from a file, unless any errors are thrown.

Release times should be simulation day numbers within the maximum time of simulation. Values should be delimited by new lines.

See also

GDRelease

Note

When using this option, the input parameter driver_start previously entered will be ignored.

Parameters:

filepath[in] release times filename, can be a relative or absolute filepath, or a filename (only if the file is in the build directory)

void set_inheritance(InheritanceParams inher_params)

Sets the values of the f_{ijk} inheritance fraction for the gene drive considering r2 non-functional resistance alleles.

f_{ijk} denotes the fraction of genotype k offspring from mother with genotype i mated to father with genotype j.

The order of elements in each matrix axis is the following genotype order: WW, WD, DD, WR, RR and DR, composed of wild-type (W), drive-type (D) and resistant-type (R) alleles.

Note

Six genotypes are counted and not nine because WD and DW genotypes are counted together, and likewise for the other heterozygous genotypes.

Note

DD, RR and DR adult females are assumed to be sterile as they don’t possess one functional copy of the dsx gene and thus produce no offspring.

Parameters:

inher_params[in] inheritance parameters

void run_reps()

Runs the simulation num_runs times, recording data in output files.