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!
