I have a question regarding the regression tools in SimBiology. I have an ODE model which I would like to fit for a given dataset using sbiofit or sbiofitmixed. When i want to find some parameter set using sbiofitmixed, the ODE model can return with invalid values (e.g. complex, NaN or Inf) which completely halts the search process. My experience with sbiofit is that the algorithms can recover from these values (as opposed to sbiofitmixed) for the vast majority of cases, but in some occasion the procedure still halts. Even if I set bounds on my parameters, there could be a (hidden) nonlinear relationship which makes the ODE invalid for a specific combination of the fitted parameter values. The following error message can occur using sbiofitmixed:
Error using sbiofitmixed (line 249)
A simulation errored or returned NaN, Inf, or complex values during parameter estimation. This typically indicates that the estimated parameter values converged to values that are invalid for the model.
My question is if there is any way to recover sbiofitmixed from these parameter values? For example defining an event during the ODE simulation which stops the integration. It would be nice, if there was a way to find a different trial point for the current iteration in such cases for the algorithm.
Bonus question: Is there any 'best practice' in the literature to handle these situations? For example if I code the algorithm by hand, I could just stop the integration if some state variable exceeds some given value. At these instances I could just set the cost function to some high value (for example 1e5), however I have a gut feeling that this is not the best solution for this issue.
Thank you in advance,