Re: Need help with fmincon and fminunc



"Mahsa Moghaddas" <mahsa_moghaddas@xxxxxxxxx> wrote in message
<fjt6v7$fsg$1@xxxxxxxxxxxxxxxxxx>...
Hi!


I have the following problem:

I have a program to optimize a parameter.I started with
fmincon,and when I run the optimization program,this
message appeared at the end:

Warning: Large-scale(trust region) method does not
currently solve this type of problem,switching to medium-
scale (line search).
In fmincon at 260
In optimization at 11

The default in fmincon is to use the largescale
method, BUT it requires you to provide the
gradient vector. If you do not do so, then you
get this message telling you that the method
was switched to the medium scale method.



Optimization terminated: Magnitude of directional
derivative in search direction less than 2*options.TolFun
and maximum constraint violation is less than
options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1
I got an answer and the exitflag of 5,but I realized that
the program didn't move search in the function to find the
minimum value and selected the initial condition as the
answer,despite the fact that the objective value was
changing.

Since you do not provide the calling sequence
that you used for fmincon, I cannot tell if you
made an error in the arguments. This is a likely
explanation from the rest of what I've read of
your comments.


I have switched to fminunc instead and it seems that
optimization works there,but still there are some problems.

I have the following questions:

1.I don't have any constraint function.However,I have the
ub and lb.Is it considered as a constraint? Is it OK if I
use fminunc or should I use only fmincon?

Fminunc has no ability to use constraints.
Bounds are constraints.


2.I have edited some of the optimization
options,using "optimset".
options = optimset(('Display','iter','TolCon',1e-
8,'TolFun',1e-8,'LargeScale','off')

This command is written before the main command of
optimization:fmincon or fimnunc

Should I write the word "options" in the optimization
command?If so,why MATLAB doesn't recognize it?

You need to pass in the options structure to
fminunc or fmincon. Read the help for these
functions!


I mean there is an error when I type the word options in
the fmincon or fminunc command?

Read the help! Pass in the arguments in the
correct (specified) order.


3. When I use the fminunc command,this message appears at
the begining:
Warning: Gradient must be provided for trust-region method;
using line-search method instead.

What doeas it mean? Is there any problem here?

I said this before, if you don't provide a gradient,
it cannot use the default largescale method, so
it switches to the medium scale method.

As I suggested above, please show us how you
called fmincon, as most likely you gave the
arguments in the wrong order.

John
.



Relevant Pages

  • Re: Scaling in fmincon()
    ... > I have been using the Matlab constrained optimization fucntion(). ... does anyone know if Matlab fmincon() does any scaling at all? ... I'll form two objectives, ... Iter F-count fconstraint Step-size derivative ...
    (comp.soft-sys.matlab)
  • Re: Need help with fmincon and fminunc
    ... I forgot to mention that of course when I used the fminunc ... command I didn't consider my ub and lb. ... fmincon,and when I run the optimization program,this ... 1.I don't have any constraint function.However,I have the ...
    (comp.soft-sys.matlab)
  • fmincon convergence
    ... FMINCON optimization has converged. ... isn't sure about convergence. ... "Optimization terminated: magnitude of directional ... If max constraint and the directional derivative are both ...
    (comp.soft-sys.matlab)
  • Need help with fmincon and fminunc
    ... fmincon,and when I run the optimization program,this ... 1.I don't have any constraint function.However,I have the ... use fminunc or should I use only fmincon? ... This command is written before the main command of ...
    (comp.soft-sys.matlab)
  • Re: fminunc: NaN or Inf prevents convergence
    ... For the same optimization, a different initial guess makes that this error doesn't occur. ... generates an inf or a nan for some set of ... Using fminunc, there is ... no constraint to stop it from looking in ...
    (comp.soft-sys.matlab)