フィルターのクリア

Termination of Genetic Algorithm

6 ビュー (過去 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 Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by