How can i fix this errors while performing Optimization using fmincon.
Show older comments
Warning: Length of lower bounds is < length(x); filling in missing lower bounds with -Inf. > In checkbounds (line 33) In fmincon (line 306) In companies1 (line 27) Warning: Length of upper bounds is < length(x); filling in missing upper bounds with +Inf. > In checkbounds (line 47) In fmincon (line 306) In companies1 (line 27) Attempt to execute SCRIPT companies1 as a function: C:\Users\shahn\Desktop\companies1.m
Error in optimfcnchk/checkfun (line 315)
f = userfcn(x,varargin{:});
Error in fmincon (line 534)
initVals.f = feval(funfcn{3},X,varargin{:});
Error in companies1 (line 27) [x,fval,exitflag,output]=fmincon(@companies1,x0,A,B,Aeq,beq,lb,ub,[],options);
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON cannot continue.
Accepted Answer
More Answers (5)
NIKET shah
on 19 Apr 2018
0 votes
NIKET shah
on 19 Apr 2018
0 votes
NIKET shah
on 20 Apr 2018
0 votes
1 Comment
Walter Roberson
on 20 Apr 2018
Are you trying to constrain the first 3 out of 72 input variables? Or are you trying to work with what is really a 24 x 3 array and you want to constrain each of the rows of that to sum to 1?
NIKET shah
on 20 Apr 2018
0 votes
NIKET shah
on 20 Apr 2018
0 votes
3 Comments
Walter Roberson
on 20 Apr 2018
https://www.mathworks.com/help/optim/ug/quadprog.html
NIKET shah
on 20 Apr 2018
Walter Roberson
on 20 Apr 2018
Your objective appears to me at the moment to fit within what can be done with quadprog. If I I am correct about that then you should switch to that instead, as the algorithms involved know how to divide everything up into subproblems that can each be solved exactly, and then the best is taken, leading to a global minimization.
If I have instead misread your objective (it is after 4am here), or if you choose to use fmincon even if quadprog would work, then the best you can get is a local minima.
Categories
Find more on Surrogate 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!