output function for ga
2 views (last 30 days)
Show older comments
I have a question regarding Matlab GA output. I run my GA for a certain number of iterations and in each iteration it minimizes a function which has nested loops. For the outputs I only get the history of i (iteration), x (parameter that leads to the minimum result), and fval-(minimum value). Is there a way that I can store the value of other variables (all of the other variables) at the end of each GA iteration? I tried to use output functions but was not able to do so.
Thanks, Ali
0 Comments
Answers (1)
Alan Weiss
on 8 Jul 2015
Edited: Alan Weiss
on 8 Jul 2015
An output function only runs at the end of an iteration, and has access to variables described in the State Structure. To log other variables in your calculation, you have a number of alternatives available, described in Share Data Between Workspaces. You can log data for any of your functions by, say, having the functions append to a global variable in the base workspace, such as
global logvariable
% more calculations here
logvariable = [logvariable;newdata];
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
See Also
Categories
Find more on Genetic Algorithm 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!