Closed jaivardhankapoor closed 2 years ago
If v doesn't depend on x, couldn't you compute the exact solution?
In any case, it's not clear to me if v
is a function or a variable, but you can include external inputs as long as they're in the scope of func
. This should work automatically with odeint
, and with odeint_adjoint
you'd have to specify the extra parameters through the adjoint_params
option. Maybe https://github.com/rtqichen/torchdiffeq/issues/145#issuecomment-762480592 can help.
Hi. I am a power system researcher. Your question is very similar to the differential-algebraic equations (DAE) of power systems. I have developed a neural DAE module based on torchdiffeq. Maybe you can look to my work at https://github.com/xxh0523/Py_PSNODE and https://arxiv.org/abs/2110.12981. However, the adjoint approach is analyzed in the paper but not implemented since in power system simulations, the integration step is usually fixed.
Hi. I am a power system researcher. Your question is very similar to the differential-algebraic equations (DAE) of power systems. I have developed a neural DAE module based on torchdiffeq. Maybe you can look to my work at https://github.com/xxh0523/Py_PSNODE and https://arxiv.org/abs/2110.12981. However, the adjoint approach is analyzed in the paper but not implemented since in power system simulations, the integration step is usually fixed.
Thank you for directing me toward this @xxh0523. I am confident that dx/dt = v(t, x| z)
is a form of DAE . Indeed, the most straightforward way to interface extra controls with odeint_adjoint
seems to be augmenting the ODE equation using d[x(t);v(x,t|z)] / dt = [v(t,x|z);0]
as mentioned in the original question. In case this might lead to greater memory consumption and wierd adjoint issues (these might be actually happening to me right now) I will look into this solution as mentioned by @rtqichen. Closing this issue as current interface seems to be able to handle this for now. Thanks for your help!
@jaivardhankapoor I'm facing a similar question. I'm curious, how did you solve that in the end?
Hi, I am trying to integrate a differential equation with the following formulation:
dx/dt = v(t | z)
, wherev
is independent ofx
and is outputted from a neural net with inputz
. In this,v
can be thought of as an external control.The issue is that
odeint_adjoint
only supports input asfunc
of the formfunc(t, x)
. How do I includev(t|z)
into theodeint_adjoint
arguments without augmenting the differential equation itself (d[x;v]/dt=[v(t|z);0]
)?Apologies if this is a common question that I might have somehow missed.
EDIT:
the ODE also depends on
x
, along with an externalz
:dx/dt = v(t, x| z)
. So It cannot be solved exactly. Apologies for the confusion.