How to get values for each iteration on optimization toolbox
62 views (last 30 days)
I am using MATLAB optimization toolbox. I want to know how can I get values on each iteration, such as objective function value, or variable values. I am using fmincon function. So long What I can get is only the final value of the variables and the final value of the objective function after some iterations. I want to get those values for each iteration, saving them anywhere, but preferably on a .txt file or displaying them on the screen.
Thanks and regards, Hugo Silva, Eng. MSc.
More Answers (2)
Daniel Frisch on 7 Oct 2020
You can use my function
It stores the intermediate results in a global variable so you can inspect it later.
Using this function directly as 'OutputFcn' in the solver saves you the extra trouble writing it yourself.