"C F" <cfrydman@caltech.edu> wrote in message
news:gruogc$p$1@fred.mathworks.com...
> Hi,
>
> I'm using fmincon to solve an MLE problem and have run into some problems:
>
> 1) max function evaluation seems to occur after each run. what is the
> difference between this and an iteration max being reached?
The MaxFunEvals option controls how many times FMINCON is allowed to
evaluate your objective function.
The MaxIter option controls how many times FMINCON is allowed to step to a
new point that it thinks is a "better" solution to the problem.
One iteration usually involves multiple function evaluations, as FMINCON
tries to locate a new "better" solution.
> 2) i omitted the semicolon after the final line in my function .m file so
> that I could see the function values during iteration. most read "Nan"
That's not good.
> Is there a way I can see the path the algorithm is using to find the
> minimum over this (8 dimensional) surface? I'd like to see this because I
> believe the function is well defined over the whole space, and am
> wondering why the function values are "Nan"
Two things you can do:
1) Create an OutputFcn that displays the solution at the given iteration
and/or updates a variable in a MATfile with the current solution.
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/f19175.html#f11022
2) Add the following command at the beginning of your objective function:
dbstop if infnan
This will cause MATLAB to stop as soon as it sees an Inf or NaN value. This
way you can locate where the NaN is being introduced. You will likely want
to use an onCleanup object to restore the state, or if you're sure you're
not going to cancel out of the execution of your objective function you can
instead put the following command at the end of your objective function:
dbclear if infnan

Steve Lord
slord@mathworks.com
