MATLAB Answers

Error using barrier Objective function is undefined at initial point. Fmincon cannot continue.

12 views (last 30 days)
Dennis
Dennis on 22 Sep 2020 at 14:15
Answered: Steven Lord on 22 Sep 2020 at 15:49
Hi! I'm new to Matlab and run into this problem:
When I try to run the code I received I receive following error message for computePortfolio.m:
Error using barrier
Objective function is undefined at initial point. Fmincon cannot continue.
Error in fmincon (line 848)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] =
barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...
Error in computePortfolio (line 44)
fmincon(@fun, parameters.start, A, B, Aeq, Beq, parameters.lowerbound, parameters.upperbound,
[], options);
I don't quite understand why I would get an error message for an internal function (fmincon). Help will be greatly appreciated!

  0 Comments

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 22 Sep 2020 at 15:49
What values do you receive when you evaluate your objective function fun at the initial values in the start field of the parameters struct array? If any of the values in that output are NaN you need to determine why those NaN values are being computed.
It is not possible for us to help you determine why the NaN values are being computed without seeing the body of the fun function, which you have not provided.

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by