Currently, the use of the ODE integrator is very limited as it may freeze easily Stan whenever a unlucky parameter is tried out which renders the ODE system too stiff to attain an accuracy as requested.
That is, odeint does not fail in these situations which is what would make the system robust. I figured that we were unlucky with the choice of the integration scheme in odeint. That is, the dense_output scheme does not have any means to protect against this situation. Now, the controlled_stepper scheme does protect against this! That is, after 1000 tries, the controlled_stepper will throw an exception which gives Stan the required robustness.
Issue: https://github.com/stan-dev/math/issues/179
Branch with fix for it: https://github.com/stan-dev/math/tree/feature/issue-179-robust-integrator
I tested this on a 2-cmt oral dosing system which did kill Stan in iteration 3 so far with the old scheme. Now, the integrator simply rejects a few draws at the beginning, but then Stan continues sampling.
I hope this can get in quickly... as now people do not freeze Stan anymore.
Sebastian
Thinking about it a bit more, we should consider going with a maximal density of steps. That would mean to set the maximal number of steps allowed to
(t_max - t_min)/step_size * 1E3
This would say we allow for 1E3 steps per step_size time-units. Makes sense?
Sebastian
Sebastian