Re: Need help with fmincon and fminunc
- From: "John D'Errico" <woodchips@xxxxxxxxxxxxxxxx>
- Date: Fri, 14 Dec 2007 09:17:42 +0000 (UTC)
"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
.
- References:
- Need help with fmincon and fminunc
- From: Mahsa Moghaddas
- Need help with fmincon and fminunc
- Prev by Date: Re: Trainbp without a graph
- Next by Date: Re: MEX debug on win32 2006b
- Previous by thread: Re: Need help with fmincon and fminunc
- Next by thread: combining cellstrs into txt output
- Index(es):
Relevant Pages
|