Termination of Genetic Algorithm

조회 수: 7 (최근 30일)
Fatih
Fatih 2023년 12월 31일
댓글: Fatih 2023년 12월 31일
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?

채택된 답변

Hassaan
Hassaan 2023년 12월 31일
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.
  댓글 수: 1
Fatih
Fatih 2023년 12월 31일
Thanks a lot, it worked.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by