P-norm over time

Issue #76 new
Miguel Salazar created an issue

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)

  1. Simon Funke

    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:

    J = [sum( assemble(f_i**p*dx)**(1/p) for f_i in range(f)]
    dJdm = compute_gradient(z, m)
    

    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.

  2. Miguel Salazar reporter

    This does not work because adding two pyadjoint.adjfloat.AdjFloat (output of assemble() over an integral) results in a float 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?

  3. Simon Funke

    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.

  4. Log in to comment