genetic algorithm run time and result analysis
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 30 de Sept. de 2020
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
el 30 de Sept. de 2020
Walter Roberson
el 30 de Sept. de 2020
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
el 30 de Sept. de 2020
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
el 30 de Sept. de 2020
Nourhan Elsayed
el 30 de Sept. de 2020
Walter Roberson
el 30 de Sept. de 2020
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
el 30 de Sept. de 2020
Nourhan Elsayed — I have no idea how to interpret that vector.
Walter Roberson
el 30 de Sept. de 2020
I do not recognize that final message about inner iterations. Which MATLAB version are you using?
Walter Roberson
el 30 de Sept. de 2020
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
el 30 de Sept. de 2020
Editada: Nourhan Elsayed
el 30 de Sept. de 2020
Walter Roberson
el 30 de Sept. de 2020
Editada: Walter Roberson
el 4 de Oct. de 2020
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
el 1 de Oct. de 2020
Nourhan Elsayed
el 4 de Oct. de 2020
Walter Roberson
el 4 de Oct. de 2020
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'
Respuestas (0)
Categorías
Más información sobre Genetic Algorithm en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
