optim stopping without reaching convergence

336 views
Skip to first unread message

grande...@gmail.com

unread,
Jan 22, 2016, 7:30:34 PM1/22/16
to julia-users
There is really something weird happening with optim. really puzzled but what could go wrong.

So when I run:

optr = optimize(objfun,sps0,method = :nelder_mead,iterations=2000)

The algorithm stops after precisely 10 function evaluations. Output:

**** 

Results of Optimization Algorithm
 * Algorithm: Nelder-Mead
 * Starting Point: [0.66,0.5,-0.3,0.05,5.0,2.0,3.0,2.0,3.0]
 * Minimum: [0.7600000000000002,0.6000000000000001, ...]
 * Value of Function at Minimum: 2438.299855
 * Iterations: 2000
 * Convergence: false
   * |x - x'| < NaN: false
   * |f(x) - f(x')| / |f(x)| < 1.0e-08: false
   * |g(x)| < NaN: false
   * Exceeded Maximum Number of Iterations: true
 * Objective Function Calls: 2010
 * Gradient Call: 0
****

As you can see Objective Function Calls: 2010 and Iterations: 2000 while I am sure there are just functions evaluations (1000-2000).

Anyone has any clue what could be causing this?
Should I reset iterations number somewhere? how to do that?

many thanks!!!
Message has been deleted

Kristoffer Carlsson

unread,
Jan 22, 2016, 8:01:56 PM1/22/16
to julia-users
Look at the source https://github.com/JuliaOpt/Optim.jl/blob/master/src/nelder_mead.jl
The number of iterations is not necessarily the same as the number of objective function evaluations

grande...@gmail.com

unread,
Jan 24, 2016, 1:45:48 PM1/24/16
to julia-users
thanks but that s not the issue. for some reasons. the number of iterations is really high to begin with

Iain Dunning

unread,
Jan 24, 2016, 4:43:35 PM1/24/16
to julia-users
Nelder-Mead is a pretty brute-force algorithm, so maybe its just struggling with your 10-dimensional objective function.
Its using 10 evaluations (one for each dimension) in the initial setup, then doing 2000 updates to the simplex.

Patrick Kofod Mogensen

unread,
Jan 25, 2016, 3:15:16 AM1/25/16
to julia-users
How did you verify that? Or are you guessing? Did you @show the iteration counter's increment? If not, how do you know it starts high?

Tim Holy

unread,
Jan 25, 2016, 5:39:16 AM1/25/16
to julia...@googlegroups.com
If you think there's a bug, one thing you can do is compare Julia's
implementation to another implementation for the same problem and same
starting point. You have to be careful not to read code that has an
incompatible license (either proprietary or GPL), or you become "tainted" and
can't contribute fixes related to anything you read.

One safe thing to do is modify your own objective function simply to print out
the location it's being fed for evaluation---that way you can find out whether
the sequence of points is the same, without ever looking at the algorithm's
source code. You can control the initial step with the `initial_step` keyword.

--Tim

Brendan Tracey

unread,
Jan 25, 2016, 11:17:22 AM1/25/16
to julia-users
We have an alternate implementation at gonum that's BSD.

https://godoc.org/github.com/gonum/optimize#NelderMead

Should be pretty easy to wrap your function through command line calls. I'm happy to help if you'd like it.
Reply all
Reply to author
Forward
0 new messages