1

I'm trying to solve a problem with sensibilities using ida with assimulo. solving the problem without sensibilities works fine but now i want to do it with sensibilities in finaltime, initial values and controls(parameters that are used in my equations).

I only found one example on the assimulo page (this is only with initial sensitivities), and i don't understand it properly.

can someone help me and explain how the different sensitivities need to be implemented?

thanks a lot

Seki
  • 11,135
  • 7
  • 46
  • 70
Annah
  • 41
  • 1
  • 2

1 Answers1

0

I used CVode solver followed the example on discontinuities (https://jmodelica.org/assimulo/_modules/assimulo/examples/cvode_with_disc.html#run_example), meaning that I subclassed the 'Explicit_Problem' class.

For integration of my ode system (that has discontinuities), I did override the method 'rhs', which encodes my ode system. More specifically, I used the following signature: def rhs(self, t, y, sw).

Then, to also get the parametric sensitivities, I just modified the signature like this def rhs(self, t, y, sw, p), note the additional argument p! I needed also to assign p0 with the parameter values, as seen for the initial values assignment y0 in the example. It was just as easy as that.

Be aware that also calculating the parametric sensitivities may need considerably more computation time (I found 5 to 10 times more, but my ode systems are typically not that big).

Unfortunately, the sensitivities are calculated using finite differences (forward or central). To my understanding, the SUNDIALS solvers are able to do state-of-the-art algorithmic differentation to get the sensitivity equations for solving them along with the original ode. Would love to see this in next releases :-)

kossikater
  • 41
  • 5