Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Objective function is undefined at initial point. Fmincon cannot continue.

4,980 views
Skip to first unread message

joseph Frank

unread,
Aug 28, 2010, 2:16:04 PM8/28/10
to
I am receiving the following error:

??? Error using ==> barrier at 14
Objective function is undefined at initial point. Fmincon cannot continue.

what could be the reason?

Matt J

unread,
Aug 28, 2010, 4:36:03 PM8/28/10
to
"joseph Frank" <josephf...@hotmail.com> wrote in message <i5bjp4$emm$1...@fred.mathworks.com>...

Well....? Is it true?

Marcelo Marazzi

unread,
Aug 30, 2010, 1:00:52 PM8/30/10
to
Joseph,

Your call to fmincon probably looks something like

fmincon(obj,x0, ...)

The error message indicates that your objective function "obj" either
errors, or returns and invalid value such as Inf, NaN or a complex
number when evaluated at the point x0.

You may want to evaluate your function at x0 before calling fmincon to
see if it's well defined: something like

>> obj(x0)

-Marcelo

joseph Frank

unread,
Sep 8, 2010, 10:27:09 AM9/8/10
to
I have revised all my codes and I am still receiving the same error:

??? Error using ==> barrier at 14
Objective function is undefined at initial point. Fmincon cannot continue.

Error in ==> fmincon at 797
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] =
barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options_ip.HessFcn, ...

Error in ==> Step4base at 6
x
=fmincon(@(x)fGlobal(x,Data),StartingNSb,[],[],[],[],[],[],@(x)myconstr(x,EGAM),options);

Although I checked the two functions fglobal and myconstr by running fglobal(StartingNSb,Data) which results 0.2438 + 0.0000i and by running mtconstr(StartingNSb,EGAM) which is returning [] without any error.
Kindly advise.

Matt J

unread,
Sep 8, 2010, 11:30:21 AM9/8/10
to
"joseph Frank" <josephf...@hotmail.com> wrote in message <i686ft$hm8$1...@fred.mathworks.com>...

> Error in ==> Step4base at 6
> x
> =fmincon(@(x)fGlobal(x,Data),StartingNSb,[],[],[],[],[],[],@(x)myconstr(x,EGAM),options);
>
> Although I checked the two functions fglobal and myconstr by running fglobal(StartingNSb,Data) which results 0.2438 + 0.0000i and by running mtconstr(StartingNSb,EGAM) which is returning [] without any error.
> Kindly advise.

=============

Your function fglobal is returning a complex-valued result. The imaginary value is obviously small, but is not zero, even if it looks that way when displayed to 4 decimal places . If this imaginary part is purely due to round-off errors, use real() to strip it away.

joseph Frank

unread,
Sep 8, 2010, 11:57:08 AM9/8/10
to
"Matt J " <mattja...@THISieee.spam> wrote in message <i68a6d$pq1$1...@fred.mathworks.com>...

Thanks Matt. It is working now.

0 new messages