Scipy LSODA for stiff ODE
Author: janrohleffCreated Apr 3, 2024Updated Mar 28, 2025
Hey,
thank you for this great package. I have a problem using the scipy LSODA solver together with odeint_adjoint for a nonlinear stiff ODE. The problem is the following:
- The forward solve with the scipy solver works well.
- When I try to compute the backward pass the solver always get stuck at some specific time-point depending on the tolerance. I don‘t get an error and the file is still running, but it doesn‘t make any progress, i.e. stuck at this t. I think the problem is that you solve in the „backward call“ the state-equation backward in time, which is numericaly not a good idea for stiff ODEs.
But do you have any idea how this could be fixed? Or do you thinking of implementing a Torch version of LSODA, so that one just can use automatic-differentiation and use odeint.
Thank you!
Source: rtqichen/torchdiffeq