How can I retrieve the value of the number of generations in Genetic algorithm??

1 次查看(过去 30 天)
I have set the Generations = 10.
Now, I started the ga(). At first time, of course, the value of generations is 1. We call the Fitnessfunction in ga() i.e. ga(Fitnessfunction, nvar, myfit_func). I want to retrieve that "generation value 1" inside my Fitnessfunction. After Fitnessfunction executed, we will get the new population. At this time, the value of generation will become 2, now I have to use that value 2 inside my Fitnessfunction and so on up till 10
How can I do that?? I want to retrieve the value of generation for each iteration and have to use it in my Fitnessfunction. But ga() doesn't allow me to do that. I tried the "gen = Output .generation" inside the Fitnessfunction, but failed.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Pattern Recognition and Classification 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by