How to get the best idividuals values in each iteration point using GA tool in matlab??? Need your help
7 views (last 30 days)
Show older comments
Hi i am using optimtool in GA tool box in MATLAB. I am getting the plot for best fitness value for each iteration point but now i want to get the best individuals values in each iteration point. Is it possible to get individual values in each generation? If possible then please help me.
0 Comments
Answers (2)
Alan Weiss
on 12 Feb 2015
You can use an output function to get the individuals and their fitness values. As you see in State Structure, you can get both the population and the scores.
GA has a slightly different syntax for its output functions, but you can look at output functions for different solvers to see how they can be used: Particle Swarm, fmincon, or even the MATLAB fminsearch optimizater.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Saeid Ghouli
on 21 Oct 2022
You can define a custom plot function. Inside your plot function, use these two lines to obtain the best individuals:
[~,I] = min(state.Score);
best_individuals = state.Population(I,:);
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!