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

No more fmincon messages!

287 views
Skip to first unread message

Manalap

unread,
Feb 23, 2013, 6:13:07 AM2/23/13
to
When I execute mfile that contains fmincon, Matlab prints messages like

===============================
Warning: To use the default trust-region-reflective algorithm
you must supply the gradient in the objective function and set
the GradObj option to 'on'. FMINCON will use the active-set
algorithm instead. For information on applicable algorithms,
see Choosing the Algorithm in the documentation.


Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.

<stopping criteria details>

Active inequalities (to within options.TolCon = 1e-06):
lower upper ineqlin ineqnonlin
1
===========================================

However, I think printing these messages is slowing down the speed.

How can I stop printing these messages?

matt dash

unread,
Feb 23, 2013, 11:05:11 AM2/23/13
to
"Manalap" wrote in message <kga883$lok$1...@newscl01ah.mathworks.com>...
Read about the 'Display' property in the help file for 'optimset'.

For the initial warning you should probably just set the algorithm to active-set in the first place.

Manalap

unread,
Feb 23, 2013, 4:35:10 PM2/23/13
to
The help file reads that fmincon's option
Diagnostics: Display diagnostic information about the function to be minimized or solved. The choices are 'on' or the default, 'off'

So the default is already "off".

But I just tried

options = optimset('Diagnostics','off')

but this didn't work.

And also I tried

options=optimset('Algorithm','active-set');

but this doesn't eliminate the waning message.

Perhaps I don't know exactly how to put options?


"matt dash" wrote in message <kgapbn$5re$1...@newscl01ah.mathworks.com>...

Manalap

unread,
Feb 23, 2013, 4:57:12 PM2/23/13
to
I tried a very crude fix.

I just made a new fmincon2.m and there I deleted the part that generates the waning message.

So I now don't see that message any more.

But the "fmincon stopped because" and "fmincon completed because" still appears.

It seems the messages are stored in createExitMsg.m

And these don't disappear even if I set some options.

Manalap

unread,
Feb 23, 2013, 5:01:07 PM2/23/13
to
Perhaps I don't know how to put options.

options = optimset('Display','off');
[x,fvalx]=fmincon(func,[0.7],[],[],[],[],[0.5],[1],options);


This created error.
=====================

Error using optimfcnchk (line 286)
NONLCON must be a function.

Error in fmincon2 (line 440)
confcn =
optimfcnchk(NONLCON,'fmincon',length(varargin),funValCheck,flags.gradconst,false,true);

Error in display2 (line 58)
[x,fvalx]=fmincon2(II,[0.7],[],[],[],[],[0.5],[1],options);
>>

Manalap

unread,
Feb 23, 2013, 5:05:06 PM2/23/13
to
The output section in the help file reads like this.

There it says something about 'exit message'.

But I don't know how to eliminate it.

===================
output

Structure containing information about the optimization. The fields of the structure are: iterations

Number of iterations taken funcCount

Number of function evaluations lssteplength

Size of line search step relative to search direction (active-set algorithm only) constrviolation

Maximum of constraint functions stepsize

Length of last displacement in x (active-set and interior-point algorithms) algorithm

Optimization algorithm used cgiterations

Total number of PCG iterations (trust-region-reflective and interior-point algorithms) firstorderopt

Measure of first-order optimality message

Exit message

matt dash

unread,
Feb 23, 2013, 6:24:07 PM2/23/13
to
"Manalap" wrote in message <kgbe73$s7h$1...@newscl01ah.mathworks.com>...
You just have the wrong number of inputs to fmincon. This is all you need:

options = optimset('Display','off','Algorithm','active-set');
[x,fvalx]=fmincon(func,[0.7],[],[],[],[],[0.5],[1],[],options);

Manalap

unread,
Feb 23, 2013, 7:32:10 PM2/23/13
to
Thank you very much!!

Steven_Lord

unread,
Feb 25, 2013, 10:50:00 AM2/25/13
to


"Manalap " <mujy...@gmail.com> wrote in message
news:kga883$lok$1...@newscl01ah.mathworks.com...
> When I execute mfile that contains fmincon, Matlab prints messages like
> ===============================
> Warning: To use the default trust-region-reflective algorithm
> you must supply the gradient in the objective function and set
> the GradObj option to 'on'. FMINCON will use the active-set
> algorithm instead. For information on applicable algorithms,
> see Choosing the Algorithm in the documentation.

Did you look at that section of the documentation? It should, I believe,
tell you how to select the active-set algorithm using OPTIMSET. Doing so and
passing the resulting options structure into FMINCON will avoid this
warning.

> Optimization completed because the objective function is non-decreasing in
> feasible directions, to within the default value of the function
> tolerance,
> and constraints are satisfied to within the default value of the
> constraint tolerance.
>
> <stopping criteria details>
>
> Active inequalities (to within options.TolCon = 1e-06):
> lower upper ineqlin ineqnonlin
> 1

Set the Display option to 'off' using OPTIMSET.

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

0 new messages