P-norm over time
Sometimes it is desirable to obtain an approximation of a max function over time. An example is using the p-norm:
(\sum_{i=0}^{timesteps} (f_i)^p)^(1/p)
I want to calculate the gradient of this function using dolfin-adjoint. "f" would be an integral over the domain. The gradient would be the same that the p=1 case, which dolfin-adjoint supports, except for a contribution for each time step. Before adding the gradient contributions over time, they should be scaled by a p-norm contribution:
\sum_{i=0}^{timesteps} (f_i)^(p-1)*gradf_i
and then the final result gradf, with another scaling
(\sum_{i=0}^{timesteps} (f_i)^p)^(1/p - 1) * gradf.
Is this possible in dolfin-adjoint at all? If not, before digging into the code, would it involve a lot of modifications?
Thanks
Comments (3)
-
-
reporter This does not work because adding two
pyadjoint.adjfloat.AdjFloat
(output of assemble() over an integral) results in afloat
and pyadjoint cannot process it. I created an issue in the pyadjoint repository here. Also wanted to ask about what's going to happen with dolfin-adjoint. Will it become superseded by pyadjoint in the near future? Is it updated anymore? -
I created an issue in the pyadjoint repository here.
Great! I saw that Sebastian is already working in it.
Will it become superseded by pyadjoint in the near future? Is it updated anymore?
The goal is to replace the current dolfin-adjoint with the pyadjoint within the next year. Until then I will maintain and release dolfin-adjoint as usual.
- Log in to comment
Hi Miguel,
As you said, dolfin-adjoint currently does not support p-norm functionals. However, we are working on a new-generation of dolfin-adjoint (https://bitbucket.org/dolfin-adjoint/pyadjoint) which has support for general functionals, including the p-Norm. With the new dolfin-adjoint, you should be able to write something like:
If your underlying PDE model is not too advanced, then trying out new-dolfin adjoint might be a good way forward. The code is still under heavy development, but both me and @sebastkm are happy to help you out.