fgoalattain优化函数运行频频出错,请高手指点一二,代码如下
%建立m文件:function f=myfun(x)
f(1)=27.5*(x(2)+x(7)+x(11)+x(15));
f(2)=52299186225+11*(x(1)+x(6)+x(10));
f(3)=5117347125+5.5*(x(4)+x(8)+x(13)+x(17));
f(4)=3957497896+16.5*(x(3)+x(12)+x(16));
f(5)=856152000+22*(x(5)+x(9)+x(14));
%给定目标,权重按其目标值确定
goal=;
weight=abs(goal);
x0=;
%给出约束条件系数
A=[0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0
0,-1,0,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0
1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0
-1,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,0,0
0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1
0,0,0,-1,0,0,0,-1,0,0,0,0,-1,0,0,0,-1
0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0 n
0,0,-1,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0
0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0
0,0,0,0,-1,0,0,0,-1,0,0,0,0,-1,0,0,0
1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0];
b=;
lb=zeros(17,1);
%命令窗求解:
=fgoalattain(@myfun,x0,goal,weight,A,b,[],[],lb,[]) %求解
提示哪行存在错误啊具体错误是什么贴出来啊 Generation 发表于 2016-9-10 09:24
提示哪行存在错误啊具体错误是什么贴出来啊
谢谢关注,问题解决了,以后多交流,:-D 涓涓溪流 发表于 2016-9-12 09:22
谢谢关注,问题解决了,以后多交流,:-D
咋解决的啊??? 楼主怎么解决的? 答复各位友友,矩阵A第七行末尾多了一个n,删掉后运行再没提示出错,但也没有得出优化结果,还在改进中。 涓涓溪流 发表于 2016-9-26 09:58
答复各位友友,矩阵A第七行末尾多了一个n,删掉后运行再没提示出错,但也没有得出优化结果,还在改进中。
哈哈好吧
页:
[1]