admb-project / admb

AD Model Builder
http://admb-project.org
Other
64 stars 19 forks source link

Go to FINAL_SECTION even when Hessian is not positive definite #164

Closed iantaylor-NOAA closed 3 years ago

iantaylor-NOAA commented 3 years ago

ADMB doesn't enter the FINAL_SECTION when the Hessian is not positive definite.

I confirmed this by adding the following to the end of catage.tpl

FINAL_SECTION
  cout << "In FINAL_SECTION" << endl;

which causes the run to end with

Estimating row 38 out of 38 for hessian
In FINAL_SECTION

but running with -maxfn 0 ends with

Estimating row 38 out of 38 for hessian
Warning -- Hessian does not appear to be positive definite
Hessian does not appear to be positive definite

The FINAL_SECTION (which isn't well described in the ADMB manual) is a convenient place to write output that depends on the result of the Hessian inversion (as discussed in #132), but it would be nice to get any output that doesn't depend on the Hessian in cases where the Hessian has failed to invert. Would it be possible to go to the FINAL_SECTION even when the Hessian fails?

johnoel commented 3 years ago

Okay, try the changes in issue164 branch. The main change is to return from the ::computations1 function instead of exiting. The FINAL_SECTION code will then be called.

k-doering-NOAA commented 3 years ago

Thanks @johnoel! I tested the changes in the issue164 branch with Stock Synthesis and It worked well! Even though I saw the message

Warning -- Hessian does not appear to be positive definite
Hessian does not appear to be positive definite

The FINAL_SECTION code proceeded to run after.