diffrax icon indicating copy to clipboard operation
diffrax copied to clipboard

Add differentiable event handling

Open patrick-kidger opened this issue 4 years ago • 4 comments

One thing that needs thinking about is how this compares to the use of jump processes as a driving control, which morally speaking do something very similar.

  • [x] Discrete terminating events
  • [ ] Discrete non-terminating events
  • [ ] Continuous terminating events
  • [ ] Continuous non-terminating events

The continuous events can be implemented by using the most recent dense_info and performing a nonlinear solve to locate the event location.

patrick-kidger avatar Aug 17 '21 08:08 patrick-kidger

With #133 we now have support for discrete terminating events! This provides support for steady-state finding, which is one of the big-ticket items for events.

patrick-kidger avatar Jul 20 '22 18:07 patrick-kidger

Hi Patrick, I'm interested in adding support for discrete non-terminating events. Do you have any suggestions on the best way to implement this feature?

jamesfkelly avatar Apr 11 '23 05:04 jamesfkelly

Probably I'd suggest adding them here:

https://github.com/patrick-kidger/diffrax/blob/0b93a3c108cff20c201da7b81e141dceff637f4f/diffrax/integrate.py#L228

and then more-or-less just copying the API for the terminating discrete events. (Although I haven't thought that hard about the details.)

I'd be happy to take a PR on this.

What's your use case?

patrick-kidger avatar Apr 11 '23 19:04 patrick-kidger

Thanks for your response! Basically, I am just looking to simulate feeding events for a cell culture. So, I'd choose some discrete subset of the integration time horizon and at each of those times, the state would be updated and integration would resume.

jamesfkelly avatar Apr 12 '23 00:04 jamesfkelly