Open stevencarlislewalker opened 2 years ago
Having CppAD
casting issues again -- reminiscent of issues we had with the eigenvector calculations.
Rounding is not working. Here is an explanation from @guanwg:
The reason behind the failure is that TMB considers the cast as cast from type 'CppAD::AD<CppAD::AD
>' to type 'int' . CppAD::AD is a special type (different from typical types) in the sense that it not only stores a value of a variable but also keeps track of "symbol" of the variable through assignment and/or involvement in formula in order to do differentiation correctly.
We faced a similar problem with direct eigenvector computation, but worked around it by implementing a simple power method.
Except for backward compatibility/testing purposes, I don't think rounding is terribly important. I would be willing to put this to one side for now. If/when we get to dealing with process error seriously we may need to treat state as continuous anyway.
I agree @bbolker. As we discussed, rounding is not crucial for a minimum viable product.
Although it does make testing much less straightforward.
@guanwg, let's stop any work on this issue for now.
Maybe add a switch to base-MacPan to not round initial values, so you can do comparable runs?
This is a good idea @bbolker. I've explored this a bit, and am going to do it. Based on my initial poking around, there will still be a difference between the base-macpan and tmb-macpan. But this switch will make it easier to diagnose why.
options(MP_use_state_rounding = FALSE)
Perhaps we could do soft rounding here? But low priority in any case.
With some forms of simulation stochasticity, the numbers of individuals in each state needs to be rounded
SIMULATE
macro -- if it works in this context then that should be sufficient for our purposes because all of our use cases here relate to simulation/forecasting and not fitting/calibration