optimize four functions together
3 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have four functions and I want to optimize them together by ga. I know that I can solve each function alone and I already got an answer about that, but if I have all of them. The values I want to get is F1=0.405, F2=24.736 ,F3=0.525, F4=14.97. I approciate any help.
F1=@(x) 0.25-4.27*x(1)+0.61*x(2)+13.34*x(1)*x(2)-4.69*x(2).^2;
F2 = @(x) 30.07+71.68*x(1)-21.83*x(2)-306.55*x(1)*x(2)+179*x(2)^2;
F3 = @(x) 0.54-18.32*x(3)-10.6*x(1)-3.22*x(2)+0.3*x(4)+273.71*x(3)*x(1)+60.28*x(1)*x(2)-19.81*x(2).^2;
F4 = @(x) 17.39+1246.36*x(3)+348.83*x(1)-88.27*x(2)-43.72*x(4)-24455.25*x(3)*x(1)-1164.66*x(1)*x(2)+347.38*x(2)*x(4);
FitnessFunction=[F1;F2;F3;F4];
% [ fn, fc, f0, ff] ; % the range like this
lb = [0.001,0.01,0.0002,0.1];
ub = [0.045,0.1,0.0045,0.2];
numberOfVariables = 4;
A = []; b = [];
Aeq = []; beq = [];
[x,fval] = ga(FitnessFunction, numberOfVariables, A, b, Aeq, beq, lb, ub)
Many thanks
0 件のコメント
採用された回答
Walter Roberson
2023 年 5 月 24 日
移動済み: Matt J
2023 年 5 月 24 日
6 件のコメント
Walter Roberson
2023 年 5 月 25 日
Option 1: functions are independent, but for some reason you want to call an optimizer only once instead of making four separate optimization calls. Note that this approach will always be less efficient than making separate optimization calls:
F1=@(x) 0.25-4.27*x(1)+0.61*x(2)+13.34*x(1)*x(2)-4.69*x(2).^2;
F2 = @(x) 30.07+71.68*x(1)-21.83*x(2)-306.55*x(1)*x(2)+179*x(2)^2;
F3 = @(x) 0.54-18.32*x(3)-10.6*x(1)-3.22*x(2)+0.3*x(4)+273.71*x(3)*x(1)+60.28*x(1)*x(2)-19.81*x(2).^2;
F4 = @(x) 17.39+1246.36*x(3)+348.83*x(1)-88.27*x(2)-43.72*x(4)-24455.25*x(3)*x(1)-1164.66*x(1)*x(2)+347.38*x(2)*x(4);
FitnessFunction = @(x)[F1(x(1:2));F2(x(3:4));F3(x(5:8));F4(x(9:12))];
lb = [0.001,0.01,0.001,0.01,0.001,0.01,0.0002,0.1,0.001,0.01,0.0002,0.1]
ub = [0.045,0.1,0.045,0.1,0.045,0.1,0.0045,0.2,0.045,0.1,0.0045,0.2]
numberOfVariables = length(lb);
A = []; b = [];
Aeq = []; beq = [];
[x,fval] = gamultiobj(FitnessFunction, numberOfVariables, A, b, Aeq, beq, lb, ub)
Walter Roberson
2023 年 5 月 25 日
Option 2: variables are shared, x(1) is the same variable for each, x(2) is the same for each, x(3) is the same for each that uses it, etc.
F1=@(x) 0.25-4.27*x(1)+0.61*x(2)+13.34*x(1)*x(2)-4.69*x(2).^2;
F2 = @(x) 30.07+71.68*x(1)-21.83*x(2)-306.55*x(1)*x(2)+179*x(2)^2;
F3 = @(x) 0.54-18.32*x(3)-10.6*x(1)-3.22*x(2)+0.3*x(4)+273.71*x(3)*x(1)+60.28*x(1)*x(2)-19.81*x(2).^2;
F4 = @(x) 17.39+1246.36*x(3)+348.83*x(1)-88.27*x(2)-43.72*x(4)-24455.25*x(3)*x(1)-1164.66*x(1)*x(2)+347.38*x(2)*x(4);
FitnessFunction = @(x)[F1(x(1:2));F2(x(1:2));F3(x(1:4));F4(x(1:4))];
lb = [0.001,0.01,0.0002,0.1];
ub = [0.045,0.1,0.0045,0.2];
numberOfVariables = length(lb);
A = []; b = [];
Aeq = []; beq = [];
[x,fval] = gamultiobj(FitnessFunction, numberOfVariables, A, b, Aeq, beq, lb, ub)
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!