Genetic algorithm, nonlinear constraints, TolFun how to get good results ?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
houda mejri
il 4 Mag 2017
Commentato: houda mejri
il 4 Mag 2017
Hello, please i simulated a code for optimization of discrete and continous variables using ga function but I get a result that I do not like and in addition I have this message "Optimization terminated: average change in the penalty fitness value less than options.TolFun and constraint violation is less than options.TolCon. " . How can I improve the results? Thanks thank you
0 Commenti
Risposta accettata
John D'Errico
il 4 Mag 2017
Modificato: John D'Errico
il 4 Mag 2017
This is not a question of options. Yes, people think, if only I knew what options to set, and to exactly what values, the answer would emerge like magic. NOT true. That only happens in the movies or on TV, where computers are all powerful, and the proper code is written in 5 keystrokes to then solve a problem that would require at least a Phd thesis in real life, IF it was solvable at all.
Not all optimization problems converge to the solution you hope to see. That may be because you
1. Coded the objective incorrectly.
2. Formulated the problem poorly (so a poor objective.)
3. Provided poor starting values.
4. The optimization got stuck in a local minimizer.
5. The solution you hoped to see really is not a minimum.
Case 4 is a variation of case 3. Both say that you get to the wrong solution, because you started in the wrong spot.
Probably a few others I forgot to list. But one reason that is only very rarely the case is you chose the wrong settings for options. I would strongly suggest you reconsider each of the possibilities I suggested above. Why cannot I be more accurate in my diagnosis of where the problem lies? Because we see NOTHING about what you actually did! All that we can tell from here is that you had a problem with an optimization. So the answer is you did something wrong.
3 Commenti
John D'Errico
il 4 Mag 2017
That is NOT a warning or error. "Terminated" is just a synonym for "done" in this case. The optimizer thinks the result is a s good as it can do, given the set of starting values provided. It sees no place better to search, and the convergence criteria were satisfied.
Più risposte (1)
Alan Weiss
il 4 Mag 2017
I believe that the best way to get better answers is to use a better algorithm. In this case, first see whether your fitness function and nonlinear constraints are both smooth. If they are, then use fmincon instead of ga, and if you are looking for a global minimum, start from a variety of initial points, such as
x0 = lb + rand(size(lb)).*(ub-lb);
If your fitness function or nonlinear constraints are not smooth, then use patternsearch, again starting from a variety of points.
Seriously, both fmincon and patternsearch are much faster, more reliable and robust, and easier to tune than ga. You will almost certainly be delighted.
Alan Weiss
MATLAB mathematical toolbox documentation
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!