多目标规划模型的求解方法
1.传统优化算法
1.1主要目标法
1.2分层序列法
1.3加权法
1.4理想点法
2.智能优化算法
遗传算法等…
例题实战:MATLAB中多目标遗传算法求解法
通用形式
例1:
matlab求解:
Fun.m
function y=Fun(x)
y(1)=x(1)^4-10*x(1)^2+x(1)*x(2)+x(2)^4-x(1)^2*x(2)^2;
y(2)=x(2)^4-x(1)^2*x(2)^2+x(1)^4+x(1)*x(2);
main.m
clear
clc
fitnessfcn=@Fun;%适应度函数句柄
nvars=2; %变量个数
lb=[-5,-5]; %下限
ub=[5,5]; %上限
A=[];b=[]; %线性不等式约束
Aeq=[];beq=[]; %线性等式约束
options=gaoptimset('paretoFraction',0.3,'populationsize',200,'generations',200,'stallGenLimit',200,'TolFun',1e-10,'PlotFcns',@gaplotpareto);
% 最优个体系数paretoFraction为0.3;
%种群大小populationsize为100,
%最大进化代数generations为200,
% 停止代数stallGenLimit为200,
%适应度函数偏差TolFun设为1e-10,
%函数gaplotpareto:绘制Pareto前沿
[x,fval]=gamultiobj(fitnessfcn,nvars,A,b,Aeq,beq,lb,ub,options)
例2:
matlab求解:
Fun.m
function y=Fun(x)
y(1)=x(1);
y(2)=(1+x(2))/x(1);
nonlcon.m
function [c,ceq] = nonlcon(x)
c =[];
ceq =[x(1)^2+x(2)^2-2];
main.m
clear
clc
fitnessfcn=@Fun;
nvars=2;
lb=[0.1,0];
ub=[1,5];
A=[-9,-1;-9,1];b=[-6;-1];
Aeq=[];beq=[];
nonlinearCons = @nonlcon;
options=gaoptimset('paretoFraction',0.4,'populationsize',200,'generations',300,'stallGenLimit',300,'TolFun',1e-10,'PlotFcns',@gaplotpareto);
[x,fval]=gamultiobj(fitnessfcn,nvars,A,b,Aeq,beq,lb,ub,nonlinearCons,options)
例3:
matlab求解:
fitness.m
function F = fitness(x)
F(1) = -100*x(1) - 80*x(2)- 90*x(3) - 70*x(4);
F(2) = 30*x(3) + 20*x(4);
F(3) = 50*x(1) +40*x(2)
main.m
clear
clc
fit = @fitness;
nvars = 4;
lb = [0 0 0 0];
ub = [];
A = [3, 2, 0, 0; -3, -2, 0, 0; 0, 0, 3, 2; 0, 0, -3, -2; -1, 0, -1, 0; 0, -1, 0, -1];
b = [120 0 48 0 -30 -30];
options = gaoptimset('paretoFraction',0.4,'populationsize',200,'generations',300,'stallGenLimit',200,'TolFun',1e-10);
[x,fval] = gamultiobj(fit,nvars,A,b,[],[],lb,ub,options)
plot3(fval(:,1),fval(:,2),fval(:,3),'pr')
xlabel('f_1(x)')
ylabel('f_2(x)')
zlabel('f_3(x)')
title('Pareto front')
grid on