Interior Point Algorithm (fmincon)- Solver stopped prematurely
Afficher commentaires plus anciens
Hello,
I am trying to run an interior point algorithm using fmincon to minimize a quadratic function with some linear and a non linear constraints. My optimization always gets:
" Solver stopped prematurely.
fmincon stopped because it exceeded the function evaluation limit, options.MaxFunEvals = 3000 (the default value). "
Even changing this value to much larger than the default, I still hit the limit, and the algorithm takes a lot longer to run than it should... The most worrying is that even at the end, the vector to be optimized breaches the bounds contraint... I would be extremely grateful for any help reguarding this problem.
The code is as follows:
Aeq=ones(1,300);
beq=1;
lb=0;
ub=.045;
xo=zeros(300,1); %starting point for optimizer.
for i = 1:50
xo(i)=1/50;
end
b=zeros(10,1)+0.2;
A=zeros(10,300);
for i=1:10
for j=1:300
if ICBs(kept(j))==i
A(i,j)=1;
end
end
end
%where kept is a vector of 1's and 0's.
hess=@(x, lambda)Hessian(300);
options = optimset('Algorithm','interior-point','GradObj','on','GradConstr','on','Hessian','user-supplied','HessFcn', hess,'ScaleProblem','obj-and-constr','Display','Iter');
options.TolFun=10^(-12);
options.TolCon=10^(-8);
options.MaxIter = 10^(12);
covarianceMatrix=covarianceMatrix*10^4; %precalculated
myfun=@(x)MinThis(x,covarianceMatrix);
myH=@(x)Hfun(x);
w=fmincon(myfun,xo, A,b,Aeq,beq, lb, ub, myH, options);
With the following functions:
function [ineq, eq, gradl, gradnl] = Hfun (x)
ineq=[];
eq=x'*x-(1/50);
gradl= [];
gradnl=2*x;
function [Hess] = Hessian(ma, ~)
Hess=2*eye(length(ma),length(ma));
function [vol grad] = MinThis(x, Cov)
grad=2*Cov*x;
vol=x'*Cov*x;
Réponses (0)
Catégories
En savoir plus sur Systems of Nonlinear Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!