Skip to content

Set test for when to update a ReducedFunctionalMat - #281

Draft
JHopeCollins wants to merge 3 commits into
mainfrom
JHopeCollins/tao_mat_update_schedule
Draft

JHopeCollins wants to merge 3 commits into
mainfrom
JHopeCollins/tao_mat_update_schedule

Conversation

@JHopeCollins

Copy link
Copy Markdown
Contributor

For the ReducedFunctionalMat actions to be correct the ReducedFunctional must have been last evaluated at the correct state. To ensure this, the update method passed as a callback to TAO evaluated the forward and derivative of the ReducedFunctional.

However, for a standard Newton solver the Hessian matrix uses the same ReducedFunctional as the outer solver, so with no linesearch or a simple backtracking search (armijo) the last re-evaluation and gradient calculation before the Hessian solve is at the correct state so there is no need for the matrix to duplicate these calculations.

This PR adds a PETSc option to tell the Mat when to update it's own ReducedFunctional:

  • -mat_rf_update_schedule always: update every time (the current behaviour and the default).
  • -mat_rf_update_schedule never: never update, assume the RF is always at the correct state.
  • -mat_rf_update_schedule when_changed: the Mat will calculate the difference of the ReducedFunctional's current state and the new state passed by TAO, and will only update if they are different. The threshold for updating can be specified with -mat_rf_update_eps eps

@JHopeCollins JHopeCollins self-assigned this Oct 22, 2026
Comment thread pyadjoint/optimization/tao_solver.py Resolved

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant