patrick-kidger / patrick-kidger/diffrax
Running diffeqsolve for a fixed number of *accepted* steps
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 189
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 1
Description
Is it possible to run diffeqsolve with an adaptive stepsize controller for a fixed number of accepted steps? The solution diffeqsolve(..., max_steps=n, throw=False, t1=jnp.inf) does not distinguish between rejected and accepted steps.
The solution diffeqsolve(..., max_steps=n, throw=False, t1=jnp.inf) can be put in a subloop that checks sol.stats["num_rejected_steps"]. I tried this, but I think this may require explicitly calling adapt_step_size() outside of diffeqsolve. If I pass only the controller_state to diffeqsolve, I get stuck in an infinite loop whenever a rejection occurs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the diffeqsolve entry point and the adaptive-step logic around adapt_step_size and controller_state. Compare sol.stats["num_rejected_steps"] with max_steps to determine how accepted and rejected steps are currently counted. Done means adaptive solving can stop after a requested number of accepted steps without hanging after a rejection, with tests covering that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100