MATLAB: Failure in initial user-supplied objective function evaluation. FMINCON cannot continue.

fminconOptimization Toolbox

I 'll be working on the nonlinear program with fmincon as follows:
>> load('JIRIOT_base.mat')
>> options = optimoptions('fmincon',
'Display','iter','Algorithm','interior-point');
>> [x,fval,exitflag,output,lambda] =
fmincon(@(x)mindistance(x,xo),xo,A,b,Aeq,beq,lb,[],[],options)
Then, error messages occurred as follows:
error: barrier (line 22)
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON cannot continue.
error:fmincon (line 905)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq, l,u,confcn,options.HessFcn, ...
my objective function code is as follows:
>>function y = mindistance(x,xo) % objective function
>>y = sum(abs(xo(1:14386,1)).*(x(1:14386,1)./xo(1:14386,1)).*(log(x(1:14386,1)./xo(1:14386,1))-1)+1);
I guess there are many zeros in 'JIRIOT_base.mat'file. I attached the matfile, so please tell me how to solve my program.

Best Answer

The purpose of the xo argument in fmincon(fun,xo,...) is that it, in Mathworks' words, "starts at xo and attempts to find a minimum x". In view of this it makes no sense to also include xo as an argument in the objective function, 'fun', itself as you have done here. It should be exclusively an estimate of where 'fmincon' should start in its iterations to a final minimum value and should not appear in the objection function.