Closed cvhammond closed 2 years ago
@CVHammond I believe you are right. Matlab documentation is not crystal clear about this. In any case, this is a quick test I created. There is a difference at the level of numerical tolerance between 'bfgs' and 'lbfgs' when 'sqp' is used.
BTW, I could not get 'HessianFcn' to work. Instead, I used 'Hessian'.
function test_sqp fun = @(x)100*(x(2)-x(1)^2)^2 + (1-x(1))^2; A = []; b = []; Aeq = []; beq = []; lb = []; ub = []; nonlcon = @unitdisk; x0 = [0,0]; options = optimoptions('fmincon','Display','iter','Algorithm','sqp','Hessian','lbfgs'); %,'HessianFcn','lbfgs'
[x,fval,exitflag,output,lambda,grad,hessian] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options); keyboard
function [c,ceq] = unitdisk(x) c = x(1)^2 + x(2)^2 - 1; ceq = [];
When attempting to translate the optimizer options from the legacy code, I noticed that the optimizer algorithm is set to 'sqp' and the HessianFnc is set to 'lbfgs'. If you look at MATLAB's documentation for fmincon, the HessianFnc is only useful for the 'interior-point' algorithm. As a result, the 'lbfgs' HessianFnc will do nothing. Is this intentional?
My recommendation would be to leave out the HessianFnc argument and keep it in mind if the new implementation diverges dramatically from the legacy code.