You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A discussion at a macpan tech meeting about when to round variables that should be integers (e.g. state variables in some models with process error) led to the idea that we should have a warning system for the engine. The standard Rf_warning mechanism is annoying in TMB because it will get called at each of the (5?) steps of the MakeADFun machinery and for each time step. Here is a design that addresses this issue and makes it straightforward to provide information about what time-step and expression was involved in the warning.
Define an enum of distinct warning messages.
When a warning is triggered it pushes back one int into each of the following vectors:
warn_msg_int : value of the enum for the triggered warning
warn_row : parse table row
warn_time : time step
These vectors are placed in the report.
On the r-side we can interpret every element of these vectors:
warn_msg_int -> character vector of warning messages
warn_row -> vector of expressions as characters (e.g. "x ~ round(0.5)")
warn_time -> unaltered vector of time-steps
Summarise this 'warning table' so that the time column is a string representing time-step ranges (e.g. "1, 5-10"), which would keep the table from being too long in models with many time-steps.
When this interpreted and summarised warning table has more than zero rows, throw a warning that prints the table.
The text was updated successfully, but these errors were encountered:
This seems like a good idea. It's too bad that we're working within C++ instead of R here; in R we could more easily write functions that modify their environments to warn only once in a session (as discussed by you in a recent lab meeting I think?)
I'm trying to think of alternative ways to achieve this goal without writing our own warning system ...
A discussion at a macpan tech meeting about when to round variables that should be integers (e.g. state variables in some models with process error) led to the idea that we should have a warning system for the engine. The standard
Rf_warning
mechanism is annoying in TMB because it will get called at each of the (5?) steps of theMakeADFun
machinery and for each time step. Here is a design that addresses this issue and makes it straightforward to provide information about what time-step and expression was involved in the warning.The text was updated successfully, but these errors were encountered: