help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fminsearch options Display iter


From: Kai Torben Ohlhus
Subject: Re: fminsearch options Display iter
Date: Wed, 19 Dec 2018 23:32:03 +0100

On Tue, Dec 18, 2018 at 6:21 PM gciriani <address@hidden> wrote:
Does

display the absolute value of the function?

I'm working on a maximization problem with fminsearch, therefore I put a
minus sign in front of my function, for the minimizer to work in my case.
The function is a probability and is always positive. I then pass the
function to a handle and finally I use the handle in fminsearch for the
minimization.

I set the Display option to iter to observe what is going on. However, the
value displayed is positive. Is this done for a particular reason, or am I
assuming something incorrectly?



-----
Giovanni Ciriani - Windows 10, Octave 4.2.1, configured for x86_64-w64-mingw32
--


Not exactly, it seems a bit odd to me, but it displays the negative function value due to the minimization direction of the underlying Nelder-Mead simplex method.  See the source


and additionally line 254 (direction) and line 285 (output for `optimset ("display", "iter")`).

In the following example everything must be positive, but the function values are displayed with negative sign:

  [xmin, fval] = fminsearch (@(x) sum(x.^2), [1 0], optimset ("display", "iter"))

On the other hand, here the function values of the last iterates must be negative, but are displayed as positive:

  [xmin, fval] = fminsearch (@(x) sum(x.^2) - 1, [1 0], optimset ("display", "iter"))

HTH,
Kai

reply via email to

[Prev in Thread] Current Thread [Next in Thread]