Borrar filtros
Borrar filtros

Termination of Genetic Algorithm

6 visualizaciones (últimos 30 días)
Fatih
Fatih el 31 de Dic. de 2023
Comentada: Fatih el 31 de Dic. de 2023
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?

Respuesta aceptada

Hassaan
Hassaan el 31 de Dic. de 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.

Más respuestas (0)

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by