On Apr 13, 3:08 pm, "Matt J " <mattjacREM...@THISieee.spam> wrote:
> DOD <dco...@gmail.com> wrote in message <c3d4297ab9d64819befff974bb7a4...@a26g2000vbo.googlegroups.com>...
>
> My problem is that when I run this code, I get the> following error
>
> =======================
>
> You mean "warning".
>
> > IE, for some reason fmincon is leaving the Trustregionreflective
> > algorithm
>
> ============================
>
> because trustregion only supports
> xor(bound constraints, linear equality constraints)
> as mentioned in the FMINCON doc page.
>
> > and going to active set, which does not make use of my
> > analytical gradient.
>
> ====================
>
> Active set will not ignore your analytical gradient.
> It simply doesn't require you to supply it (unlike trustregion)
>
> http://www.mathworks.com/help/toolbox/optim/ug/brhkghv3.html#bsj1e55
>
> However, you might try using interiorpoint as the warning message suggests to see if performance improves.
I'm not sure I understand; I am not supplying any linear equality
constraints  those matrices are empty. I am using upper and lower
bounds and nonlinear constraints. Is the problem therefore the very
use of a nonlinear constraint? IE the trustregion method will not
work in my case in any event?
As for your advice to try interior point, I am again having some
trouble that I think stems from the use of parameters. Here is my
code:

function [out fval]
=nested_ramsey_minimization(b,g,lambda,gamma,rho,kavg,beta,delta,firm_alpha,initial_guess)
options = optimset('Algorithm','interiorpoint', ...
'GradObj','on','GradConstr','on', ...
'Hessian','usersupplied','HessFcn',@hessianfn);
A=[];
littleb=[];
Aeq=[];
littlebeq=[];
%[out fval] =
fmincon(@ramsey_obj,initial_guess,A,littleb,Aeq,littlebeq,[0 0 0],[1 1
1],@nonlin,options);
[out fval] = fmincon(@ramsey_obj,initial_guess,A,littleb,Aeq,littlebeq,
[],[],@nonlin,options);
function [obj_value obj_gradient] = ramsey_obj(x)
[obj_value obj_gradient] =
ramsey_direct_minimization(x,lambda,gamma,rho,kavg,beta);
end
function [cineq ceq gradc gradceq] = nonlin(x)
[cineq ceq gradc gradceq] =
ramsey_direct_constraints(x,b,g,lambda,gamma,rho,kavg,firm_alpha,delta,beta);
end
% Seperate subfunction for hessian when using interior point
function out = hessianfn(x)
out = ramsey_hessian(x,lambda,gamma,rho,kavg);
end
end

What is different from before: the objective function @ramsey_obj now
only supplies the scalar objective and the vector of gradients. The
hessian is supplied by a separate function @hessianfn. This new
function is again defined as a subfunction so that it is only a
function of x, since the parameters required by ramsey_hessian have
been passed to nested_ramsey_minimization.
When I run this code I receive the following error:

??? Error using ==> nested_ramsey_minimization>hessianfn
Too many input arguments.

I don't understand the problem; the only input to hessianfn is x,
which is a 3vector, and in the code for ramsey_hessian, only x(1)
through x(3) are used. So I don't know what this error is really
telling me.
Thanks very much for your help!
