Adjoint sensitivity analysis of ODE - get value of cost functional

Dear all,

This question is related to the DifferentialEquations.jl package.

I’ve used the very helpful documentation here to implement adjoint sensitivity analysis on an ODE. Specifically, i have a cost function of the form
C(\theta) = \int^T_0 L[x(t)] \ dt ,
where x(t) is the state of my ODE over time. Calling the function adjoint_sensitivities gives me \nabla C(\theta, the gradient of the cost in the parameters.

Is there some callback I can use that allows me to get the actual cost function C(\theta) itself? Currently I have to have a separate routine for getting the cost, and getting the cost gradient

Thanks