MATLAB Answers

0

How can I choose the parameter of fmincon to avoid "Solver stopped prematurely."?

Asked by guoyu ding on 18 May 2018 at 8:34
Latest activity Commented on by guoyu ding on 18 May 2018 at 13:25

The Following code:

funct=@(X,a,c,sigb,sigs,u) (1-a)*exp(-sigb)*exp(-sigs)*(sigb.^X(:,1)./factorial(X(:,1))).*(sigs.^X(:,2)./factorial(X(:,2)))+a*c*exp(-sigb)*exp(-u-sigs)*(sigb.^X(:,1)./factorial(X(:,1))).*((u+sigs).^X(:,2)./factorial(X(:,2)))+ a*(1-c)*exp(-u-sigb)*exp(-sigs)*((u+sigb).^X(:,1)./factorial(X(:,1))).*(sigs.^X(:,2)./factorial(X(:,2)));  
fun=@(par) -prod(funct([B1 S1],par(1),par(2),par(3),par(4),par(5))); 
options=optimset('fmincon');
options=optimset(options,'GradConstr','on','MaxFunEvals',6000,'MaxIter',6000,'algorithm','active-set');
[parhat,fval] = fmincon(fun,[0.1,0.1,10^7,10^7,10^7],[],[],[],[],[0,0,0,0,0],[1,1,10^9,10^9,10^9],[],options)

However, The error occurs,

Solver stopped prematurely. fmincon stopped because it exceeded the function evaluation limit,options.MaxFunEvals = 6000 (the selected value). I could not find the result.Is any errors in my code?

  2 Comments

Did you think about your vector of initial guesses for the solution variables ? E.g. Setting sigb = 10^7 and sigs = 10^7 makes "fmincon" evaluate exp(-10^7) !!!!!

I try to decrease the sigb/sigs from 10^7 to 10. However, Solver still stopped prematurely. It shown that it exceeded the function evaluation limit. At end,I uploaded the data.

Sign in to comment.

0 Answers

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today