Turn off final Hessian calculation with fminunc or fmincon?

1 view (last 30 days)
I'm using these functions to minimize a problem, with the default algorithm choice for no user-supplied Hessian. For these algorithms, fminunc/fmincon calculate the numerical Hessian at the solution (for other algorithms, it reports the next-to-last-iterate Hessian).
I would like to turn off the calculation of this final Hessian shorten runtime. It is not useful at this particular point in the code. Is it possible to do this?

Accepted Answer

Alan Weiss
Alan Weiss on 31 Jul 2014
fmincon and fminunc calculate a Hessian approximation internally in order to solve problems. fmincon does not do any extra calculations to output the Hessian, so there is nothing to do to save time. In any case, the fmincon output Hessian is not very accurate, so there is no reason to ask for it.
However, fminunc can spend extra time computing a finite difference Hessian at the end of its run. So, to save a bit of time, do not ask for a Hessian in the output, and fminunc will not take the time to evaluate one.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
ruobing han
ruobing han on 29 Sep 2022
Hey Alan, what I do not understand is Matlab stop using parallel processing for Hessian calculation at the end, while it parallel very well in iteration during fminunc

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!