Writing fitness function in multi objective GA

1 回表示 (過去 30 日間)
Hari
Hari 2022 年 5 月 25 日
回答済み: M Mirrashid 2022 年 6 月 5 日
If I need to go for a multi objective optimisation in GA, how can I bring in the two objectives in a custom made fitness function. Can someone explain in the context of the travelling salesman problem described here : https://in.mathworks.com/help/gads/custom-data-type-optimization-using-ga.html

採用された回答

Walter Roberson
Walter Roberson 2022 年 5 月 25 日
mobj = @(x) [fun1(x); fun2(x) ]
  7 件のコメント
Walter Roberson
Walter Roberson 2022 年 5 月 27 日
I am not getting a problem in my tests ?
fun1 = @(x) sin(pi*x(:,1)) + sinh(x(:,2));
fun2 = @(x) cos(pi*x(:,1)) + cosh(x(:,2));
mobj = @(x) [ fun1(x), fun2(x) ];
nvars = 2;
lb = [-pi -pi];
ub = [pi pi];
options1 = optimoptions(@gamultiobj, 'UseVectorized', false);
[Y1, fval1] = gamultiobj(mobj, nvars, [], [], [], [], lb, ub, [], options1);
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.
options2 = optimoptions(@gamultiobj, 'UseVectorized', true);
[Y2, fval2] = gamultiobj(mobj, nvars, [], [], [], [], lb, ub, [], options1);
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.
Hari
Hari 2022 年 6 月 4 日
Yes, I tried again. The second approach worked this time. Thanks!!

サインインしてコメントする。

その他の回答 (1 件)

M Mirrashid
M Mirrashid 2022 年 6 月 5 日

カテゴリ

Help Center および File ExchangeSolver-Based Optimization Problem Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by