Error using barrier Objective function is undefined at initial point. Fmincon cannot continue.
7 views (last 30 days)
Show older comments
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
Answers (1)
Steven Lord
on 22 Sep 2020
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
See Also
Categories
Find more on Nonlinear Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!