genetic algorithm run time and result analysis
显示 更早的评论
Hello
i am using Genetic algorithm. my problem has
nvars=30,
population size = 400
size of initial population matrix = 50x30
max. generation = 200
the following is a plot of best fitness value optained at each generation. the dark dots are ''best value across a generation '' the lighter dots are ''mean value across a generation''
question 1 is; it takes very long time to reach this figure, more than 10 hours, is that normal for my code that has around 300 lines?
question 2: whould any one comment on the shape of output result, this is scattered but on the same area. may be the search space does not mutate enogh? i used the default options for mutation and crossover.
question 3: what options could be useful to reduce running time but get an accurate result, i can reduce the max generations and population size, but i want to lmite the run time to 15 min.

15 个评论
Walter Roberson
2020-9-30
is that normal for my code that has around 300 lines?
Did you implement genetic algorithm yourself, in about 300 lines of code? Or are you using ga() ?
Nourhan Elsayed
2020-9-30
Walter Roberson
2020-9-30
What kinds of operations do you do in those 300 lines?
Are the nonlinear constraints only inequalities or are there equalities as well? You can end up having to test a lot of differerent values to find matches for nonlinear equalities.
Star Strider
2020-9-30
One possibility is that ga is chasing a moving target, and the fitness function is changing arbitrarily, perhaps due to a random number generator call. A static fitness function — where only the parameters are changing — should converge.
Nourhan Elsayed
2020-9-30
Nourhan Elsayed
2020-9-30
Walter Roberson
2020-9-30
How large is the fitting function and what kinds of operations are you doing in it?
Are you loading a file inside the fitting function?
Star Strider
2020-9-30
Nourhan Elsayed — I have no idea how to interpret that vector.
Walter Roberson
2020-9-30
I do not recognize that final message about inner iterations. Which MATLAB version are you using?
Walter Roberson
2020-9-30
Nonlinear equality constraints effectively require the equivalent of an fsolve to try find a position that meets the constraints. That can be tricky since the constraints are permitted to be discontinuous. Also sometimes the constraints involve considerable computation.
Nourhan Elsayed
2020-9-30
编辑:Nourhan Elsayed
2020-9-30
Walter Roberson
2020-9-30
编辑:Walter Roberson
2020-10-4
Are you reading a file inside your objective function (task 2)? That is expensive to process. https://www.mathworks.com/help/matlab/math/parameterizing-functions.html
Nourhan Elsayed
2020-10-1
Nourhan Elsayed
2020-10-4
Walter Roberson
2020-10-4
You might want to add an additional PlotFcn to plot the generation information. Or since you are only running 50 generations, change the 'Display' option to 'iter'
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
