MATLAB Answers

a problem with setting fmincon options?

3 views (last 30 days)
Abdelrahman Taha
Abdelrahman Taha on 16 Jan 2020
Edited: Matt J on 16 Jan 2020
I am doing optimization using fmincon, and while trying to set the objective limit to (1) using this command:
options = optimoptions('fmincon','ObjectiveLimit',1.0);
i get this error:
Error using optimfcnchk (line 99)
NONLCON must be a function.
Error in fmincon (line 427)
confcn = optimfcnchk(NONLCON,'fmincon',length(varargin),funValCheck,flags.gradconst,false,true);
So, what could be casuing this problem? given that the function is working properly without setting that limit and the error is certainly caued by this above posted command.

  1 Comment

Matt J
Matt J on 16 Jan 2020
and the error is certainly caued by this above posted command.
No, not necessarily.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 16 Jan 2020
Edited: Matt J on 16 Jan 2020
I would guess that you entered your options object as the 9th input argument to fmincon when it really should be the 10th. If you have no nonlinear constraints, it should look like,
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,[],options)

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags