Specify a model in the TMB engine.
Arguments
- before
List of formulas to be evaluated (in the order provided) before the simulation loop begins. Each
formula
must have a left hand side that gives the name of the matrix being updated, and a right hand side giving an expression containing only the names of matrices in the model, functions defined in the TMB engine, and numerical literals (e.g.3.14
). The available functions in the TMB engine can be described inengine_functions
. Names can be provided for the components ofbefore
, and these names do not have to be unique. These names are used by thesim_exprs
argument.- during
List of formulas to be evaluated at every iteration of the simulation loop, with the same rules as
before
.- after
List of formulas to be evaluated after the simulation loop, with the same rules as
before
.- default
Named list of objects, each of which can be coerced into a
numeric
matrix
. The names refer to variables that appear inbefore
,during
, andafter
.- integers
Named list of vectors that can be coerced to integer vectors. These integer vectors can be used by name in model formulas to provide indexing of matrices and as grouping factors in
group_sums
.- must_save
Character vector of the names of matrices that must have their values stored at every iteration of the simulation loop. For example, a matrix that the user does not want to be returned but that impacts dynamics with a time lag must be saved and therefore in this list.
- must_not_save
Character vector of the names of matrices that must not have their values stored at every iteration of the simulation loop. For example, the user may ask to return a very large matrix that would create performance issues if stored at each iteration. The creator of the model can mark such matrices making it impossible for the user of the model to save their full simulation history.
- sim_exprs
Character vector of the names of
before
,during
, andafter
expressions that must only be evaluated when simulations are being produced and not when the objective function is being evaluated. For example, expressions that generate stochasticity should be listed insim_exprs
because TMB objective functions must be continuous.- state_update
(experimental) Optional character vector for how to update the state variables when it is relevant. Options include
"euler"
,"rk4"
, and"euler_multinomial"
.