How to supply Hessian for interior-point in fmincon in the objective function and not a separate function

1 view (last 30 days)
Hi,
I have a problem that includes some basic calculations that are actually very complex and they are needed in calculations of objective function, gradient and Hessian. The first two (objective and gradient) can be described in one function but for the third one although all my constraints are linear equalities or inequalities (so I don't need lmbda in Hessian calculation) there is no way to include Hessian function in objective function related MATLAB function.
So, I am wondering if there is a way to save those calculation time by some means and I don't need to recalculate those complex stuff for Hessian again, as they are already calulated in objective function even if there is a way to have some other outputs from objective function it would be good.
Thanks in advance.

Answers (1)

Torsten
Torsten on 29 Feb 2024
I didn't think until the end, but maybe this procedure also helps in your case:
  1 Comment
Matt J
Matt J on 29 Feb 2024
Yes, you need to nest the objective function and the HessianMultiplyFcn within a parent function. This will allow them to share variables through the parent.

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!