Skip to content

changed: hessian=true by default for MovingHorizonEstimator - #537

Merged
franckgaga merged 8 commits into
mainfrom
hessian_mhe
Dec 1, 2026
Merged

franckgaga merged 8 commits into
mainfrom
hessian_mhe

Conversation

@franckgaga

@franckgaga franckgaga commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Warning

This is a breaking change, the (exact) Hessian of the Lagrangian is now computed by default for MovingHorizonEstimator, instead of relying on the internal quasi-newton method of the optimizer.

In most of my tests (variations on the pendulum and variations on the pH reactor), the quasi-newton method of Ipopt/Uno/MadNLP never converged for the MovingHorizonEstimator. An exact Hessian was always needed. I am now confident that hessian=true is a better default for the MHE. Otherwise, It can be easily reverted by specifying hessian=false.

On reason for this is the arrival estimation covariance $\mathbf{\bar{P}}$, when it's approximated by an UKF or EKF. The inverse of this (dense) matrix will appear in the Hessian of the objective function, making it more difficult to replicate with a quasi-Newton approximation like L-BFGS.

@codecov-commenter

codecov-commenter commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.06%. Comparing base (47742c8) to head (f1c5deb).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #537   +/-   ##
=======================================
  Coverage   99.06%   99.06%           
=======================================
  Files          30       30           
  Lines        8446     8446           
=======================================
  Hits         8367     8367           
  Misses         79       79           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@franckgaga

franckgaga commented Dec 1, 2026 •

Copy link
Copy Markdown
Member Author

Okay CI is drastically slower because of this breaking change. I will add some hessian=false on all tests that the Hessian option is not already specified. These cases are mainly hessian=true, so test suit will cover both hessian=false and hessian=true options.

The goal is to accelerate CI. In almost all the cases the model are in face linear under-the-hood, thus the Hessians are all 0. This is a waste to always compute them with sparse `ForwardDiff.jl`, mainly for the preparation step.
@franckgaga
franckgaga merged commit 02d4573 into main Dec 1, 2026
10 checks passed
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.

2 participants