Skip to contents

Run the agent- and FBA-based simulation.

Usage

run_simulation(
  object,
  niter,
  verbose = 1,
  lim_cells = 1e+05,
  lim_time = 300,
  convergence.e = 1e-04,
  record = NULL,
  n.cores = NULL,
  live.plot = F,
  on.iteration = NULL,
  ...
)

Arguments

object

An object of class growthSimulation

niter

Number of rounds to simulate

verbose

Control the 'chattiness' of the simulation logs. 0 - no logs, 1 - only main logs, 2 - chaffinch.

lim_cells

Simulation terminates of total number of cells exceed this value.

lim_time

Simulation terminated after the first iteration that finished after this time limit (in minutes).

convergence.e

Numeric indicating when community growth (pg) is considered to have reached convergence

record

Character vector that indicates, which simulation variables should be recorded after each simulation iteration. See Details.

n.cores

Number of CPUs to use for parallelisation. If NULL (default), it will use the number of detectable cores minus 1 and in maximum 10 cores.

live.plot

Logical. If TRUE, positions of cells are plotted at each iteration. Caution: May reduce performance of simulation. Default: FALSE

on.iteration

An optional function that is performed at the end of each iteration and returns again an object of class growthSimulation.

...

Additional arguments to `on.iteration`

Details

Recording: The cells' positions, masses, sizes, and metabolite exchanges are always recorded. Also recorded are the global metabolite concentrations. Due to memory considerations, local metabolite concentrations are not recorded by default. However, users can specify which concentrations are tracked during the simulation using the `record` option. E.g.

record = c("compound_cpd00029_e0","compound_cpd00211_e0")

records the concentration fo the to two metabolites `cpd00029_e0` and `cpd00211_e0`. All compound concentration can be recorded with

record = "compounds" ,

yet, is not advised as this could be storage- and time-consuming. Compound concentrations are not stored in memory but on the hard drive in a file within the working directory. Tracked concentrations can also be plotted with plot_environment. Exoenzyme concentrations cannot be recorded in the current version.

Convergence is checked by calculating the ratio: $$c := | a_i / min(a_{i-1},...,a_{i-5}) - 1 |$$ \(a_i\) is the total biomass at iteration \(i\). The simulation terminates if \(c\) is below `convergence.e`. Thus, one can expect longer simulations when reducing `convergence.e`.