How can I obtain and view the automatic generated initial population from GA from Optimization Toolbox 5.1 (R2010b)?
1 view (last 30 days)
Show older comments
I use the function GA without any given initial population and I want to view the initial population generated or produced by GA.
Accepted Answer
MathWorks Support Team
on 29 Jun 2011
To see the intial population, one can specify or set the 'OutputFcns' property from the option used by GA. The function set by 'OutputFcns' gets called every itteration.
First write a function MATLAB file called my_view containing
function [state, options,optchanged] = my_view(options,state,flag,interval)
optchanged = false;
disp(state.Population)
end
Now set the 'OutputFcns' property to this function via
options = gaoptimset('OutputFcns',@my_view);
Finally call the GA function with this specified option
x = ga(fitnessfcn,nvars,options)
0 Comments
More Answers (0)
See Also
Categories
Find more on Simulink Design 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!