AMICI-dev/AMICI

Handling (non-negativity) constraints

Closed this issue · 3 comments

In many applications, our models are subject to physical constraint, such that the model state has to be non-negative. Due to numerical issues, this is however not always ensured in practice. Currently, this is optionally handled via Model.{setStateIsNonNegative|allStatesNonNegative}, which boils down to taking max(0, state).

As of v6.2.0[1], SUNDIALS supports handling such constraints via projection functions. This would be the preferable mechanism for handling non-negativity- or more general constraints.

This will, however, first require upgrading SUNDIALS (#1565).

[1] Note: relevant memory leaks fixed in v6.4.0

Oh, for the handling of plain (non)negativity/positivity constraints we don't need to upgrade sundials. We have CVodeSetConstraints already available. Only for the more general constraint handling (#2329) we'll have to upgrade.

Okay, after a brief test, this won't help with cases where the Jacobian cannot be evaluated (produces NaN) for negative x.

Note:

CVODES in function cvInitialSetup : Constraints can not be enforced while forward sensitivity is used with simultaneous method