matlab多目标线性规划三个目标函数:求最大值的:f(1)=0.082*x(1)+0.072*x(2)+0.065*x(3)+0.054*x(4)+0.038*x(5)+0.057*x(6)+0.045*x(7)求最小值的:f(2)=0.072*x(1)+0.063*x(2)+0.057*x(3)+0.05*x(4)+0.032*x(5)+0.0442*x(6)+0.0675*x(7)f(3
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 02:10:19
matlab多目标线性规划三个目标函数:求最大值的:f(1)=0.082*x(1)+0.072*x(2)+0.065*x(3)+0.054*x(4)+0.038*x(5)+0.057*x(6)+0.045*x(7)求最小值的:f(2)=0.072*x(1)+0.063*x(2)+0.057*x(3)+0.05*x(4)+0.032*x(5)+0.0442*x(6)+0.0675*x(7)f(3
matlab多目标线性规划
三个目标函数:
求最大值的:
f(1)=0.082*x(1)+0.072*x(2)+0.065*x(3)+0.054*x(4)+0.038*x(5)+0.057*x(6)+0.045*x(7)
求最小值的:
f(2)=0.072*x(1)+0.063*x(2)+0.057*x(3)+0.05*x(4)+0.032*x(5)+0.0442*x(6)+0.0675*x(7)
f(3)=128*x(1)+78.1*x(2)+64.1*x(3)+43*x(4)+58.1*x(5)+36.9*x(6)+50.5*x(7)
约束条件:
0.082*x(1)+0.072*x(2)+0.065*x(3)+0.054*x(4)+0.038*x(5)+0.057*x(6)+0.045*x(7)>=7.2
0.072*x(1)+0.063*x(2)+0.057*x(3)+0.05*x(4)+0.032*x(5)+0.0442*x(6)+0.0675*x(7)
请说明x0,goal,weight表示的是什么。
matlab多目标线性规划三个目标函数:求最大值的:f(1)=0.082*x(1)+0.072*x(2)+0.065*x(3)+0.054*x(4)+0.038*x(5)+0.057*x(6)+0.045*x(7)求最小值的:f(2)=0.072*x(1)+0.063*x(2)+0.057*x(3)+0.05*x(4)+0.032*x(5)+0.0442*x(6)+0.0675*x(7)f(3
可以有多组解,关键是取决于初值给定
%
function zFgoalattain
% 多目标最优化
clear all; clc
% 给定目标,权重按目标比例确定,给出初值
options = optimset('TolCon',1e-008)
goal = [-7 264 69000];
weight = [0.193 0.083 0.724];
x0 = [1 1 1 1 1 1 1];
% 给出约束条件的系数
A=[-0.082 -0.072 -0.065 -0.054 -0.038 -0.057 -0.045;0.072 0.063 0.057 0.05 0.032 0.0442 0.0675;128 78.1 64.1 43 58.1 36.9 50.5]
B=[-7.2; 264.4;69719]
Aeq = [];
Beq = [];
lb=[0,0,0,0,0,0,0]
ub=[426,390,430,374,445,534,476]
[x,fval,attainfactor,exitflag] = fgoalattain(@ObjFun,x0,goal,weight,A,B,Aeq,Beq,lb,ub)
% ------------------------------------------------------------------
function f = ObjFun(x)
f1=0.082*x(1)+0.072*x(2)+0.065*x(3)+0.054*x(4)+0.038*x(5)+0.057*x(6)+0.045*x(7);
f2=0.072*x(1)+0.063*x(2)+0.057*x(3)+0.05*x(4)+0.032*x(5)+0.0442*x(6)+0.0675*x(7);
f3=128*x(1)+78.1*x(2)+64.1*x(3)+43*x(4)+58.1*x(5)+36.9*x(6)+50.5*x(7);
f=[-f1;f2;f3];
结果:
A =
-0.0820 -0.0720 -0.0650 -0.0540 -0.0380 -0.0570 -0.0450
0.0720 0.0630 0.0570 0.0500 0.0320 0.0442 0.0675
128.0000 78.1000 64.1000 43.0000 58.1000 36.9000 50.5000
B =
1.0e+004 *
-0.0007
0.0264
6.9719
lb =
0 0 0 0 0 0 0
ub =
426 390 430 374 445 534 476
Optimization terminated:magnitude of directional derivative in search
direction less than 2*options.TolFun and maximum constraint violation
is less than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1 1
2
5
7
x =
0.0000 -0.0000 313.3358 76.1065 -0.0000 104.6142 -0.0000
fval =
1.0e+004 *
-0.0030
0.0026
2.7218
attainfactor =
-121.4487
exitflag =
5