function f=GaSol(x)
Rmin=0;
yingta=0.2;
v=[0.15,0.1,0.075,0.075,0.075,0.075,0.025,0.08,0.1,0.125,0.025,0.125,0,0,0]';
c=[4 2 4 2 2 2 2 2 2 4 2 4 0 0 0]';
if x(15)~=0
for i=1:12
g(i)=x(i)*c(i)*v(i)*exp(-(x(i)*c(i)+x(13)+x(14)+x(15))/x(15))+x(13)*(v(i)*exp(-(x(i)*c(i)+x(13)+x(14)+x(15))/x(15))-1)
+x(14)*v(i)*exp(-(x(i)*c(i)+x(13)+x(14)+x(15))/x(15))+x(15)*(v(i)*exp(-(x(i)*c(i)+x(13)+x(14)
+x(15))/x(15))*(-(x(i)*c(i)+x(13)+x(14)+x(15))/x(15))-Rmin/yingta);
end
f=sum(g);
else f=10^5;
end
A=[];
b=[];
Aeq=[1,0,1,0,0,0,0,0,0,0,0,0,0,0,0;
1,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0;
0,1,0,0,-1,0,0,0,0,0,0,0,0,0,0;
0,0,1,0,0,-1,0,-1,0,0,0,0,0,0,0;
0,0,0,1,0,1,-1,0,-1,0,0,0,0,0,0;
0,0,0,0,1,0,1,0,0,-1,0,0,0,0,0;
0,0,0,0,0,0,0,1,0,0,-1,0,0,0,0;
0,0,0,0,0,0,0,0,1,0,1,-1,0,0,0];
beq=[1200;0;0;0;0;0;0;0];
function [c,ceq]=HL_HN(x)
z=x(4)*log(x(4))+x(5)*log(x(5))+x(6)*log(x(6))-(x(4)+x(6))*log(x(4)+x(6))-(x(5)+x(7))*log(x(5)+x(7))+x(9)*log(x(9))
+x(10)*log(x(10))+x(11)*log(x(11))+x(12)*log(x(12))-(x(9)+x(11))*log(x(9)+x(11))-(x(10)+x(12))*log(x(10)+x(12));
Hmax=358;
theta=0.3;
c=z+Hmax*theta;
ceq=[];
然后我用的是Matlab7.6.0 里自带的GADS中的gatool工具箱进行优化。那个非线性约束写成这种形式就会报错:Optimization running.
Error using ==> constrValidate at 28
Constraint function must return real value.
而如果分类讨论log(x(i))=0的情况时,就可以得到优化结果,但是结果和预期的差别很大。
另外,Aeq,beq输进去后,x(1)~x(12)的值就不变化了
哪位高手可以指点一下?错在哪里呢?多谢多谢!