Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structure-exploiting adjoint sensitivities in Integrator #3047

Closed
jaeandersson opened this issue Mar 22, 2023 · 1 comment
Closed

Structure-exploiting adjoint sensitivities in Integrator #3047

jaeandersson opened this issue Mar 22, 2023 · 1 comment
Assignees
Milestone

Comments

@jaeandersson
Copy link
Member

The Integrator class is now exploiting forward sensitivity structure throughout thanks to #2823. In the same way, the structure of adjoint sensitivities can be exploited. This will enable much more efficient second order derivative information to be calculated and give a more maintainable interface.

@jaeandersson jaeandersson self-assigned this Mar 22, 2023
jaeandersson added a commit that referenced this issue Mar 24, 2023
jaeandersson added a commit that referenced this issue Mar 24, 2023
Avoiding map2oracle internally
jaeandersson added a commit that referenced this issue Mar 24, 2023
Temporary addition. This option will eventually be replaced by oracle_.reverse(nadj_)
jaeandersson added a commit that referenced this issue Mar 24, 2023
To avoid additional failure modes during refactoring
jaeandersson added a commit that referenced this issue Mar 24, 2023
Before gradually removing backwards IO from oracle_
jaeandersson added a commit that referenced this issue Mar 24, 2023
jaeandersson added a commit that referenced this issue Mar 24, 2023
jaeandersson added a commit that referenced this issue Mar 24, 2023
jaeandersson added a commit that referenced this issue Mar 27, 2023
Only if nadj is set for now
jaeandersson added a commit that referenced this issue Mar 27, 2023
jaeandersson added a commit that referenced this issue Mar 27, 2023
jaeandersson added a commit that referenced this issue Mar 27, 2023
Now solved internally as forward-over-adjoint
jaeandersson added a commit that referenced this issue Mar 27, 2023
The backward problem is now always standard reverse differentiation of forward problem
jaeandersson added a commit that referenced this issue Mar 27, 2023
The backward Jacobian is now constructed from the forward problem.
The backward linear solver has yet to be removed
jaeandersson added a commit that referenced this issue Mar 27, 2023
jaeandersson added a commit that referenced this issue Mar 27, 2023
Now excludes multiple adjoint right-hand-sides.
jaeandersson added a commit that referenced this issue Mar 27, 2023
The adjoint seeds/sensitivities are now placed in different columns, not in different rows.
jaeandersson added a commit that referenced this issue Mar 27, 2023
Inputs are now ordered x0, z0, p, u, adj_xf, adj_zf, adj_qf
jaeandersson added a commit that referenced this issue Mar 27, 2023
Outputs are now ordered xf, zf, qf, adj_x0, adj_z0, adj_p, adj_u
jaeandersson added a commit that referenced this issue Mar 28, 2023
In can therefore be set to zero in jtimesB
jaeandersson added a commit that referenced this issue Mar 28, 2023
jaeandersson added a commit that referenced this issue Mar 29, 2023
No longer grows with number of adjoint sensitivities
@jaeandersson jaeandersson added this to the Version 3.6 milestone Mar 29, 2023
@jaeandersson
Copy link
Member Author

Work complete. This change removes the "backward states" from the public API. Instead, backward states are now always related to the forward DAE with the nadj option, denoting the number of adjoint derivatives. The nadj option can be combined with nadj, giving a total of nadj * nfwd forward-over-adjoint directional derivatives. Typically nadj = 1, but this may not be the case when a Jacobian is calculated using graph coloring.

Relevant user changes include:

  • Reordering and renaming of existing inputs and outputs. The names of the existing forward problem inputs and outputs (x0, z0, p, xf, zf, qf) stay the same, but the "backward states" are now matching the forward inputs/outputs with an adj_ prefix. This makes the meaning of each sensitivity input and output easier to interpret.
  • Potentially much better scaling of the integration to larger dimensions. The linear system solved in each equation now stays the same regardless of how many forward and/or adjoint sensitivity equations are included. Before it scaled linearly with nadj in the Sundials interfaces and linearly with both nadj and nfwd in the fixed-step solvers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant