Skip to content

Add reduced Hessian operator and Newton driver#68

Open
krystophny wants to merge 40 commits into
developfrom
ad-31-reduced-hessian
Open

Add reduced Hessian operator and Newton driver#68
krystophny wants to merge 40 commits into
developfrom
ad-31-reduced-hessian

Conversation

@krystophny

Copy link
Copy Markdown
Member

Adds the exact reduced boundary Hessian and a second-order optimizer driver.

  • BoundarySensitivityProblem.reduced_hessian_vector_product: Schur complement H_BB - H_BI H_II^-1 H_IB assembled from exact Enzyme HVPs (two full-space residual JVPs plus one preconditioned interior GMRES solve per matvec). Exact reduced Hessian of the equilibrium-constrained energy at a force-balance equilibrium; the docstring states the validity limit away from one.
  • GvecEnergyProblem.hessian_vector_product(x, v): solves the equilibrium at x and applies the reduced Hessian there, with the same failed-solve penalty contract as value and gradient.
  • optimize_energy_newton: bounded trust-constr Newton using analytic value, adjoint gradient, and reduced-Hessian hessp; no finite differences anywhere in the chain on Enzyme builds.

Closes no new issue; extends #23/#24 machinery to second order.

Verification

Before

No reduced Hessian existed; second-order optimizers had to build hessp by finite differences of the adjoint gradient (one extra equilibrium solve per Hessian column or matvec).

After

Enzyme-on isolated build (fixed RZ, LLVM/Flang 22.1.6):

$ pytest test-CI/unit-pygvec/test_ad_simsopt.py -q --require-pygvec
11 passed in 2.90s

test_reduced_hessian_symmetric_and_matches_gradient_fd checks <u, H v> = <v, H u> at rtol=1e-6 and the reduced HVP against a centered difference of the adjoint boundary gradient with full equilibrium re-solves (cosine > 0.99, rtol=5e-2, limited by the interior solve floor). test_newton_optimizer_reduces_energy runs the bounded trust-region Newton end to end.

Enzyme-off isolated build (FD fallback path):

$ pytest test-CI/unit-pygvec/test_ad_simsopt.py test-CI/unit-pygvec/test_ad_boundary.py -q --require-pygvec
13 passed, 4 skipped in 30.96s

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