How do I include a user specified hessian function for fmincon?
23 views (last 30 days)
I am working on an optimisation code and I have a Hessian function I wish fmincon to use. I'm currently having trouble trying to get the correct command to include the Hessian. I am currently using:
options = optimoptions('fmincon','SpecifyObjectiveGradient',true,'HessFcn','objective','Display','iter','OutputFcn',@outfun);
For which I get the following error:
> In Temperature_inverse_problem (line 51)
Error using feval
Undefined function or variable 'objective'.
Error in computeHessian
Error in barrier
Error in fmincon (line 813)
Error in Temperature_inverse_problem (line 53)
The code for my objective function is:
function [Y,G,H] = Boundary_temperature(T_data,t,R,X,Joule)
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
Here Y is the objective function, G is the gradient and H is the Hessian. I've trolled the internet and I've not found anything which works. What am I doing wrong?
Alan Weiss on 24 Apr 2020
If you read the documentation for Including Gradients and Hessians, you will see that the fmincon 'interior-point' algorithm does not allow you to use 'HessFcn'='objective'. Instead, you must write a Hessian function that is the Hessian of the Lagrangian. See Hessian for fmincon interior-point algorithm.
MATLAB mathematical toolbox documentation