Termination of Genetic Algorithm
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a matlab code that is used for an optimization problem.
If I don't use the genetic algorith doesn't show its full performance due to premature termination, wtih the following feedback
++
Optimization terminated: average change in the penalty fitness value less than options.FunctionTolerance
and constraint violation is less than options.ConstraintTolerance.++
I want to disable constraint and function tolerance and see what will be the results after a long trial. I use the following options.
++
Optimization terminated: average change in the penalty fitness value less than options.FunctionTolerance
++
options = optimoptions('ga','PlotFcn', @gaplotbestf,'MaxStallGenerations',500,'MaxGenerations',1000);
[results , fval] = ga(@SVN,heights,A,b,Aeq,beq,lb,ub,nonlcon,intcon,options) ; ++
Even I used very small numbers it didn't work. Would you please suggest an options?
0 commentaires
Réponse acceptée
Hassaan
le 31 Déc 2023
To adjust the FunctionTolerance and ConstraintTolerance:
options = optimoptions('ga', ...
'PlotFcn', @gaplotbestf, ...
'MaxStallGenerations', 500, ...
'MaxGenerations', 1000, ...
'FunctionTolerance', 1e-6, ... % Smaller value
'ConstraintTolerance', 1e-6); % Smaller value
[results, fval] = ga(@SVN, heights, A, b, Aeq, beq, lb, ub, nonlcon, intcon, options);
In this code, FunctionTolerance and ConstraintTolerance are set to 1e-6, which is quite small and should prevent early termination unless the algorithm genuinely has converged. You can adjust these values based on your specific needs and how long you're willing to let the algorithm run.
Test these settings, and adjust as necessary based on the performance and results you observe. If you find the algorithm still converges too quickly, consider further reducing the FunctionTolerance and ConstraintTolerance. Just be aware that at some point, further reductions may not lead to better solutions, just longer computation times.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Genetic Algorithm dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!