![]() |
该编程发现运行不出,请高手解救!!
function f = myfun(x)
% 多目标最优化 clear all;clc % 给定目标,权重按目标比例确定,给出初值 options = optimset('TolCon',le-008); x0=[933 2134 4134 1333 40010 800 5334 220 3218 8048 10931 2886 116594 1332 12809 2943 12546 8 19 37 12 355 7 47 177 534 1030 1555 306 11899 238 1095 698 98 4400 8006 15532 4010 2080 20942]; weight=[146031 -540814 -7.17]; goal=[146031 -540814 -7.17]; % 给出约束条件的系数 A=[1111111111111111111111111111111111111111; 1111111000000000000000000000000000000000; 0000000111111111100000000000000000000000; 0000000000000000011111110000000000000000; 0000000000000000000000001111111111000000; 0000000000000000000000000000000000111111; -1000000-1000000000-1000000-1000000000-100000; 01000000-10000000001000000-1000000000-10000; 00-1000000-1000000000-1000000-1000000000-1000; 0000000000-10000000000000000-1000000000000; 000-10000000-100000000-10000000-100000000-100; 0000-10000000-100000000-10000000-10000000000; 00000-10000000-100000000-10000000-10000000-10; 00000000000000-10000000000000000-100000000; 000000000000000-10000000000000000-10000000; 00000-1000000000-1000000-1000000000-100000-1]; b=[300452,54681,172560,485,17611,55115,-6954,-16334,-31464,-13809,-9491,-281069,-6316,-15507,-5433.-41903]; Aeq=[]; beq=[]; lb=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; %求解 [x,fval,attainfactor,exitflag]=fgoalattain( @myfun,x0,goal,weight,A,b,[],[],lb,[]) %------------------------------------------------------- function f = myfun(x) f1=428271-x(1)-x(2)-x(3)-x(4)-x(5)-x(6)-x(7)-x(8)-x(9)-x(10)-x(11)-x(12)-x(13)-x(14)-x(15)-x(16)-x(17)-x(18)-x(19)-x(20)-x(21)-x(22)-x(23)-x(24)-x(25)-x(26)-x(27)-x(28)-x(29)-x(30)-x(31)-x(32)-x(33)-x(34)-x(35)-x(36)-x(37)-x(38)-x(39)-x(40); f2=-(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7))*1.8-(x(8)+x(9)+x(10)+x(11)+x(12)+x(13)+x(14)+x(15)+x(16)+x(17))*1.8-(x(18)+x(19)+x(20)+x(21)+x(22)+x(23)+x(24))*1.0-(x(25)+x(26)+x(27)+x(28)+x(29)+x(30)+x(31)+x(32)+x(33)+x(34))*2.4-(x(35)+x(36)+x(37)+x(38)+x(39)+x(40))*1.8; f3=-(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)+x(10)+x(11)+x(12)+x(13)+x(14)+x(15)+x(16)+x(17)+x(18)+x(19)+x(20)+x(21)+x(22)+x(23)+x(24)+x(25)+x(26)+x(27)+x(28)+x(29)+x(30)+x(31)+x(32)+x(33)+x(34)+x(35)+x(36)+x(37)+x(38)+x(39)+x(40))/41903; f=[f1;-f2;-f3]; |
回复: 该编程发现运行不出,请高手解救!!
哪里出错啊,你这是用什么方法求多目标优化?
|
回复: 该编程发现运行不出,请高手解救!!
运行的时候('TolCon',le-008)出错,我不知道是什么原因。
|
所有时间均为北京时间。现在的时间是 13:59。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.