Construct an object with methods for simulating from and optimizing a
compartmental model made using TMBModel
.
Arguments
- tmb_model
An object of class
TMBModel
.- tmb_cpp
Name of a C++ program using TMB as the simulation engine.
- initialize_ad_fun
Should the TMB AD function be intialized? This should usually be set to
TRUE
unless you want to hack the data structure passed to TMB (which can be acquired using$tmb_model$make_ad_fun_arg()
) before passing it yourself toTMB::MakeADFun
. This is particularly useful if you want to modifytmb_cpp
.
Value
Object of class TMBSimulator
with the following methods.
Methods
$report()
: Runs simulations and returns a data frame with the following columns.matrix
: Name of the matrix with values returned.time
: Time step of the values.row
: Row in thematrix
containing thevalue
.col
: Column in thematrix
containing thevalue
.value
: Numerical value being reported.
$error_code()
: If the simulations result in an engine error then the code associated with this error is returned, otherwise the code0
is returned.$ad_fun()
: Return the underlying TMB object.