Adjoint ODE

Question: Minimize F(x,p)F(x, p)

F(x,p)=0Tf(x,p,t)dt(1)F(x, p) = \int_{0}^{T}f(x,p,t)dt \tag1

Subject to

g(x0,p)=x0p=0(2)g(x_0,p) = x_0 - p =0 \tag2

-> If given x0x_0, we can compute pp at t=0t=0 through g(x0,p)g(x_0, p), then substitue xtx_t and pp in h(xt,x˙t,p,t)h(x_t, \dot{x}_t, p, t) and can compute x˙t\dot{x}_t

Why is xp\frac{\partial{x}}{\partial p} difficult to calculate? Because fn(x,p)fn(x,p) is unknown, need to solve ALL possible xx and pp using ODE

Apply Lagrangian function L(x,λ)=f(x)λg(x)\mathcal{L} (x, \lambda)= f(x)- \lambda g (x) and combine (1) (2) (3) in one loss function

Loss=0T[f(x,p,t)+λTh(xt,x˙t,p,t)]dt+uTg(x0,p)(4)Loss = \int_{0}^{T}[f(x,p,t) + \lambda^Th(x_t, \dot{x}_t, p, t)]dt + u^T g(x_0,p) \tag4

Substitute (2) (3)

Loss=0T[f(x,p,t)+λT0]dt+uT0=0Tf(x,p,t)dt=F(x,p)(5)Loss = \int_{0}^{T}[f(x,p,t) + \lambda^T0]dt + u^T 0 = \int_{0}^{T}f(x,p,t)dt = F(x, p) \tag5

Why does integral equals loss? Why is this loss function? Minimize loss?

Lp=Fp(6)\frac{\partial{L}}{\partial p} = \frac{\partial{F}}{\partial p} \tag6

Why calculate Lp\frac{\partial{L}}{\partial p}during backprop? To use Newton's Method to approximate f(x) at a given point

approximation using updated derivative
Lp=Fp=0T[fxxp+fp+λT(hxxp+hx˙x˙p+hp)]dt+uT(gx0x0p+gp)\frac{\partial{L}}{\partial p} = \frac{\partial{F}}{\partial p} = \int_{0}^{T}[\frac{\partial{f}}{\partial x}\cdot\frac{\partial{x}}{\partial p}+\frac{\partial{f}}{\partial p}+\lambda^T(\frac{\partial{h}}{\partial x}\cdot\frac{\partial{x}}{\partial p}+\frac{\partial{h}}{\partial \dot{x}}\cdot\frac{\partial{\dot{x}}}{\partial p}+\frac{\partial{h}}{\partial p})]dt+u^T(\frac{\partial{g}}{\partial x_0}\cdot\frac{\partial{x_0}}{\partial p}+\frac{\partial{g}}{\partial p})

To avoid compute x˙p\frac{\partial{\dot{x}}}{\partial p} , we apply integration by parts udv=uvvdu\int u dv = u v - \int v du

Lp=Lp\frac{\partial{L}}{\partial p} = \frac{\partial{L}}{\partial p}

Last updated

Was this helpful?