How can I use OPTIMSET to display only the iteration number when executing an optimization function?
9 views (last 30 days)
Show older comments
In my optimization function, I would like to display just the iteration number after each iteration. To do that, I am setting the options for this function using
optimset('Display','iter')
However, when I use this option the optimization function displays a lot of information regarding the optimization parameters along with iteration number. I would like to see only the iteration number and suppress all other information.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
The ability to display only the iteration number and suppress other information using the 'Display' option in OPTIMSET function is not available in Optimization Toolbox 3.1 (R2006b).
To work around this issue, you can use the 'OutputFcn' option. The function specified in this field is called by the optimization function after each iteration.
As an example of this, see the attached file 'outfun.m'. To use 'outfun' as your 'OutputFcn', set the 'OutputFcn' option to 'outfun' as follows
opts = optimset('OutputFcn',@outfun);
Then, when you call the optimization function with 'opts' option structure created above, you will be able to see the iteration number at MATLAB command window after each iteration.
ow after each iteration.
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!