Functions with same evaluation outputs and same starting point have different fminsearch outcomes?
Show older comments
Hi guys,
I have two numerical functions f1 and f2 and for some reason, I cannot show the detailed codes for them. Basically, f2 is the vectorized version of f1.
These two functions have the same values for any inputs. Given the same starting point, however, the fminsearch gives different minimizer and different minimized function value.
What could be the reason behind it?
Thanks,
Jialin
Accepted Answer
More Answers (1)
Walter Roberson
on 18 Jul 2017
0 votes
fminsearch uses a random number generator so it will not produce the same results unless the random seed is rese
1 Comment
Mukul Rao
on 19 Jul 2017
Edited: Alan Weiss
on 19 Jul 2017
Hi Walter, thanks for pitching in. While random number generators are used by many of our solvers, especially global optimization solvers, it is not the case with fminsearch. It's based on the Nelder Mead algorithm, MATLAB's implementation of this algorithm is deterministic. I have verified this looking at the source code for "fminsearch" and also getting in touch with my colleagues in development. You can also try running the fminsearch algorithm on the same problem with the same initial conditions several times, it always returns the same solution (I've tried this on R2017a).
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!