How to know the current input for fminsearch?
Show older comments
I'm using fminsearch for an optimization problem.
I use 100 random inputs and run fminsearch hoping that it doesn't get trapped in local minimas.
Sometimes, fminsearch takes more than usual. I suspect this is because of some bad behavior of some function in my problem that I haven't overseen earlier. I am wondering if I can somehow display the x (input) that fminsearch is working on right now (in real time). This will help me to find out why my problem takes longer around this particular point and if there is some issue with how I defined my problem, correct it (with some if,else,etc).
Thank you!
Accepted Answer
More Answers (1)
Alan Weiss
on 26 Jul 2020
0 votes
For optimizing a simulation or ODE, you may want to try patternsearch and surrogateopt. For surrogateopt you will need to bound all of the variables. These solvers have informative plot functions available.
Alan Weiss
MATLAB mathematical toolbox documentation
6 Comments
Siavash
on 6 Aug 2020
Alan Weiss
on 6 Aug 2020
Sounds like you might have found a bug. Sorry. Would you be able to provide reproductiion steps or code that causes this error? And let us know what version of MATLAB you are using?
Alan Weiss
MATLAB mathematical toolbox documentation
Siavash
on 6 Aug 2020
Alan Weiss
on 6 Aug 2020
Edited: Alan Weiss
on 6 Aug 2020
Yes, I want to reproduce the error, and need working code to do so.
Also, what version of MATLAB are you using?
Alan Weiss
MATLAB mathematical toolbox documentation
Siavash
on 7 Aug 2020
Alan Weiss
on 7 Aug 2020
You can attach it to this discussion or send it to me at aweiss@mathworks.com .
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Choose a Solver 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!