多目标规划问题Matlab示例_fgoalattain
多目标规划问题:
x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,... options) minimizes with the optimization options specified in the structure options.
Use optimset to set these options.
例子:三个目标函数:求最大值的:
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)<=264.4
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)<=69719
lb=[0,0,0,0,0,0,0]
ub=[426,390,430,374,445,534,476]
f(1),f(2),f(3)的权值分别是:0.193,0.083,0.724 %======================
function z=fgoalattain
% 多目标最优化
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