From: Didi Cvet on
I have noticed that after some iteration (sometimes second, sometimes fifth) fmincon finds parameters that give minimal objective function. But when the iterations are finished i.e. fmincon is finished with exit flag
>>Maximum number of iterations exceeded;
increase OPTIONS.MaxIter.<<
or
>>Maximum number of function evaluations exceeded;
increase OPTIONS.MaxFunEvals.<<
I get initial values as optimal because during the iteration fmincon enters in some loop where it can't update Hessian matrix.
Is there any way to get parameters from iteration where objective function is minimal not the ones that fmincon returns?
From: Matt on
"Didi Cvet" <didi_cvet(a)yahoo.com> wrote in message <hegvhf$jss$1(a)fred.mathworks.com>...
> I have noticed that after some iteration (sometimes second, sometimes fifth) fmincon finds parameters that give minimal objective function. But when the iterations are finished i.e. fmincon is finished with exit flag
> >>Maximum number of iterations exceeded;
> increase OPTIONS.MaxIter.<<
> or
> >>Maximum number of function evaluations exceeded;
> increase OPTIONS.MaxFunEvals.<<
> I get initial values as optimal because during the iteration fmincon enters in some loop where it can't update Hessian matrix.
> Is there any way to get parameters from iteration where objective function is minimal not the ones that fmincon returns?
===============

If fmincon is terminating with the initial parameter values, it means that all iterations (even the very first one) have failed to make any progress. Therefore, there is no iteration where the output will be any better than your initial guess. You should probably investigate why the Hessian cannot be updated.
From: Alan Weiss on
Didi Cvet wrote:
> I have noticed that after some iteration (sometimes second, sometimes fifth) fmincon finds parameters that give minimal objective function. But when the iterations are finished i.e. fmincon is finished with exit flag
>>> Maximum number of iterations exceeded;
> increase OPTIONS.MaxIter.<<
> or
>>> Maximum number of function evaluations exceeded;
> increase OPTIONS.MaxFunEvals.<<
> I get initial values as optimal because during the iteration fmincon enters in some loop where it can't update Hessian matrix.
> Is there any way to get parameters from iteration where objective function is minimal not the ones that fmincon returns?

I don't know what is going on in your optimization, but you can write an
"output function" to record anything you like about the iterations. See
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/brhkghv-56.html
and
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/f19175.html#f11022
for more information.

Alan Weiss
MATLAB mathematical toolbox documentation
From: Didi Cvet on
"Matt " <xys(a)whatever.com> wrote in message <heh20c$79r$1(a)fred.mathworks.com>...
> "Didi Cvet" <didi_cvet(a)yahoo.com> wrote in message <hegvhf$jss$1(a)fred.mathworks.com>...
> > I have noticed that after some iteration (sometimes second, sometimes fifth) fmincon finds parameters that give minimal objective function. But when the iterations are finished i.e. fmincon is finished with exit flag
> > >>Maximum number of iterations exceeded;
> > increase OPTIONS.MaxIter.<<
> > or
> > >>Maximum number of function evaluations exceeded;
> > increase OPTIONS.MaxFunEvals.<<
> > I get initial values as optimal because during the iteration fmincon enters in some loop where it can't update Hessian matrix.
> > Is there any way to get parameters from iteration where objective function is minimal not the ones that fmincon returns?
> ===============
>
> If fmincon is terminating with the initial parameter values, it means that all iterations (even the very first one) have failed to make any progress. Therefore, there is no iteration where the output will be any better than your initial guess. You should probably investigate why the Hessian cannot be updated.

Thanks for response
Here is how I noticed that I have better parameters during the iterations. I've put a break point in my objective function (before it's end) and I was checking output after every call, and I'm sure that there was better output than initial one. I've tried to investigate why my Hessian is not updated but I can't find it out
Anyway thanks very much, I will try with output function but if anyone have idea why is this happening please let him write.
Respectfully
DidiCvet
From: Marcelo Marazzi on
Didi,

Could you provide a snippet of code that shows the call to fmincon, including the options
you're passing to the solver. (There are several algorithms in fmincon and it's not clear
to me which one you are using.)

I'm not sure what you mean by "my Hessian is not updated". How do you notice this is the
case? Are you supplying your own Hessian or relying on the solver's internal approximation
to it?

You may also want to set the option Display to 'iter' and post (part of) the output you
are getting, as this may be helpful.

-Marcelo

Didi Cvet wrote:
> "Matt " <xys(a)whatever.com> wrote in message <heh20c$79r$1(a)fred.mathworks.com>...
>> "Didi Cvet" <didi_cvet(a)yahoo.com> wrote in message <hegvhf$jss$1(a)fred.mathworks.com>...
>>> I have noticed that after some iteration (sometimes second, sometimes fifth) fmincon finds parameters that give minimal objective function. But when the iterations are finished i.e. fmincon is finished with exit flag
>>>>> Maximum number of iterations exceeded;
>>> increase OPTIONS.MaxIter.<<
>>> or
>>>>> Maximum number of function evaluations exceeded;
>>> increase OPTIONS.MaxFunEvals.<<
>>> I get initial values as optimal because during the iteration fmincon enters in some loop where it can't update Hessian matrix.
>>> Is there any way to get parameters from iteration where objective function is minimal not the ones that fmincon returns?
>> ===============
>>
>> If fmincon is terminating with the initial parameter values, it means that all iterations (even the very first one) have failed to make any progress. Therefore, there is no iteration where the output will be any better than your initial guess. You should probably investigate why the Hessian cannot be updated.
>
> Thanks for response
> Here is how I noticed that I have better parameters during the iterations. I've put a break point in my objective function (before it's end) and I was checking output after every call, and I'm sure that there was better output than initial one. I've tried to investigate why my Hessian is not updated but I can't find it out
> Anyway thanks very much, I will try with output function but if anyone have idea why is this happening please let him write.
> Respectfully
> DidiCvet