diffrax icon indicating copy to clipboard operation
diffrax copied to clipboard

Solver selection -- multistep/Adams methods

Open timnotavailable opened this issue 9 months ago • 4 comments

Hello, I have a short question about how to select a proper solver: I have seen some projects using CVODE Adams-Moulton formulas with variable steps. I'm searching for available solver in diffrax which has similar performance as Adams as diffrax is well written. Therefore I would like to ask in our diffrax solvers whether there is a solver having similar performance as Adams. And whether I could implement multi-solver through diffrax interface?

timnotavailable avatar Mar 23 '25 13:03 timnotavailable

It is possible to implement multi-step solvers in Diffrax, see for example LeapfrogMidpoint: https://github.com/patrick-kidger/diffrax/blob/main/diffrax/_solver/leapfrog_midpoint.py

We don't have them built-in at the moment -- Runge--Kutta methods seem to be much more popular amongst our users!

I'd be happy to take a PR on some Adams methods. The two main 'gotchas' that come to mind are (a) having a static-shape-compatible way of handing the initial bootstrapping phase of the first few steps, for which smaller tableaus are used -- maybe just by using some kind of padding? (b) handling implicit solves through the use of diffrax.VeryChord or any other Optimistix root-finding method.

((b) will only apply if you need Adams--Moulton and not just Adams--Bashforth methods, i.e. implicit and not explicit)

patrick-kidger avatar Mar 28 '25 18:03 patrick-kidger

Thanks! Really amazing library diffrax~!

timnotavailable avatar Mar 30 '25 13:03 timnotavailable

Asking if this is still in someone's queue? I am very interested in utilizing ABM type methods in some Reinforcement Learning rollouts that require shooting methods. The function call is rather expensive and I want high accuracy with less numbers of function calls.

Happy to implement a PR if no one is on the case!

mathDR avatar Sep 11 '25 01:09 mathDR

I don't think this is on anyone's queue! Very happy to consider a PR on this :)

(Fair warning that I think this will be moderately tricky though! ;) )

patrick-kidger avatar Sep 11 '25 15:09 patrick-kidger