Genetic Algorithm takes sooooo long time, number of function evaluation huge

4 visualizzazioni (ultimi 30 giorni)
Hi, I'm using genetic algorithm to do a small black box solver based optimization, with nonlinear inequality constraints, upper and lower bounds. The size of population for each generation is 20 as default. However why GA displays the following info in the command window:
Generation f-count Best f(x) Max constraint Stall Generation
1 1040 .... ............ ....
2 2060 .... ........... .........
3 3080 ..... ....... .......
4 4100 ..... .......... ......
5 5120 ...... ......... ........
6 6140 ...... ....... ........
Which shows that GA evaluated the fitness function for 1040 times to make the 2nd generation, and that confuses me a lot ! The user help does say that GA solves a sequence of subproblems that combining the fitness and nonlinear constraint function. Something like changing the penalty parameter to find the Lagrangian estimates so that the linear and bound constraints are fulfilled. But I still want to know the mathematics, how, how can it be 1040, with 20 populations each generation, one nonlinear constraint?
Thanks!!

Risposte (1)

Alan Weiss
Alan Weiss il 6 Giu 2012
Nonlinear constraints are difficult for the solver to handle. It is not a surprise that it takes so many iterations with nonlinear constraints.
For better performance, and more robust answers, I suggest you try the patternsearch solver. It usually works much more reliably and quickly. The only issue is you have to come up with your own initial points. Since you have upper and lower bounds, why not take
x0 = lb + rand(size(lb)).*(ub - lb);
Alan Weiss
MATLAB mathematical toolbox documentation

Community Treasure Hunt

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

Start Hunting!

Translated by