文档介绍:遗传算法多目标函数优化
多目标遗传算法优化
铣削正交试验结果
序
号
vc
(m/min)
fz
(mm/z)
ae
(mm)
ap
(mm)
F
(N)
Ra
(μm)
1
40
-
-
程序如下:
clear; clc;
% 遗传算法直接求解多目标优化
D=8;
% Function handle to the fitness function
F=@(X)[10^()*(X(1).^(-)).*(X(2).^).*(X(3).^).*(X(4).^)];
Ra=@(X)[10^(-)*(X(1).^).*(X(2).^).*(X(3).^).*(X(4).^)];
Q=@(X)[-1000*2*X(1).*X(2).*X(3).*X(4)/(pi*D)];
nvars = 4; % Number of decision variables
lb = [40, ,, 2]; % Lower bound
ub = [100,, ,10]; % Upper bound
A = []; b = []; % No linear inequality constraints
Aeq = []; beq = []; % No linear equality constraints
% 遗传算法设定约束
options = gaoptimset('ParetoFraction',,'PopulationSize',200,'Generations',300,'StallGenLimit',200,'TolFun',1e-100,'PlotFcns',***@gaplotpareto);
% the data of Pareto1
FUN=@(X)[F(X);Ra(X)];
[x,fval] = gamultiobj(FUN,nvars,A,b,Aeq,beq,lb,ub,options);
% 开启一个新的图形
figure;
% 画出Pareto1
plot(fval(:,1),fval(:,2),'mp');
% 画出网格
grid on;
% 设定横坐标
xlabel('F');
% 设定纵坐标
ylabel('Ra');
% 设定题目
title('Pareto front 1');
% the data of Pareto2
FUN=@(X)[F(X);Q(X)];
[x,fval] = gamultiobj(FUN,nvars,A,b,Aeq,beq,lb,ub,options);
% 开启一个新的图形
figure;
% 画出Pareto2
plot(fval(:,1),fval(: