Skip to main content
added 8 characters in body
Source Link

I have this very simple ODE-contrained optimization problem:

  1. $h(x,x',p,t) = x'-A(p)x-b(p) = 0$, the constraint
  2. $g(x(0)) = x_0$, the initial condition with no parameters involved
  3. $F = \int (X-X_{obs})^2 dt$, the objective equation

According to adjoint method, I need to

  1. Integrate constraint equation: $$x'=A(p)x+b(p)$$

  2. Integrate adjoint equation and reverse $\lambda$ in $t$: $$\lambda'= A(p)^T-(X-X_{obs})$$$$\lambda'= A(p)^T \lambda-(X-X_{obs})$$

  3. Calculate $\frac{dF}{dp}$: $$\frac{dF}{dp} = \int \lambda^T \frac{\partial h}{\partial p} dt,$$ since $$\frac{\partial f}{\partial p} = \frac{\partial g}{\partial p}=0$$

But for parameters only show up in $\mathbf{b(p)}$ term, derivatives from adjoint method is inconsistent with derivatives estimated using $\frac{\partial F}{\partial p}$ directly while derivatives for other parameters seem OK.

I’m thinking that this inconsistency maybe due to the fact that parameters in $b(p)$ doesn’t affect the calculation of $\lambda$ directly, namely it doesn’t show up in the adjoint equation? But there is also the possibility that I did something wrong in coding.

Any body have any similar experience? Thanks!

I have this very simple ODE-contrained optimization problem:

  1. $h(x,x',p,t) = x'-A(p)x-b(p) = 0$, the constraint
  2. $g(x(0)) = x_0$, the initial condition with no parameters involved
  3. $F = \int (X-X_{obs})^2 dt$, the objective equation

According to adjoint method, I need to

  1. Integrate constraint equation: $$x'=A(p)x+b(p)$$

  2. Integrate adjoint equation and reverse $\lambda$ in $t$: $$\lambda'= A(p)^T-(X-X_{obs})$$

  3. Calculate $\frac{dF}{dp}$: $$\frac{dF}{dp} = \int \lambda^T \frac{\partial h}{\partial p} dt,$$ since $$\frac{\partial f}{\partial p} = \frac{\partial g}{\partial p}=0$$

But for parameters only show up in $\mathbf{b(p)}$ term, derivatives from adjoint method is inconsistent with derivatives estimated using $\frac{\partial F}{\partial p}$ directly while derivatives for other parameters seem OK.

I’m thinking that this inconsistency maybe due to the fact that parameters in $b(p)$ doesn’t affect the calculation of $\lambda$ directly, namely it doesn’t show up in the adjoint equation? But there is also the possibility that I did something wrong in coding.

Any body have any similar experience? Thanks!

I have this very simple ODE-contrained optimization problem:

  1. $h(x,x',p,t) = x'-A(p)x-b(p) = 0$, the constraint
  2. $g(x(0)) = x_0$, the initial condition with no parameters involved
  3. $F = \int (X-X_{obs})^2 dt$, the objective equation

According to adjoint method, I need to

  1. Integrate constraint equation: $$x'=A(p)x+b(p)$$

  2. Integrate adjoint equation and reverse $\lambda$ in $t$: $$\lambda'= A(p)^T \lambda-(X-X_{obs})$$

  3. Calculate $\frac{dF}{dp}$: $$\frac{dF}{dp} = \int \lambda^T \frac{\partial h}{\partial p} dt,$$ since $$\frac{\partial f}{\partial p} = \frac{\partial g}{\partial p}=0$$

But for parameters only show up in $\mathbf{b(p)}$ term, derivatives from adjoint method is inconsistent with derivatives estimated using $\frac{\partial F}{\partial p}$ directly while derivatives for other parameters seem OK.

I’m thinking that this inconsistency maybe due to the fact that parameters in $b(p)$ doesn’t affect the calculation of $\lambda$ directly, namely it doesn’t show up in the adjoint equation? But there is also the possibility that I did something wrong in coding.

Any body have any similar experience? Thanks!

LaTeXify equations
Source Link
Nick Alger
  • 3.2k
  • 16
  • 25

I have this very simple ODE-contrained optimization problem:

  1. h(x,x',p,t) = x'-A(p)x-b(p) = 0$h(x,x',p,t) = x'-A(p)x-b(p) = 0$, the constraint
  2. g(x(0)) = x0$g(x(0)) = x_0$, the initial condition with no parameters involved
  3. F = ∫(X-Xobs)^2 dt$F = \int (X-X_{obs})^2 dt$, the objective equation

According to adjoint method, I need to

  1. Integrate constraint equation: x'=A(p)x+b(p) $$x'=A(p)x+b(p)$$

  2. Integrate adjoint equation and reverse λ$\lambda$ in t$t$: λ'= transpose[A(p)]-(X-Xobs) $$\lambda'= A(p)^T-(X-X_{obs})$$

  3. Calculate dF/dp$\frac{dF}{dp}$: dF/dp = ∫trnaspose(λ) ∂h/∂p dt, since ∂f/∂p=∂g/∂p=0 $$\frac{dF}{dp} = \int \lambda^T \frac{\partial h}{\partial p} dt,$$ since $$\frac{\partial f}{\partial p} = \frac{\partial g}{\partial p}=0$$

But for parameters only show up in b(p)$\mathbf{b(p)}$ term, derivatives from adjoint method is inconsistent with derivatives estimated using ∂F/∂p$\frac{\partial F}{\partial p}$ directly while derivatives for other parameters seem OK. I’m

I’m thinking that this inconsistency maybe due to the fact that parameters in b(p)$b(p)$ doesn’t affect the calculation of λ$\lambda$ directly, namely it doesn’t show up in the adjoint equation? But there is also the possibility that I did something wrong in coding.

Any body have any similar experience? Thanks!

I have this very simple ODE-contrained optimization problem:

  1. h(x,x',p,t) = x'-A(p)x-b(p) = 0, the constraint
  2. g(x(0)) = x0, the initial condition with no parameters involved
  3. F = ∫(X-Xobs)^2 dt, the objective equation

According to adjoint method, I need to

  1. Integrate constraint equation: x'=A(p)x+b(p)

  2. Integrate adjoint equation and reverse λ in t: λ'= transpose[A(p)]-(X-Xobs)

  3. Calculate dF/dp: dF/dp = ∫trnaspose(λ) ∂h/∂p dt, since ∂f/∂p=∂g/∂p=0

But for parameters only show up in b(p) term, derivatives from adjoint method is inconsistent with derivatives estimated using ∂F/∂p directly while derivatives for other parameters seem OK. I’m thinking that this inconsistency maybe due to the fact that parameters in b(p) doesn’t affect the calculation of λ directly, namely it doesn’t show up in the adjoint equation? But there is also the possibility that I did something wrong in coding.

Any body have any similar experience? Thanks!

I have this very simple ODE-contrained optimization problem:

  1. $h(x,x',p,t) = x'-A(p)x-b(p) = 0$, the constraint
  2. $g(x(0)) = x_0$, the initial condition with no parameters involved
  3. $F = \int (X-X_{obs})^2 dt$, the objective equation

According to adjoint method, I need to

  1. Integrate constraint equation: $$x'=A(p)x+b(p)$$

  2. Integrate adjoint equation and reverse $\lambda$ in $t$: $$\lambda'= A(p)^T-(X-X_{obs})$$

  3. Calculate $\frac{dF}{dp}$: $$\frac{dF}{dp} = \int \lambda^T \frac{\partial h}{\partial p} dt,$$ since $$\frac{\partial f}{\partial p} = \frac{\partial g}{\partial p}=0$$

But for parameters only show up in $\mathbf{b(p)}$ term, derivatives from adjoint method is inconsistent with derivatives estimated using $\frac{\partial F}{\partial p}$ directly while derivatives for other parameters seem OK.

I’m thinking that this inconsistency maybe due to the fact that parameters in $b(p)$ doesn’t affect the calculation of $\lambda$ directly, namely it doesn’t show up in the adjoint equation? But there is also the possibility that I did something wrong in coding.

Any body have any similar experience? Thanks!

Source Link

Inaccurate Derivatives from Adjoint method for ODE-constrained problem

I have this very simple ODE-contrained optimization problem:

  1. h(x,x',p,t) = x'-A(p)x-b(p) = 0, the constraint
  2. g(x(0)) = x0, the initial condition with no parameters involved
  3. F = ∫(X-Xobs)^2 dt, the objective equation

According to adjoint method, I need to

  1. Integrate constraint equation: x'=A(p)x+b(p)

  2. Integrate adjoint equation and reverse λ in t: λ'= transpose[A(p)]-(X-Xobs)

  3. Calculate dF/dp: dF/dp = ∫trnaspose(λ) ∂h/∂p dt, since ∂f/∂p=∂g/∂p=0

But for parameters only show up in b(p) term, derivatives from adjoint method is inconsistent with derivatives estimated using ∂F/∂p directly while derivatives for other parameters seem OK. I’m thinking that this inconsistency maybe due to the fact that parameters in b(p) doesn’t affect the calculation of λ directly, namely it doesn’t show up in the adjoint equation? But there is also the possibility that I did something wrong in coding.

Any body have any similar experience? Thanks!