Open Hs293Go opened 7 months ago
Yup, this sounds exactly like what Diffrax is for. You might also find this example a useful reference for how to insert the control input u
.
Touching on your other points:
def u(t):
# lookup values of `u_i` here given `t`. Implement arbitrary behaviour for those `t` that aren't in the discretisation points.
ControlTerm
; this is used for SDEs etc. (The word "control" here is in the sense of a "controlled differential equation", e.g. the SDE-like objects dy(t) = f(y(t)) dx(t)
.) You just want an ODE like in the example above.I hope that helps!
Diffrax docs' Kalman Filter Example encouraged me to apply diffrax to other linear-quadratic control problems, such as the following
essentially finding the optimal control $u$ over a prediction horizon $T$ discretized into $N$ segments.
Diffrax seems like a good fit for solving the IVP $\dot{x}(t) = f(x(t), u(t)),\ x(0) = x{init}$ over the prediction horizon to compute $x{0,\ldots,N}$. In this case...
Heun
already has an embedded error estimator)interpolate_us
in the KF exampleControlTerm
is useful hereIs diffrax the right tool for this job? Is yes, what is the best approach; Are there any idioms?